From c4b761913fcdc41983fc1b3ecc1fc3800663f9e7 Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 12 Jan 2026 21:13:10 +0000 Subject: [PATCH 1/9] chore: rename light-ctoken-interface to light-token-interface Phase 1 of ctoken to light-token rename: - Rename crate: light-ctoken-interface -> light-token-interface - Rename directory: program-libs/ctoken-interface -> program-libs/token-interface - Rename internal directories: src/state/ctoken -> src/state/token - Rename types: - CToken -> Token - CTokenError -> TokenError - CTokenZeroCopyMeta -> TokenZeroCopyMeta - CompressedTokenConfig -> TokenConfig - ZCToken -> ZToken - ZCTokenMut -> ZTokenMut - Rename constants: - CTOKEN_PROGRAM_ID -> LIGHT_TOKEN_PROGRAM_ID - Rename functions: - is_ctoken_account -> is_token_account - calculate_ctoken_account_size -> calculate_token_account_size - with_mint_to_ctoken -> with_mint_to_token - compress_ctoken -> compress_token - decompress_ctoken -> decompress_token - Rename Action variant: MintToCToken -> MintToToken - Update all imports across the codebase --- Cargo.lock | 104 +++++------ Cargo.toml | 4 +- DOCS.md | 4 +- forester-utils/Cargo.toml | 2 +- forester-utils/src/instructions/claim.rs | 6 +- .../src/instructions/withdraw_funding_pool.rs | 4 +- forester/Cargo.toml | 2 +- forester/src/compressible/bootstrap.rs | 16 +- forester/src/compressible/compressor.rs | 6 +- forester/src/compressible/state.rs | 18 +- forester/src/compressible/subscriber.rs | 4 +- forester/src/compressible/types.rs | 6 +- forester/tests/e2e_test.rs | 2 +- forester/tests/test_compressible_ctoken.rs | 8 +- program-libs/account-checks/CLAUDE.md | 2 +- program-libs/compressible/CLAUDE.md | 2 +- .../Cargo.toml | 6 +- .../src/constants.rs | 6 +- .../src/discriminator.rs | 0 .../src/error.rs | 166 ++++++++--------- .../src/hash_cache.rs | 6 +- .../create_associated_token_account.rs | 0 .../src/instructions/create_token_account.rs} | 0 .../extensions/compressed_only.rs | 6 +- .../instructions/extensions/compressible.rs | 16 +- .../src/instructions/extensions/mod.rs | 0 .../src/instructions/extensions/pausable.rs | 0 .../extensions/permanent_delegate.rs | 0 .../instructions/extensions/token_metadata.rs | 0 .../src/instructions/mint_action/builder.rs | 8 +- .../mint_action/compress_and_close_cmint.rs | 0 .../instructions/mint_action/cpi_context.rs | 0 .../mint_action/decompress_mint.rs | 0 .../mint_action/instruction_data.rs | 16 +- .../mint_action/mint_to_compressed.rs | 0 .../mint_action/mint_to_token.rs} | 2 +- .../src/instructions/mint_action/mod.rs | 4 +- .../mint_action/update_metadata.rs | 0 .../instructions/mint_action/update_mint.rs | 0 .../src/instructions/mod.rs | 2 +- .../src/instructions/transfer2/compression.rs | 36 ++-- .../src/instructions/transfer2/cpi_context.rs | 0 .../transfer2/instruction_data.rs | 0 .../src/instructions/transfer2/mod.rs | 0 .../src/lib.rs | 0 .../src/pool_derivation.rs | 8 +- .../src/state/compressed_token/hash.rs | 0 .../src/state/compressed_token/mod.rs | 0 .../src/state/compressed_token/token_data.rs | 20 +- .../compressed_token/token_data_version.rs | 14 +- .../src/state/extensions/compressed_only.rs | 6 +- .../src/state/extensions/compressible.rs | 2 +- .../src/state/extensions/extension_struct.rs | 4 +- .../src/state/extensions/extension_type.rs | 4 +- .../src/state/extensions/mod.rs | 0 .../src/state/extensions/pausable.rs | 0 .../state/extensions/permanent_delegate.rs | 0 .../src/state/extensions/token_metadata.rs | 0 .../src/state/extensions/transfer_fee.rs | 8 +- .../src/state/extensions/transfer_hook.rs | 0 .../src/state/mint/borsh.rs | 0 .../src/state/mint/compressed_mint.rs | 22 +-- .../src/state/mint/mod.rs | 0 .../src/state/mint/top_up.rs | 6 +- .../src/state/mint/zero_copy.rs | 30 +-- .../src/state/mod.rs | 4 +- .../src/state/token}/borsh.rs | 10 +- .../src/state/token}/mod.rs | 4 +- .../src/state/token}/size.rs | 4 +- .../src/state/token/token_struct.rs} | 18 +- .../src/state/token}/top_up.rs | 6 +- .../src/state/token}/zero_copy.rs | 172 +++++++++--------- .../src/token_2022_extensions.rs | 10 +- .../tests/compressed_mint.rs | 2 +- .../tests/cross_deserialization.rs | 68 +++---- .../tests/hash_tests.rs | 2 +- .../tests/mint_borsh_zero_copy.rs | 6 +- .../tests/mint_compat.rs | 2 +- .../tests/mod.rs | 2 +- .../tests/pool_derivation.rs | 2 +- .../tests/token}/failing.rs | 28 +-- .../tests/token}/mod.rs | 2 +- .../tests/token/randomized_solana_token.rs} | 8 +- .../tests/token}/size.rs | 20 +- .../tests/token}/spl_compat.rs | 56 +++--- .../tests/token}/top_up.rs | 20 +- .../tests/token}/zero_copy_new.rs | 46 ++--- .../tests/token_data.rs | 2 +- .../tests/token_data_hash.rs | 2 +- .../tests/token_metadata.rs | 2 +- .../compressed-token-test/Cargo.toml | 2 +- .../tests/compress_only/all.rs | 14 +- .../tests/compress_only/ata_decompress.rs | 26 +-- .../compress_only/decompress_restrictions.rs | 2 +- .../tests/compress_only/default_state.rs | 18 +- .../compress_only/invalid_destination.rs | 2 +- .../compress_only/invalid_extension_state.rs | 2 +- .../tests/compress_only/mod.rs | 22 +-- .../compress_only/restricted_required.rs | 2 +- .../tests/compress_only/withheld_fee.rs | 8 +- .../tests/ctoken/approve_revoke.rs | 8 +- .../tests/ctoken/close.rs | 24 +-- .../tests/ctoken/compress_and_close.rs | 26 +-- .../tests/ctoken/create.rs | 46 ++--- .../tests/ctoken/create_ata.rs | 64 +++---- .../tests/ctoken/create_ata2.rs | 12 +- .../tests/ctoken/extensions.rs | 24 +-- .../tests/ctoken/extensions_failing.rs | 2 +- .../tests/ctoken/freeze_thaw.rs | 6 +- .../tests/ctoken/functional.rs | 14 +- .../tests/ctoken/functional_ata.rs | 22 +-- .../tests/ctoken/shared.rs | 14 +- .../tests/ctoken/transfer.rs | 22 +-- .../tests/ctoken/transfer_checked.rs | 2 +- .../tests/freeze/compress_only.rs | 8 +- .../tests/freeze/functional.rs | 2 +- .../compressed-token-test/tests/mint/burn.rs | 6 +- .../tests/mint/cpi_context.rs | 36 ++-- .../tests/mint/ctoken_mint_to.rs | 8 +- .../tests/mint/edge_cases.rs | 6 +- .../tests/mint/failing.rs | 38 ++-- .../tests/mint/functional.rs | 12 +- .../tests/mint/random.rs | 6 +- .../compressed-token-test/tests/token_pool.rs | 2 +- .../tests/transfer2/compress_failing.rs | 10 +- .../tests/transfer2/decompress_failing.rs | 4 +- .../tests/transfer2/functional.rs | 2 +- .../no_system_program_cpi_failing.rs | 52 +++--- .../tests/transfer2/random.rs | 2 +- .../tests/transfer2/shared.rs | 2 +- .../tests/transfer2/spl_ctoken.rs | 4 +- .../tests/transfer2/transfer_failing.rs | 2 +- program-tests/registry-test/Cargo.toml | 2 +- .../registry-test/tests/compressible.rs | 46 ++--- program-tests/utils/Cargo.toml | 2 +- program-tests/utils/src/assert_claim.rs | 8 +- .../utils/src/assert_close_token_account.rs | 4 +- .../utils/src/assert_create_token_account.rs | 10 +- .../utils/src/assert_ctoken_approve_revoke.rs | 14 +- program-tests/utils/src/assert_ctoken_burn.rs | 8 +- .../utils/src/assert_ctoken_freeze_thaw.rs | 14 +- .../utils/src/assert_ctoken_mint_to.rs | 8 +- .../utils/src/assert_ctoken_transfer.rs | 6 +- program-tests/utils/src/assert_metadata.rs | 2 +- program-tests/utils/src/assert_mint_action.rs | 10 +- .../utils/src/assert_mint_to_compressed.rs | 6 +- program-tests/utils/src/assert_transfer2.rs | 22 +-- program-tests/utils/src/conversions.rs | 2 +- program-tests/utils/src/mint_2022.rs | 2 +- program-tests/utils/src/mint_assert.rs | 4 +- program-tests/utils/src/spl.rs | 2 +- programs/compressed-token/anchor/Cargo.toml | 2 +- programs/compressed-token/anchor/src/burn.rs | 2 +- .../compressed-token/anchor/src/delegation.rs | 2 +- .../compressed-token/anchor/src/freeze.rs | 4 +- .../src/instructions/create_token_pool.rs | 2 +- programs/compressed-token/anchor/src/lib.rs | 4 +- .../anchor/src/process_mint.rs | 2 +- .../anchor/src/process_transfer.rs | 4 +- programs/compressed-token/program/CLAUDE.md | 4 +- programs/compressed-token/program/Cargo.toml | 6 +- .../compressed-token/program/docs/ACCOUNTS.md | 26 +-- .../program/docs/EXTENSIONS.md | 8 +- .../docs/compressed_token/ADD_TOKEN_POOL.md | 4 +- .../compressed_token/CREATE_TOKEN_POOL.md | 4 +- .../docs/compressed_token/MINT_ACTION.md | 4 +- .../docs/compressed_token/TRANSFER2.md | 8 +- .../program/docs/compressible/CLAIM.md | 4 +- .../program/docs/ctoken/APPROVE.md | 2 +- .../program/docs/ctoken/BURN.md | 2 +- .../program/docs/ctoken/BURN_CHECKED.md | 2 +- .../program/docs/ctoken/CLOSE.md | 2 +- .../program/docs/ctoken/CREATE.md | 10 +- .../program/docs/ctoken/FREEZE_ACCOUNT.md | 2 +- .../program/docs/ctoken/MINT_TO.md | 4 +- .../program/docs/ctoken/MINT_TO_CHECKED.md | 4 +- .../program/docs/ctoken/REVOKE.md | 2 +- .../program/docs/ctoken/THAW_ACCOUNT.md | 2 +- .../program/docs/ctoken/TRANSFER.md | 2 +- .../program/docs/ctoken/TRANSFER_CHECKED.md | 2 +- .../compressed_token/mint_action/accounts.rs | 4 +- .../actions/compress_and_close_cmint.rs | 2 +- .../mint_action/actions/create_mint.rs | 2 +- .../mint_action/actions/decompress_mint.rs | 2 +- .../mint_action/actions/mint_to.rs | 2 +- .../mint_action/actions/mint_to_ctoken.rs | 6 +- .../mint_action/actions/process_actions.rs | 8 +- .../mint_action/actions/update_metadata.rs | 4 +- .../mint_action/mint_input.rs | 2 +- .../mint_action/mint_output.rs | 2 +- .../compressed_token/mint_action/processor.rs | 6 +- .../mint_action/queue_indices.rs | 2 +- .../mint_action/zero_copy_config.rs | 2 +- .../transfer2/change_account.rs | 2 +- .../transfer2/check_extensions.rs | 2 +- .../compression/ctoken/compress_and_close.rs | 20 +- .../ctoken/compress_or_decompress_ctokens.rs | 20 +- .../compression/ctoken/decompress.rs | 26 +-- .../transfer2/compression/ctoken/inputs.rs | 2 +- .../transfer2/compression/ctoken/mod.rs | 2 +- .../transfer2/compression/mod.rs | 6 +- .../transfer2/compression/spl.rs | 2 +- .../src/compressed_token/transfer2/config.rs | 2 +- .../src/compressed_token/transfer2/cpi.rs | 2 +- .../compressed_token/transfer2/processor.rs | 28 +-- .../compressed_token/transfer2/sum_check.rs | 2 +- .../transfer2/token_inputs.rs | 8 +- .../transfer2/token_outputs.rs | 2 +- .../program/src/compressible/claim.rs | 10 +- .../program/src/ctoken/approve_revoke.rs | 8 +- .../program/src/ctoken/close/processor.rs | 8 +- .../program/src/ctoken/create.rs | 2 +- .../program/src/ctoken/create_ata.rs | 4 +- .../program/src/ctoken/transfer/shared.rs | 18 +- .../src/extensions/check_mint_extensions.rs | 2 +- .../program/src/extensions/mod.rs | 18 +- .../program/src/extensions/processor.rs | 2 +- .../program/src/extensions/token_metadata.rs | 2 +- programs/compressed-token/program/src/lib.rs | 4 +- .../program/src/shared/compressible_top_up.rs | 12 +- .../program/src/shared/cpi_bytes_size.rs | 8 +- .../src/shared/initialize_ctoken_account.rs | 18 +- .../program/src/shared/owner_validation.rs | 6 +- .../program/src/shared/token_input.rs | 8 +- .../program/src/shared/token_output.rs | 2 +- .../program/tests/allocation_test.rs | 2 +- .../program/tests/check_extensions.rs | 2 +- .../program/tests/compress_and_close.rs | 12 +- .../program/tests/exact_allocation_test.rs | 2 +- .../compressed-token/program/tests/mint.rs | 4 +- .../program/tests/mint_action.rs | 12 +- .../tests/mint_action_accounts_validation.rs | 2 +- .../program/tests/mint_validation.rs | 2 +- .../program/tests/multi_sum_check.rs | 2 +- .../program/tests/queue_indices.rs | 2 +- .../program/tests/token_input.rs | 2 +- .../program/tests/token_output.rs | 2 +- programs/registry/Cargo.toml | 2 +- .../compressible/compressed_token/accounts.rs | 6 +- .../compressed_token/compress_and_close.rs | 22 +-- .../src/compressible/compressed_token/mod.rs | 2 +- scripts/lint.sh | 6 +- sdk-libs/client/Cargo.toml | 2 +- sdk-libs/client/src/indexer/types.rs | 2 +- sdk-libs/ctoken-sdk/Cargo.toml | 8 +- .../v1/approve/instruction.rs | 4 +- .../v1/batch_compress/instruction.rs | 4 +- .../v1/transfer/instruction.rs | 4 +- .../src/compressed_token/v2/account2.rs | 12 +- .../compressed_token/v2/compress_and_close.rs | 10 +- .../v2/create_compressed_mint/instruction.rs | 20 +- .../compressed_token/v2/decompress_full.rs | 4 +- .../v2/mint_action/account_metas.rs | 2 +- .../v2/mint_action/cpi_accounts.rs | 4 +- .../v2/mint_action/instruction.rs | 12 +- .../v2/mint_to_compressed/instruction.rs | 8 +- .../v2/transfer2/cpi_accounts.rs | 4 +- .../v2/transfer2/instruction.rs | 6 +- .../v2/update_compressed_mint/instruction.rs | 14 +- .../src/compressible/decompress_runtime.rs | 4 +- .../ctoken-sdk/src/ctoken/compressible.rs | 2 +- sdk-libs/ctoken-sdk/src/ctoken/create.rs | 6 +- sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs | 8 +- .../ctoken-sdk/src/ctoken/create_cmint.rs | 20 +- sdk-libs/ctoken-sdk/src/ctoken/decompress.rs | 4 +- .../ctoken-sdk/src/ctoken/decompress_cmint.rs | 4 +- sdk-libs/ctoken-sdk/src/ctoken/mint_to.rs | 28 +-- sdk-libs/ctoken-sdk/src/ctoken/mod.rs | 4 +- .../src/ctoken/transfer_ctoken_spl.rs | 4 +- .../src/ctoken/transfer_spl_ctoken.rs | 4 +- sdk-libs/ctoken-sdk/src/error.rs | 6 +- sdk-libs/ctoken-sdk/src/pack.rs | 18 +- sdk-libs/ctoken-sdk/src/spl_interface.rs | 14 +- sdk-libs/ctoken-sdk/src/utils.rs | 6 +- .../tests/mint_action_cpi_accounts_tests.rs | 24 +-- sdk-libs/macros/src/compressible/GUIDE.md | 8 +- sdk-libs/program-test/Cargo.toml | 4 +- sdk-libs/program-test/src/compressible.rs | 22 +-- .../forester/compress_and_close_forester.rs | 4 +- sdk-libs/token-client/Cargo.toml | 2 +- .../create_compressible_token_account.rs | 2 +- .../token-client/src/actions/create_mint.rs | 2 +- .../src/actions/ctoken_transfer.rs | 2 +- .../token-client/src/actions/mint_action.rs | 2 +- .../src/actions/mint_to_compressed.rs | 2 +- .../token-client/src/actions/spl_interface.rs | 2 +- .../src/actions/transfer2/compress.rs | 2 +- .../src/instructions/create_mint.rs | 2 +- .../src/instructions/mint_action.rs | 14 +- .../src/instructions/mint_to_compressed.rs | 2 +- .../src/instructions/transfer2.rs | 24 +-- .../instructions/update_compressed_mint.rs | 4 +- sdk-tests/csdk-anchor-derived-test/Cargo.toml | 2 +- sdk-tests/csdk-anchor-derived-test/src/lib.rs | 6 +- .../csdk-anchor-derived-test/src/state.rs | 2 +- .../tests/basic_test.rs | 2 +- .../csdk-anchor-full-derived-test/Cargo.toml | 2 +- .../csdk-anchor-full-derived-test/src/lib.rs | 6 +- .../src/state.rs | 2 +- .../tests/basic_test.rs | 2 +- sdk-tests/sdk-compressible-test/Cargo.toml | 2 +- .../create_user_record_and_game_session.rs | 8 +- .../decompress_accounts_idempotent.rs | 6 +- sdk-tests/sdk-compressible-test/src/state.rs | 2 +- .../tests/multi_account_tests.rs | 2 +- sdk-tests/sdk-ctoken-test/Cargo.toml | 2 +- .../sdk-ctoken-test/src/mint_to_ctoken.rs | 2 +- .../sdk-ctoken-test/tests/scenario_cmint.rs | 14 +- .../tests/scenario_cmint_compression_only.rs | 14 +- sdk-tests/sdk-ctoken-test/tests/shared.rs | 10 +- .../tests/test_approve_revoke.rs | 14 +- sdk-tests/sdk-ctoken-test/tests/test_burn.rs | 10 +- .../sdk-ctoken-test/tests/test_create_ata.rs | 8 +- .../tests/test_create_cmint.rs | 6 +- .../tests/test_create_token_account.rs | 8 +- .../tests/test_ctoken_mint_to.rs | 16 +- .../tests/test_decompress_cmint.rs | 10 +- .../sdk-ctoken-test/tests/test_freeze_thaw.rs | 16 +- .../tests/test_mint_to_ctoken.rs | 22 +-- .../sdk-ctoken-test/tests/test_transfer.rs | 12 +- .../tests/test_transfer_checked.rs | 14 +- .../tests/test_transfer_interface.rs | 12 +- .../tests/test_transfer_spl_ctoken.rs | 8 +- sdk-tests/sdk-token-test/CLAUDE.md | 2 +- sdk-tests/sdk-token-test/Cargo.toml | 6 +- .../sdk-token-test/src/ctoken_pda/mint.rs | 4 +- .../src/mint_compressed_tokens_cpi_write.rs | 4 +- .../sdk-token-test/src/pda_ctoken/mint.rs | 8 +- .../src/pda_ctoken/processor.rs | 2 +- .../src/process_compress_full_and_close.rs | 2 +- ...s_create_ctoken_with_compress_to_pubkey.rs | 4 +- .../src/process_four_transfer2.rs | 6 +- sdk-tests/sdk-token-test/tests/ctoken_pda.rs | 10 +- .../tests/decompress_full_cpi.rs | 28 +-- sdk-tests/sdk-token-test/tests/pda_ctoken.rs | 12 +- .../sdk-token-test/tests/test_4_transfer2.rs | 6 +- .../tests/test_compress_full_and_close.rs | 10 +- .../tests/test_compress_to_pubkey.rs | 2 +- 338 files changed, 1540 insertions(+), 1540 deletions(-) rename program-libs/{ctoken-interface => token-interface}/Cargo.toml (91%) rename program-libs/{ctoken-interface => token-interface}/src/constants.rs (87%) rename program-libs/{ctoken-interface => token-interface}/src/discriminator.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/error.rs (57%) rename program-libs/{ctoken-interface => token-interface}/src/hash_cache.rs (92%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/create_associated_token_account.rs (100%) rename program-libs/{ctoken-interface/src/instructions/create_ctoken_account.rs => token-interface/src/instructions/create_token_account.rs} (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/extensions/compressed_only.rs (85%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/extensions/compressible.rs (87%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/extensions/mod.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/extensions/pausable.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/extensions/permanent_delegate.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/extensions/token_metadata.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mint_action/builder.rs (95%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mint_action/compress_and_close_cmint.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mint_action/cpi_context.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mint_action/decompress_mint.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mint_action/instruction_data.rs (95%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mint_action/mint_to_compressed.rs (100%) rename program-libs/{ctoken-interface/src/instructions/mint_action/mint_to_ctoken.rs => token-interface/src/instructions/mint_action/mint_to_token.rs} (89%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mint_action/mod.rs (88%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mint_action/update_metadata.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mint_action/update_mint.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/mod.rs (76%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/transfer2/compression.rs (85%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/transfer2/cpi_context.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/transfer2/instruction_data.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/instructions/transfer2/mod.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/lib.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/pool_derivation.rs (95%) rename program-libs/{ctoken-interface => token-interface}/src/state/compressed_token/hash.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/state/compressed_token/mod.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/state/compressed_token/token_data.rs (84%) rename program-libs/{ctoken-interface => token-interface}/src/state/compressed_token/token_data_version.rs (85%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/compressed_only.rs (76%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/compressible.rs (98%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/extension_struct.rs (99%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/extension_type.rs (95%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/mod.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/pausable.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/permanent_delegate.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/token_metadata.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/transfer_fee.rs (83%) rename program-libs/{ctoken-interface => token-interface}/src/state/extensions/transfer_hook.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/state/mint/borsh.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/state/mint/compressed_mint.rs (87%) rename program-libs/{ctoken-interface => token-interface}/src/state/mint/mod.rs (100%) rename program-libs/{ctoken-interface => token-interface}/src/state/mint/top_up.rs (92%) rename program-libs/{ctoken-interface => token-interface}/src/state/mint/zero_copy.rs (94%) rename program-libs/{ctoken-interface => token-interface}/src/state/mod.rs (78%) rename program-libs/{ctoken-interface/src/state/ctoken => token-interface/src/state/token}/borsh.rs (94%) rename program-libs/{ctoken-interface/src/state/ctoken => token-interface/src/state/token}/mod.rs (70%) rename program-libs/{ctoken-interface/src/state/ctoken => token-interface/src/state/token}/size.rs (89%) rename program-libs/{ctoken-interface/src/state/ctoken/ctoken_struct.rs => token-interface/src/state/token/token_struct.rs} (90%) rename program-libs/{ctoken-interface/src/state/ctoken => token-interface/src/state/token}/top_up.rs (93%) rename program-libs/{ctoken-interface/src/state/ctoken => token-interface/src/state/token}/zero_copy.rs (85%) rename program-libs/{ctoken-interface => token-interface}/src/token_2022_extensions.rs (94%) rename program-libs/{ctoken-interface => token-interface}/tests/compressed_mint.rs (99%) rename program-libs/{ctoken-interface => token-interface}/tests/cross_deserialization.rs (73%) rename program-libs/{ctoken-interface => token-interface}/tests/hash_tests.rs (99%) rename program-libs/{ctoken-interface => token-interface}/tests/mint_borsh_zero_copy.rs (98%) rename program-libs/{ctoken-interface => token-interface}/tests/mint_compat.rs (99%) rename program-libs/{ctoken-interface => token-interface}/tests/mod.rs (56%) rename program-libs/{ctoken-interface => token-interface}/tests/pool_derivation.rs (98%) rename program-libs/{ctoken-interface/tests/ctoken => token-interface/tests/token}/failing.rs (69%) rename program-libs/{ctoken-interface/tests/ctoken => token-interface/tests/token}/mod.rs (72%) rename program-libs/{ctoken-interface/tests/ctoken/randomized_solana_ctoken.rs => token-interface/tests/token/randomized_solana_token.rs} (98%) rename program-libs/{ctoken-interface/tests/ctoken => token-interface/tests/token}/size.rs (74%) rename program-libs/{ctoken-interface/tests/ctoken => token-interface/tests/token}/spl_compat.rs (88%) rename program-libs/{ctoken-interface/tests/ctoken => token-interface/tests/token}/top_up.rs (76%) rename program-libs/{ctoken-interface/tests/ctoken => token-interface/tests/token}/zero_copy_new.rs (68%) rename program-libs/{ctoken-interface => token-interface}/tests/token_data.rs (99%) rename program-libs/{ctoken-interface => token-interface}/tests/token_data_hash.rs (99%) rename program-libs/{ctoken-interface => token-interface}/tests/token_metadata.rs (99%) diff --git a/Cargo.lock b/Cargo.lock index edbd0ea7a7..abf6331f04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -296,10 +296,10 @@ dependencies = [ "anchor-lang", "anchor-spl 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)", "light-compressed-account", - "light-ctoken-interface", "light-hasher", "light-heap", "light-system-program-anchor", + "light-token-interface", "light-zero-copy", "num-bigint 0.4.6", "pinocchio-pubkey", @@ -1428,7 +1428,6 @@ dependencies = [ "light-compressed-account", "light-compressed-token", "light-compressible", - "light-ctoken-interface", "light-ctoken-sdk", "light-program-test", "light-prover-client", @@ -1437,6 +1436,7 @@ dependencies = [ "light-system-program-anchor", "light-test-utils", "light-token-client", + "light-token-interface", "light-verifier", "light-zero-copy", "rand 0.8.5", @@ -1645,7 +1645,6 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-compressible-client", - "light-ctoken-interface", "light-ctoken-sdk", "light-ctoken-types", "light-hasher", @@ -1656,6 +1655,7 @@ dependencies = [ "light-sdk-types", "light-test-utils", "light-token-client", + "light-token-interface", "solana-account", "solana-instruction", "solana-keypair", @@ -1680,7 +1680,6 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-compressible-client", - "light-ctoken-interface", "light-ctoken-sdk", "light-ctoken-types", "light-hasher", @@ -1691,6 +1690,7 @@ dependencies = [ "light-sdk-types", "light-test-utils", "light-token-client", + "light-token-interface", "solana-account", "solana-account-info", "solana-instruction", @@ -2373,7 +2373,6 @@ dependencies = [ "light-compressed-account", "light-compressed-token", "light-compressible", - "light-ctoken-interface", "light-ctoken-sdk", "light-hash-set", "light-hasher", @@ -2385,6 +2384,7 @@ dependencies = [ "light-system-program-anchor", "light-test-utils", "light-token-client", + "light-token-interface", "photon-api", "prometheus", "rand 0.8.5", @@ -2426,7 +2426,6 @@ dependencies = [ "light-client", "light-compressed-account", "light-concurrent-merkle-tree", - "light-ctoken-interface", "light-hash-set", "light-hasher", "light-indexed-array", @@ -2437,6 +2436,7 @@ dependencies = [ "light-registry", "light-sdk", "light-sparse-merkle-tree", + "light-token-interface", "num-bigint 0.4.6", "num-traits", "serde", @@ -3586,7 +3586,6 @@ dependencies = [ "lazy_static", "light-compressed-account", "light-concurrent-merkle-tree", - "light-ctoken-interface", "light-ctoken-sdk", "light-event", "light-hasher", @@ -3594,6 +3593,7 @@ dependencies = [ "light-merkle-tree-metadata", "light-prover-client", "light-sdk", + "light-token-interface", "litesvm", "num-bigint 0.4.6", "photon-api", @@ -3663,7 +3663,6 @@ dependencies = [ "light-array-map", "light-compressed-account", "light-compressible", - "light-ctoken-interface", "light-hasher", "light-heap", "light-program-profiler", @@ -3671,6 +3670,7 @@ dependencies = [ "light-sdk-pinocchio", "light-sdk-types", "light-system-program-anchor", + "light-token-interface", "light-zero-copy", "num-bigint 0.4.6", "pinocchio", @@ -3748,41 +3748,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "light-ctoken-interface" -version = "0.1.1" -dependencies = [ - "aligned-sized", - "anchor-lang", - "borsh 0.10.4", - "bytemuck", - "light-account-checks", - "light-array-map", - "light-compressed-account", - "light-compressible", - "light-ctoken-interface", - "light-hasher", - "light-heap", - "light-macros", - "light-program-profiler", - "light-zero-copy", - "num-bigint 0.4.6", - "pinocchio", - "pinocchio-pubkey", - "rand 0.8.5", - "solana-account-info", - "solana-msg 2.2.1", - "solana-program-error 2.2.2", - "solana-pubkey 2.4.0", - "solana-sysvar", - "spl-pod", - "spl-token-2022 7.0.0", - "spl-token-metadata-interface 0.6.0", - "thiserror 2.0.17", - "tinyvec", - "zerocopy", -] - [[package]] name = "light-ctoken-sdk" version = "0.2.1" @@ -3794,12 +3759,12 @@ dependencies = [ "light-compressed-account", "light-compressed-token", "light-compressible", - "light-ctoken-interface", "light-ctoken-types", "light-macros", "light-program-profiler", "light-sdk", "light-sdk-types", + "light-token-interface", "light-zero-copy", "pinocchio", "solana-account-info", @@ -4010,7 +3975,6 @@ dependencies = [ "light-compressible", "light-compressible-client", "light-concurrent-merkle-tree", - "light-ctoken-interface", "light-ctoken-sdk", "light-event", "light-hasher", @@ -4022,6 +3986,7 @@ dependencies = [ "light-registry", "light-sdk", "light-sdk-types", + "light-token-interface", "light-zero-copy", "litesvm", "log", @@ -4084,11 +4049,11 @@ dependencies = [ "light-account-checks", "light-batched-merkle-tree", "light-compressible", - "light-ctoken-interface", "light-macros", "light-merkle-tree-metadata", "light-program-profiler", "light-system-program-anchor", + "light-token-interface", "light-zero-copy", "solana-account-info", "solana-instruction", @@ -4249,7 +4214,6 @@ dependencies = [ "light-compressed-token", "light-compressible", "light-concurrent-merkle-tree", - "light-ctoken-interface", "light-ctoken-sdk", "light-event", "light-hasher", @@ -4264,6 +4228,7 @@ dependencies = [ "light-sparse-merkle-tree", "light-system-program-anchor", "light-token-client", + "light-token-interface", "light-zero-copy", "log", "num-bigint 0.4.6", @@ -4287,10 +4252,10 @@ dependencies = [ "light-client", "light-compressed-account", "light-compressible", - "light-ctoken-interface", "light-ctoken-sdk", "light-ctoken-types", "light-sdk", + "light-token-interface", "light-zero-copy", "solana-instruction", "solana-keypair", @@ -4303,6 +4268,41 @@ dependencies = [ "spl-token-2022 7.0.0", ] +[[package]] +name = "light-token-interface" +version = "0.1.1" +dependencies = [ + "aligned-sized", + "anchor-lang", + "borsh 0.10.4", + "bytemuck", + "light-account-checks", + "light-array-map", + "light-compressed-account", + "light-compressible", + "light-hasher", + "light-heap", + "light-macros", + "light-program-profiler", + "light-token-interface", + "light-zero-copy", + "num-bigint 0.4.6", + "pinocchio", + "pinocchio-pubkey", + "rand 0.8.5", + "solana-account-info", + "solana-msg 2.2.1", + "solana-program-error 2.2.2", + "solana-pubkey 2.4.0", + "solana-sysvar", + "spl-pod", + "spl-token-2022 7.0.0", + "spl-token-metadata-interface 0.6.0", + "thiserror 2.0.17", + "tinyvec", + "zerocopy", +] + [[package]] name = "light-verifier" version = "6.0.0" @@ -5619,7 +5619,6 @@ dependencies = [ "light-client", "light-compressed-account", "light-compressible", - "light-ctoken-interface", "light-ctoken-sdk", "light-hasher", "light-program-test", @@ -5627,6 +5626,7 @@ dependencies = [ "light-registry", "light-test-utils", "light-token-client", + "light-token-interface", "light-zero-copy", "serial_test", "solana-sdk", @@ -6050,7 +6050,6 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-compressible-client", - "light-ctoken-interface", "light-ctoken-sdk", "light-ctoken-types", "light-hasher", @@ -6060,6 +6059,7 @@ dependencies = [ "light-sdk-types", "light-test-utils", "light-token-client", + "light-token-interface", "solana-account", "solana-instruction", "solana-keypair", @@ -6083,13 +6083,13 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-compressible-client", - "light-ctoken-interface", "light-ctoken-sdk", "light-ctoken-types", "light-program-test", "light-sdk", "light-sdk-types", "light-test-utils", + "light-token-interface", "solana-program", "solana-sdk", "spl-pod", @@ -6159,7 +6159,6 @@ dependencies = [ "light-client", "light-compressed-account", "light-compressible", - "light-ctoken-interface", "light-ctoken-sdk", "light-ctoken-types", "light-hasher", @@ -6169,6 +6168,7 @@ dependencies = [ "light-sdk-types", "light-test-utils", "light-token-client", + "light-token-interface", "light-zero-copy", "serial_test", "solana-sdk", diff --git a/Cargo.toml b/Cargo.toml index daef1112c1..ac66d6d86e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ members = [ "program-libs/batched-merkle-tree", "program-libs/bloom-filter", "program-libs/compressible", - "program-libs/ctoken-interface", + "program-libs/token-interface", "program-libs/hasher", "program-libs/verifier", "program-libs/merkle-tree-metadata", @@ -191,7 +191,7 @@ light-sdk-types = { path = "sdk-libs/sdk-types", version = "0.17.1", default-fea light-compressed-account = { path = "program-libs/compressed-account", version = "0.7.0", default-features = false } light-compressible = { path = "program-libs/compressible", version = "0.2.0" } light-compressible-client = { path = "sdk-libs/compressible-client", version = "0.17.1" } -light-ctoken-interface = { path = "program-libs/ctoken-interface", version = "0.1.0" } +light-token-interface = { path = "program-libs/token-interface", version = "0.1.0" } light-account-checks = { path = "program-libs/account-checks", version = "0.6.0", default-features = false } light-verifier = { path = "program-libs/verifier", version = "6.0.0" } light-zero-copy = { path = "program-libs/zero-copy", version = "0.5.0", default-features = false } diff --git a/DOCS.md b/DOCS.md index 7eb0d7fb09..267b62c3fe 100644 --- a/DOCS.md +++ b/DOCS.md @@ -161,11 +161,11 @@ Document all error codes that can be returned: - **Description** - What the error indicates - **Common causes** - Typical scenarios that trigger this error - **Resolution** - How to fix or avoid the error -- **Location** - Where error enum is defined (e.g., `anchor_compressed_token::ErrorCode`, `light_ctoken_interface::CTokenError`) +- **Location** - Where error enum is defined (e.g., `anchor_compressed_token::ErrorCode`, `light_token_interface::CTokenError`) **Common error crate locations in Light Protocol:** - `anchor_compressed_token::ErrorCode` - Compressed token program errors -- `light_ctoken_interface::CTokenError` - CToken type errors (18001-18037 range) +- `light_token_interface::CTokenError` - CToken type errors (18001-18037 range) - `light_compressible::CompressibleError` - Compressible account errors (19001-19002 range) - `light_account_checks::AccountError` - Account validation errors (12006-12021 range) - `light_hasher::HasherError` - Hasher operation errors diff --git a/forester-utils/Cargo.toml b/forester-utils/Cargo.toml index f01848ce00..9bbb143256 100644 --- a/forester-utils/Cargo.toml +++ b/forester-utils/Cargo.toml @@ -31,7 +31,7 @@ light-client = { workspace = true } light-prover-client = { workspace = true } light-registry = { workspace = true, features = ["cpi"] } account-compression = { workspace = true, features = ["cpi"] } -light-ctoken-interface = { workspace = true } +light-token-interface = { workspace = true } solana-instruction = { workspace = true } solana-pubkey = { workspace = true } diff --git a/forester-utils/src/instructions/claim.rs b/forester-utils/src/instructions/claim.rs index fa437ac387..8df87140f1 100644 --- a/forester-utils/src/instructions/claim.rs +++ b/forester-utils/src/instructions/claim.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use solana_instruction::{AccountMeta, Instruction}; use solana_pubkey::Pubkey; @@ -13,7 +13,7 @@ use solana_pubkey::Pubkey; pub fn derive_pool_pda(compression_authority: &Pubkey) -> (Pubkey, u8) { Pubkey::find_program_address( &[b"pool", compression_authority.as_ref()], - &Pubkey::from(CTOKEN_PROGRAM_ID), + &Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), ) } @@ -49,7 +49,7 @@ pub fn claim( } Instruction { - program_id: Pubkey::from(CTOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts, data: instruction_data, } diff --git a/forester-utils/src/instructions/withdraw_funding_pool.rs b/forester-utils/src/instructions/withdraw_funding_pool.rs index 8701fde3f0..6bf69bd7a6 100644 --- a/forester-utils/src/instructions/withdraw_funding_pool.rs +++ b/forester-utils/src/instructions/withdraw_funding_pool.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use solana_instruction::{AccountMeta, Instruction}; use solana_pubkey::Pubkey; @@ -37,7 +37,7 @@ pub fn withdraw_funding_pool( ]; Instruction { - program_id: Pubkey::from(CTOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts, data: instruction_data, } diff --git a/forester/Cargo.toml b/forester/Cargo.toml index ad9c14484e..24a8dc5f53 100644 --- a/forester/Cargo.toml +++ b/forester/Cargo.toml @@ -27,7 +27,7 @@ light-merkle-tree-metadata = { workspace = true } light-sdk = { workspace = true, features = ["anchor"] } light-program-test = { workspace = true } light-compressible = { workspace = true } -light-ctoken-interface = { workspace = true } +light-token-interface = { workspace = true } light-ctoken-sdk = { workspace = true } solana-rpc-client-api = { workspace = true } solana-transaction-status = { workspace = true } diff --git a/forester/src/compressible/bootstrap.rs b/forester/src/compressible/bootstrap.rs index f4b2845b0f..0c6b9a5649 100644 --- a/forester/src/compressible/bootstrap.rs +++ b/forester/src/compressible/bootstrap.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use borsh::BorshDeserialize; -use light_ctoken_interface::{state::CToken, CTOKEN_PROGRAM_ID}; +use light_token_interface::{state::Token, LIGHT_TOKEN_PROGRAM_ID}; use serde_json::json; use solana_sdk::pubkey::Pubkey; use tokio::sync::oneshot; @@ -101,20 +101,20 @@ fn process_account( } }; - // Deserialize CToken - let ctoken = match CToken::try_from_slice(&data_bytes) { + // Deserialize Token + let ctoken = match Token::try_from_slice(&data_bytes) { Ok(token) => token, Err(e) => { debug!( - "Failed to deserialize CToken for account {}: {:?}", + "Failed to deserialize Token for account {}: {:?}", pubkey, e ); return Ok(false); } }; - // Check if account is a valid CToken account (account_type == 2) - if !ctoken.is_ctoken_account() { + // Check if account is a valid Token account (account_type == 2) + if !ctoken.is_token_account() { debug!("Skipping account {} without compressible config", pubkey); return Ok(false); } @@ -182,7 +182,7 @@ async fn bootstrap_with_v2_api( mut shutdown_rx: oneshot::Receiver<()>, ) -> Result<()> { let client = reqwest::Client::new(); - let program_id = Pubkey::new_from_array(CTOKEN_PROGRAM_ID); + let program_id = Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID); let mut total_fetched = 0; let mut total_inserted = 0; @@ -307,7 +307,7 @@ async fn bootstrap_with_standard_api( mut shutdown_rx: oneshot::Receiver<()>, ) -> Result<()> { let client = reqwest::Client::new(); - let program_id = Pubkey::new_from_array(CTOKEN_PROGRAM_ID); + let program_id = Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID); // Filter for accounts with account_type = 2 at position 165 // This indicates a CToken account with extensions (e.g., Compressible) diff --git a/forester/src/compressible/compressor.rs b/forester/src/compressible/compressor.rs index 5189c48c21..4689594476 100644 --- a/forester/src/compressible/compressor.rs +++ b/forester/src/compressible/compressor.rs @@ -5,7 +5,7 @@ use forester_utils::rpc_pool::SolanaRpcPool; use light_client::{indexer::TreeInfo, rpc::Rpc}; use light_compressed_account::TreeType; use light_compressible::config::CompressibleConfig; -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_ctoken_sdk::compressed_token::compress_and_close::CompressAndCloseAccounts as CTokenAccounts; use light_registry::{ accounts::CompressAndCloseContext, compressible::compressed_token::CompressAndCloseIndices, @@ -62,7 +62,7 @@ impl Compressor { registered_forester_pda: Pubkey, ) -> Result { let registry_program_id = Pubkey::from_str(REGISTRY_PROGRAM_ID_STR)?; - let compressed_token_program_id = Pubkey::new_from_array(CTOKEN_PROGRAM_ID); + let compressed_token_program_id = Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID); // Derive compression_authority PDA deterministically (version = 1) let compression_authority_seeds = CompressibleConfig::get_compression_authority_seeds(1); @@ -122,7 +122,7 @@ impl Compressor { let mint_index = packed_accounts.insert_or_get(mint); // Get compression info from Compressible extension - use light_ctoken_interface::state::extensions::ExtensionStruct; + use light_token_interface::state::extensions::ExtensionStruct; let compression = account_state .account .extensions diff --git a/forester/src/compressible/state.rs b/forester/src/compressible/state.rs index e67c9c62af..5dc4ec4f42 100644 --- a/forester/src/compressible/state.rs +++ b/forester/src/compressible/state.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use borsh::BorshDeserialize; use dashmap::DashMap; -use light_ctoken_interface::state::CToken; +use light_token_interface::state::Token; use solana_sdk::{pubkey::Pubkey, rent::Rent}; use tracing::{debug, warn}; @@ -12,12 +12,12 @@ use crate::Result; /// Calculate the slot at which an account becomes compressible /// Returns the last funded slot; accounts are compressible when current_slot > this value fn calculate_compressible_slot( - account: &CToken, + account: &Token, lamports: u64, account_size: usize, ) -> Result { use light_compressible::rent::SLOTS_PER_EPOCH; - use light_ctoken_interface::state::extensions::ExtensionStruct; + use light_token_interface::state::extensions::ExtensionStruct; // Calculate rent exemption dynamically let rent_exemption = Rent::default().minimum_balance(account_size); @@ -32,7 +32,7 @@ fn calculate_compressible_slot( _ => None, }) }) - .ok_or_else(|| anyhow::anyhow!("Missing Compressible extension on CToken account"))?; + .ok_or_else(|| anyhow::anyhow!("Missing Compressible extension on Token account"))?; // Calculate last funded epoch using embedded compression info let last_funded_epoch = compression_info @@ -79,8 +79,8 @@ impl CompressibleAccountTracker { .iter() .filter(|entry| { let state = entry.value(); - // Check if account is a valid CToken (account_type == 2) - state.account.is_ctoken_account() + // Check if account is a valid Token (account_type == 2) + state.account.is_token_account() }) .map(|entry| entry.value().clone()) .collect() @@ -116,9 +116,9 @@ impl CompressibleAccountTracker { account_data: &[u8], lamports: u64, ) -> Result<()> { - // Deserialize CToken using borsh - let ctoken = CToken::try_from_slice(account_data) - .map_err(|e| anyhow::anyhow!("Failed to deserialize CToken with borsh: {:?}", e))?; + // Deserialize Token using borsh + let ctoken = Token::try_from_slice(account_data) + .map_err(|e| anyhow::anyhow!("Failed to deserialize Token with borsh: {:?}", e))?; // Calculate compressible slot let compressible_slot = diff --git a/forester/src/compressible/subscriber.rs b/forester/src/compressible/subscriber.rs index 56d7ad1f0a..563e51c32b 100644 --- a/forester/src/compressible/subscriber.rs +++ b/forester/src/compressible/subscriber.rs @@ -1,7 +1,7 @@ use std::{str::FromStr, sync::Arc}; use futures::StreamExt; -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use solana_account_decoder::UiAccountEncoding; use solana_client::{ nonblocking::pubsub_client::PubsubClient, @@ -53,7 +53,7 @@ impl AccountSubscriber { .await .map_err(|e| anyhow::anyhow!("Failed to connect to WebSocket: {}", e))?; - let program_id = Pubkey::new_from_array(CTOKEN_PROGRAM_ID); + let program_id = Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID); // Subscribe to compressed token program accounts with filter for account_type = 2 at position 165 // This indicates a CToken account with extensions (e.g., Compressible) // "3" is base58 encoding of byte value 2 (ACCOUNT_TYPE_TOKEN_ACCOUNT) diff --git a/forester/src/compressible/types.rs b/forester/src/compressible/types.rs index 4ac94b2a92..75c4831034 100644 --- a/forester/src/compressible/types.rs +++ b/forester/src/compressible/types.rs @@ -1,12 +1,12 @@ -use light_ctoken_interface::state::CToken; +use light_token_interface::state::Token; use solana_sdk::pubkey::Pubkey; -/// State of a compressible CToken account +/// State of a compressible Token account #[derive(Clone, Debug)] pub struct CompressibleAccountState { /// Account public key pub pubkey: Pubkey, - pub account: CToken, + pub account: Token, pub lamports: u64, /// The slot at which this account becomes compressible (last_funded_epoch * SLOTS_PER_EPOCH) /// Accounts are ready to compress when current_slot > compressible_slot diff --git a/forester/tests/e2e_test.rs b/forester/tests/e2e_test.rs index a4452027d2..4617cf1066 100644 --- a/forester/tests/e2e_test.rs +++ b/forester/tests/e2e_test.rs @@ -35,7 +35,7 @@ use light_compressed_token::process_transfer::{ transfer_sdk::{create_transfer_instruction, to_account_metas}, TokenTransferOutputData, }; -use light_ctoken_interface::state::TokenDataVersion; +use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::compat::TokenDataWithMerkleContext; use light_hasher::Poseidon; use light_program_test::accounts::test_accounts::TestAccounts; diff --git a/forester/tests/test_compressible_ctoken.rs b/forester/tests/test_compressible_ctoken.rs index f4e77808be..0c305c23ac 100644 --- a/forester/tests/test_compressible_ctoken.rs +++ b/forester/tests/test_compressible_ctoken.rs @@ -11,7 +11,7 @@ use light_client::{ local_test_validator::{spawn_validator, LightValidatorConfig}, rpc::{LightClient, LightClientConfig, Rpc}, }; -use light_ctoken_interface::state::TokenDataVersion; +use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::compressed_token::create_compressed_mint; use light_registry::{ protocol_config::state::ProtocolConfigPda, @@ -538,10 +538,10 @@ async fn run_bootstrap_test( account_state.pubkey ); - // Verify account is a valid CToken + // Verify account is a valid Token assert!( - account_state.account.is_ctoken_account(), - "Account {} should be a valid CToken account", + account_state.account.is_token_account(), + "Account {} should be a valid Token account", account_state.pubkey ); diff --git a/program-libs/account-checks/CLAUDE.md b/program-libs/account-checks/CLAUDE.md index 8849b9cbe5..1b79608e64 100644 --- a/program-libs/account-checks/CLAUDE.md +++ b/program-libs/account-checks/CLAUDE.md @@ -9,7 +9,7 @@ - `light-compressed-token` - Validates all account inputs in compressed token instructions - `light-system` - Core validation for compressed account operations - `light-compressible` - Validates CompressibleConfig accounts and PDAs -- `light-ctoken-interface` - Uses AccountInfoTrait for runtime-agnostic account handling +- `light-token-interface` - Uses AccountInfoTrait for runtime-agnostic account handling - `light-account-compression` - Merkle tree account validation - `light-batched-merkle-tree` - Batch operation account checks - `compressed-token-sdk` - Uses validation helpers in instruction builders diff --git a/program-libs/compressible/CLAUDE.md b/program-libs/compressible/CLAUDE.md index cfb10734f7..841f20860b 100644 --- a/program-libs/compressible/CLAUDE.md +++ b/program-libs/compressible/CLAUDE.md @@ -6,7 +6,7 @@ # Used in - `light-compressed-token` - Uses CompressibleConfig for account creation, rent claiming, and closing -- `light-ctoken-interface` - Imports CompressibleConfig for compressible extension in token accounts +- `light-token-interface` - Imports CompressibleConfig for compressible extension in token accounts - `light-registry` - Validates CompressibleConfig for compress & close via registry operations - `compressed-token-sdk` - Uses rent functions in compress & close instruction builders - `token-client` - Imports rent calculation helpers for test utilities diff --git a/program-libs/ctoken-interface/Cargo.toml b/program-libs/token-interface/Cargo.toml similarity index 91% rename from program-libs/ctoken-interface/Cargo.toml rename to program-libs/token-interface/Cargo.toml index 8518ab9999..180c907ace 100644 --- a/program-libs/ctoken-interface/Cargo.toml +++ b/program-libs/token-interface/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "light-ctoken-interface" +name = "light-token-interface" version = "0.1.1" edition = { workspace = true } -description = "Light Protocol ctoken instruction data types." +description = "Light Protocol token instruction data types." license = "MIT" [features] @@ -52,7 +52,7 @@ light-account-checks = { workspace = true, features = [ "solana", ] } spl-token-metadata-interface = "0.6.0" -light-ctoken-interface = { workspace = true, features = ["poseidon", "test-only"] } +light-token-interface = { workspace = true, features = ["poseidon", "test-only"] } light-hasher = { workspace = true, features = ["keccak", "sha256", "poseidon"] } [lints.rust.unexpected_cfgs] diff --git a/program-libs/ctoken-interface/src/constants.rs b/program-libs/token-interface/src/constants.rs similarity index 87% rename from program-libs/ctoken-interface/src/constants.rs rename to program-libs/token-interface/src/constants.rs index 30f10eeeea..c73fc45000 100644 --- a/program-libs/ctoken-interface/src/constants.rs +++ b/program-libs/token-interface/src/constants.rs @@ -1,12 +1,12 @@ use light_macros::pubkey_array; pub const CPI_AUTHORITY: [u8; 32] = pubkey_array!("GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy"); -pub const CTOKEN_PROGRAM_ID: [u8; 32] = +pub const LIGHT_TOKEN_PROGRAM_ID: [u8; 32] = pubkey_array!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m"); /// Account size constants -/// Size of a CToken account with embedded compression info (no extensions). -/// CTokenZeroCopy includes: SPL token layout (165) + account_type (1) + decimal_option_prefix (1) +/// Size of a Token account with embedded compression info (no extensions). +/// TokenZeroCopy includes: SPL token layout (165) + account_type (1) + decimal_option_prefix (1) /// + decimals (1) + compression_only (1) + CompressionInfo (96) + has_extensions (1) pub use crate::state::BASE_TOKEN_ACCOUNT_SIZE; diff --git a/program-libs/ctoken-interface/src/discriminator.rs b/program-libs/token-interface/src/discriminator.rs similarity index 100% rename from program-libs/ctoken-interface/src/discriminator.rs rename to program-libs/token-interface/src/discriminator.rs diff --git a/program-libs/ctoken-interface/src/error.rs b/program-libs/token-interface/src/error.rs similarity index 57% rename from program-libs/ctoken-interface/src/error.rs rename to program-libs/token-interface/src/error.rs index 4d5983b55d..c7cf343b71 100644 --- a/program-libs/ctoken-interface/src/error.rs +++ b/program-libs/token-interface/src/error.rs @@ -2,7 +2,7 @@ use light_zero_copy::errors::ZeroCopyError; use thiserror::Error; #[derive(Debug, PartialEq, Error)] -pub enum CTokenError { +pub enum TokenError { #[error("Invalid instruction data provided")] InvalidInstructionData, @@ -169,16 +169,16 @@ pub enum CTokenError { #[error("Duplicate compression_index found in input TLV data")] DuplicateCompressionIndex, - #[error("Decompress destination CToken is not a fresh account")] + #[error("Decompress destination Token is not a fresh account")] DecompressDestinationNotFresh, - #[error("CToken account missing required Compressible extension")] + #[error("Token account missing required Compressible extension")] MissingCompressibleExtension, #[error("Decompress destination doesn't match source account")] DecompressDestinationMismatch, - #[error("CToken account mint does not match expected mint")] + #[error("Token account mint does not match expected mint")] MintMismatch, #[error("Decompress has delegated_amount but no delegate pubkey provided")] @@ -195,8 +195,8 @@ pub enum CTokenError { #[error("Failed to borrow account data")] BorrowFailed, - #[error("CToken account has invalid owner")] - InvalidCTokenOwner, + #[error("Token account has invalid owner")] + InvalidTokenOwner, #[error("Decompress amount mismatch between compression instruction and input token data")] DecompressAmountMismatch, @@ -208,98 +208,98 @@ pub enum CTokenError { InvalidAtaDerivation, } -impl From for u32 { - fn from(e: CTokenError) -> u32 { +impl From for u32 { + fn from(e: TokenError) -> u32 { match e { - CTokenError::InvalidInstructionData => 18001, - CTokenError::InvalidAccountData => 18002, - CTokenError::ArithmeticOverflow => 18003, - CTokenError::HashComputationError => 18004, - CTokenError::InvalidExtensionData => 18005, - CTokenError::MissingMintAuthority => 18006, - CTokenError::MissingFreezeAuthority => 18007, - CTokenError::InvalidMetadataPointer => 18008, - CTokenError::InvalidTokenMetadata => 18009, - CTokenError::InsufficientSupply => 18010, - CTokenError::AccountFrozen => 18011, - CTokenError::InvalidProof => 18012, - CTokenError::AddressDerivationFailed => 18013, - CTokenError::UnsupportedExtension => 18014, - CTokenError::TooManyExtensions => 18015, - CTokenError::InvalidRootIndex => 18016, - CTokenError::DataSizeExceeded => 18017, - CTokenError::InvalidCompressionMode => 18018, - CTokenError::CompressInsufficientFunds => 18019, - CTokenError::SysvarAccessError => 18020, - CTokenError::CompressedTokenAccountTlvUnimplemented => 18021, - CTokenError::InputAccountsLamportsLengthMismatch => 18022, - CTokenError::OutputAccountsLamportsLengthMismatch => 18023, - CTokenError::InvalidTokenDataVersion => 18028, - CTokenError::InstructionDataExpectedMintAuthority => 18024, - CTokenError::ZeroCopyExpectedMintAuthority => 18025, - CTokenError::InstructionDataExpectedFreezeAuthority => 18026, - CTokenError::ZeroCopyExpectedFreezeAuthority => 18027, - CTokenError::InvalidAuthorityType => 18029, - CTokenError::ExpectedMintSignerAccount => 18030, - CTokenError::InvalidTokenMetadataVersion => 18031, - CTokenError::InvalidExtensionConfig => 18032, - CTokenError::InstructionDataExpectedDelegate => 18033, - CTokenError::ZeroCopyExpectedDelegate => 18034, - CTokenError::UnsupportedTlvExtensionType => 18035, - CTokenError::InvalidAccountState => 18036, - CTokenError::BorshFailed => 18037, - CTokenError::TooManyInputAccounts => 18038, - CTokenError::TooManyAdditionalMetadata => 18039, - CTokenError::DuplicateMetadataKey => 18040, - CTokenError::TooManySeeds(_) => 18041, - CTokenError::WriteTopUpExceedsMaximum => 18042, - CTokenError::MaxTopUpExceeded => 18043, - CTokenError::InvalidCMintOwner => 18044, - CTokenError::CMintNotInitialized => 18045, - CTokenError::CMintBorrowFailed => 18046, - CTokenError::CMintDeserializationFailed => 18047, - CTokenError::CompressedOnlyBlocksTransfer => 18048, - CTokenError::OutTlvOutputCountMismatch => 18049, - CTokenError::InLamportsUnimplemented => 18050, - CTokenError::OutLamportsUnimplemented => 18051, - CTokenError::TlvExtensionLengthMismatch => 18052, - CTokenError::InvalidAccountType => 18053, - CTokenError::DuplicateCompressionIndex => 18054, - CTokenError::DecompressDestinationNotFresh => 18055, - CTokenError::MissingCompressibleExtension => 18056, - CTokenError::DecompressDestinationMismatch => 18057, - CTokenError::MintMismatch => 18058, - CTokenError::DecompressDelegatedAmountWithoutDelegate => 18059, - CTokenError::DecompressWithheldFeeWithoutExtension => 18060, - CTokenError::MissingPayer => 18061, - CTokenError::BorrowFailed => 18062, - CTokenError::InvalidCTokenOwner => 18063, - CTokenError::DecompressAmountMismatch => 18064, - CTokenError::CompressionIndexOutOfBounds => 18065, - CTokenError::InvalidAtaDerivation => 18066, - CTokenError::HasherError(e) => u32::from(e), - CTokenError::ZeroCopyError(e) => u32::from(e), - CTokenError::CompressedAccountError(e) => u32::from(e), + TokenError::InvalidInstructionData => 18001, + TokenError::InvalidAccountData => 18002, + TokenError::ArithmeticOverflow => 18003, + TokenError::HashComputationError => 18004, + TokenError::InvalidExtensionData => 18005, + TokenError::MissingMintAuthority => 18006, + TokenError::MissingFreezeAuthority => 18007, + TokenError::InvalidMetadataPointer => 18008, + TokenError::InvalidTokenMetadata => 18009, + TokenError::InsufficientSupply => 18010, + TokenError::AccountFrozen => 18011, + TokenError::InvalidProof => 18012, + TokenError::AddressDerivationFailed => 18013, + TokenError::UnsupportedExtension => 18014, + TokenError::TooManyExtensions => 18015, + TokenError::InvalidRootIndex => 18016, + TokenError::DataSizeExceeded => 18017, + TokenError::InvalidCompressionMode => 18018, + TokenError::CompressInsufficientFunds => 18019, + TokenError::SysvarAccessError => 18020, + TokenError::CompressedTokenAccountTlvUnimplemented => 18021, + TokenError::InputAccountsLamportsLengthMismatch => 18022, + TokenError::OutputAccountsLamportsLengthMismatch => 18023, + TokenError::InvalidTokenDataVersion => 18028, + TokenError::InstructionDataExpectedMintAuthority => 18024, + TokenError::ZeroCopyExpectedMintAuthority => 18025, + TokenError::InstructionDataExpectedFreezeAuthority => 18026, + TokenError::ZeroCopyExpectedFreezeAuthority => 18027, + TokenError::InvalidAuthorityType => 18029, + TokenError::ExpectedMintSignerAccount => 18030, + TokenError::InvalidTokenMetadataVersion => 18031, + TokenError::InvalidExtensionConfig => 18032, + TokenError::InstructionDataExpectedDelegate => 18033, + TokenError::ZeroCopyExpectedDelegate => 18034, + TokenError::UnsupportedTlvExtensionType => 18035, + TokenError::InvalidAccountState => 18036, + TokenError::BorshFailed => 18037, + TokenError::TooManyInputAccounts => 18038, + TokenError::TooManyAdditionalMetadata => 18039, + TokenError::DuplicateMetadataKey => 18040, + TokenError::TooManySeeds(_) => 18041, + TokenError::WriteTopUpExceedsMaximum => 18042, + TokenError::MaxTopUpExceeded => 18043, + TokenError::InvalidCMintOwner => 18044, + TokenError::CMintNotInitialized => 18045, + TokenError::CMintBorrowFailed => 18046, + TokenError::CMintDeserializationFailed => 18047, + TokenError::CompressedOnlyBlocksTransfer => 18048, + TokenError::OutTlvOutputCountMismatch => 18049, + TokenError::InLamportsUnimplemented => 18050, + TokenError::OutLamportsUnimplemented => 18051, + TokenError::TlvExtensionLengthMismatch => 18052, + TokenError::InvalidAccountType => 18053, + TokenError::DuplicateCompressionIndex => 18054, + TokenError::DecompressDestinationNotFresh => 18055, + TokenError::MissingCompressibleExtension => 18056, + TokenError::DecompressDestinationMismatch => 18057, + TokenError::MintMismatch => 18058, + TokenError::DecompressDelegatedAmountWithoutDelegate => 18059, + TokenError::DecompressWithheldFeeWithoutExtension => 18060, + TokenError::MissingPayer => 18061, + TokenError::BorrowFailed => 18062, + TokenError::InvalidTokenOwner => 18063, + TokenError::DecompressAmountMismatch => 18064, + TokenError::CompressionIndexOutOfBounds => 18065, + TokenError::InvalidAtaDerivation => 18066, + TokenError::HasherError(e) => u32::from(e), + TokenError::ZeroCopyError(e) => u32::from(e), + TokenError::CompressedAccountError(e) => u32::from(e), } } } #[cfg(all(feature = "solana", not(feature = "anchor")))] -impl From for solana_program_error::ProgramError { - fn from(e: CTokenError) -> Self { +impl From for solana_program_error::ProgramError { + fn from(e: TokenError) -> Self { solana_program_error::ProgramError::Custom(e.into()) } } -impl From for pinocchio::program_error::ProgramError { - fn from(e: CTokenError) -> Self { +impl From for pinocchio::program_error::ProgramError { + fn from(e: TokenError) -> Self { pinocchio::program_error::ProgramError::Custom(e.into()) } } #[cfg(feature = "anchor")] -impl From for anchor_lang::prelude::ProgramError { - fn from(e: CTokenError) -> Self { +impl From for anchor_lang::prelude::ProgramError { + fn from(e: TokenError) -> Self { anchor_lang::prelude::ProgramError::Custom(e.into()) } } diff --git a/program-libs/ctoken-interface/src/hash_cache.rs b/program-libs/token-interface/src/hash_cache.rs similarity index 92% rename from program-libs/ctoken-interface/src/hash_cache.rs rename to program-libs/token-interface/src/hash_cache.rs index 8e223ed4d8..211ab0ec7b 100644 --- a/program-libs/ctoken-interface/src/hash_cache.rs +++ b/program-libs/token-interface/src/hash_cache.rs @@ -2,7 +2,7 @@ use light_array_map::ArrayMap; use light_compressed_account::hash_to_bn254_field_size_be; use pinocchio::pubkey::{pubkey_eq, Pubkey}; -use crate::error::CTokenError; +use crate::error::TokenError; /// Context for caching hashed values to avoid recomputation pub struct HashCache { /// Cache for mint hashes: (mint_pubkey, hashed_mint) @@ -21,14 +21,14 @@ impl HashCache { } /// Get or compute hash for a mint pubkey - pub fn get_or_hash_mint(&mut self, mint: &Pubkey) -> Result<[u8; 32], CTokenError> { + pub fn get_or_hash_mint(&mut self, mint: &Pubkey) -> Result<[u8; 32], TokenError> { if let Some(hash) = self.hashed_mints.get_by_key(mint) { return Ok(*hash); } let hashed_mint = hash_to_bn254_field_size_be(mint); self.hashed_mints - .insert(*mint, hashed_mint, CTokenError::InvalidAccountData)?; + .insert(*mint, hashed_mint, TokenError::InvalidAccountData)?; Ok(hashed_mint) } diff --git a/program-libs/ctoken-interface/src/instructions/create_associated_token_account.rs b/program-libs/token-interface/src/instructions/create_associated_token_account.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/create_associated_token_account.rs rename to program-libs/token-interface/src/instructions/create_associated_token_account.rs diff --git a/program-libs/ctoken-interface/src/instructions/create_ctoken_account.rs b/program-libs/token-interface/src/instructions/create_token_account.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/create_ctoken_account.rs rename to program-libs/token-interface/src/instructions/create_token_account.rs diff --git a/program-libs/ctoken-interface/src/instructions/extensions/compressed_only.rs b/program-libs/token-interface/src/instructions/extensions/compressed_only.rs similarity index 85% rename from program-libs/ctoken-interface/src/instructions/extensions/compressed_only.rs rename to program-libs/token-interface/src/instructions/extensions/compressed_only.rs index 3c82841b62..5e670bc72f 100644 --- a/program-libs/ctoken-interface/src/instructions/extensions/compressed_only.rs +++ b/program-libs/token-interface/src/instructions/extensions/compressed_only.rs @@ -7,16 +7,16 @@ use crate::{AnchorDeserialize, AnchorSerialize}; #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, AnchorSerialize, AnchorDeserialize, ZeroCopy)] #[repr(C)] pub struct CompressedOnlyExtensionInstructionData { - /// The delegated amount from the source CToken account's delegate field. + /// The delegated amount from the source Token account's delegate field. /// When decompressing, the decompression amount must match this value. pub delegated_amount: u64, /// Withheld transfer fee amount pub withheld_transfer_fee: u64, - /// Whether the source CToken account was frozen when compressed. + /// Whether the source Token account was frozen when compressed. pub is_frozen: bool, /// Index of the compression operation that consumes this input. pub compression_index: u8, - /// Whether the source CToken account was an ATA. + /// Whether the source Token account was an ATA. /// When is_ata=true, decompress must verify ATA derivation matches. pub is_ata: bool, /// ATA derivation bump (only used when is_ata=true). diff --git a/program-libs/ctoken-interface/src/instructions/extensions/compressible.rs b/program-libs/token-interface/src/instructions/extensions/compressible.rs similarity index 87% rename from program-libs/ctoken-interface/src/instructions/extensions/compressible.rs rename to program-libs/token-interface/src/instructions/extensions/compressible.rs index 496006eb5a..80df8caab7 100644 --- a/program-libs/ctoken-interface/src/instructions/extensions/compressible.rs +++ b/program-libs/token-interface/src/instructions/extensions/compressible.rs @@ -5,14 +5,14 @@ use pinocchio::pubkey::Pubkey; use solana_pubkey::MAX_SEEDS; use tinyvec::ArrayVec; -use crate::{AnchorDeserialize, AnchorSerialize, CTokenError}; +use crate::{AnchorDeserialize, AnchorSerialize, TokenError}; #[derive( Debug, Clone, PartialEq, Eq, AnchorSerialize, AnchorDeserialize, ZeroCopy, ZeroCopyMut, )] #[repr(C)] pub struct CompressibleExtensionInstructionData { - /// Version of the compressed token account when ctoken account is + /// Version of the compressed token account when token account is /// compressed and closed. (The version specifies the hashing scheme.) pub token_account_version: u8, /// Rent payment in epochs. @@ -37,9 +37,9 @@ pub struct CompressToPubkey { } impl CompressToPubkey { - pub fn check_seeds(&self, pubkey: &Pubkey) -> Result<(), CTokenError> { + pub fn check_seeds(&self, pubkey: &Pubkey) -> Result<(), TokenError> { if self.seeds.len() >= MAX_SEEDS { - return Err(CTokenError::TooManySeeds(MAX_SEEDS - 1)); + return Err(TokenError::TooManySeeds(MAX_SEEDS - 1)); } let mut references = ArrayVec::<[&[u8]; MAX_SEEDS]>::new(); for seed in self.seeds.iter() { @@ -47,7 +47,7 @@ impl CompressToPubkey { } let derived_pubkey = derive_address(references.as_slice(), self.bump, &self.program_id)?; if derived_pubkey != *pubkey { - Err(CTokenError::InvalidAccountData) + Err(TokenError::InvalidAccountData) } else { Ok(()) } @@ -57,17 +57,17 @@ impl CompressToPubkey { // Taken from pinocchio 0.9.2. // Modifications: // - seeds: &[&[u8]; N], -> seeds: &[&[u8]], -// - if seeds.len() > MAX_SEEDS CTokenError::InvalidAccountData +// - if seeds.len() > MAX_SEEDS TokenError::InvalidAccountData pub fn derive_address( seeds: &[&[u8]], bump: u8, program_id: &Pubkey, -) -> Result { +) -> Result { const PDA_MARKER: &[u8; 21] = b"ProgramDerivedAddress"; // Must be strictly less than MAX_SEEDS because we need space for: // seeds + bump + program_id + PDA_MARKER in a [MAX_SEEDS + 2] array if seeds.len() >= MAX_SEEDS { - return Err(CTokenError::TooManySeeds(MAX_SEEDS - 1)); + return Err(TokenError::TooManySeeds(MAX_SEEDS - 1)); } const UNINIT: MaybeUninit<&[u8]> = MaybeUninit::<&[u8]>::uninit(); let mut data = [UNINIT; MAX_SEEDS + 2]; diff --git a/program-libs/ctoken-interface/src/instructions/extensions/mod.rs b/program-libs/token-interface/src/instructions/extensions/mod.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/extensions/mod.rs rename to program-libs/token-interface/src/instructions/extensions/mod.rs diff --git a/program-libs/ctoken-interface/src/instructions/extensions/pausable.rs b/program-libs/token-interface/src/instructions/extensions/pausable.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/extensions/pausable.rs rename to program-libs/token-interface/src/instructions/extensions/pausable.rs diff --git a/program-libs/ctoken-interface/src/instructions/extensions/permanent_delegate.rs b/program-libs/token-interface/src/instructions/extensions/permanent_delegate.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/extensions/permanent_delegate.rs rename to program-libs/token-interface/src/instructions/extensions/permanent_delegate.rs diff --git a/program-libs/ctoken-interface/src/instructions/extensions/token_metadata.rs b/program-libs/token-interface/src/instructions/extensions/token_metadata.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/extensions/token_metadata.rs rename to program-libs/token-interface/src/instructions/extensions/token_metadata.rs diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/builder.rs b/program-libs/token-interface/src/instructions/mint_action/builder.rs similarity index 95% rename from program-libs/ctoken-interface/src/instructions/mint_action/builder.rs rename to program-libs/token-interface/src/instructions/mint_action/builder.rs index 8ca9fb9ff7..9f08e67c19 100644 --- a/program-libs/ctoken-interface/src/instructions/mint_action/builder.rs +++ b/program-libs/token-interface/src/instructions/mint_action/builder.rs @@ -6,7 +6,7 @@ use light_compressed_account::instruction_data::{ use crate::instructions::mint_action::{ Action, CompressAndCloseCMintAction, CompressedMintInstructionData, CompressedMintWithContext, CpiContext, CreateMint, DecompressMintAction, MintActionCompressedInstructionData, - MintToCTokenAction, MintToCompressedAction, RemoveMetadataKeyAction, UpdateAuthority, + MintToTokenAction, MintToCompressedAction, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }; @@ -84,9 +84,9 @@ impl MintActionCompressedInstructionData { self } - #[must_use = "with_mint_to_ctoken returns a new value"] - pub fn with_mint_to_ctoken(mut self, action: MintToCTokenAction) -> Self { - self.actions.push(Action::MintToCToken(action)); + #[must_use = "with_mint_to_token returns a new value"] + pub fn with_mint_to_token(mut self, action: MintToTokenAction) -> Self { + self.actions.push(Action::MintToToken(action)); self } diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/compress_and_close_cmint.rs b/program-libs/token-interface/src/instructions/mint_action/compress_and_close_cmint.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/mint_action/compress_and_close_cmint.rs rename to program-libs/token-interface/src/instructions/mint_action/compress_and_close_cmint.rs diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/cpi_context.rs b/program-libs/token-interface/src/instructions/mint_action/cpi_context.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/mint_action/cpi_context.rs rename to program-libs/token-interface/src/instructions/mint_action/cpi_context.rs diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/decompress_mint.rs b/program-libs/token-interface/src/instructions/mint_action/decompress_mint.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/mint_action/decompress_mint.rs rename to program-libs/token-interface/src/instructions/mint_action/decompress_mint.rs diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/instruction_data.rs b/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs similarity index 95% rename from program-libs/ctoken-interface/src/instructions/mint_action/instruction_data.rs rename to program-libs/token-interface/src/instructions/mint_action/instruction_data.rs index 79bc78ff9a..ae16d3fe22 100644 --- a/program-libs/ctoken-interface/src/instructions/mint_action/instruction_data.rs +++ b/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs @@ -3,7 +3,7 @@ use light_compressible::compression_info::CompressionInfo; use light_zero_copy::ZeroCopy; use super::{ - CompressAndCloseCMintAction, CpiContext, DecompressMintAction, MintToCTokenAction, + CompressAndCloseCMintAction, CpiContext, DecompressMintAction, MintToTokenAction, MintToCompressedAction, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }; @@ -13,7 +13,7 @@ use crate::{ AdditionalMetadata, BaseMint, CompressedMint, CompressedMintMetadata, ExtensionStruct, TokenMetadata, }, - AnchorDeserialize, AnchorSerialize, CTokenError, + AnchorDeserialize, AnchorSerialize, TokenError, }; #[repr(C)] @@ -25,9 +25,9 @@ pub enum Action { UpdateMintAuthority(UpdateAuthority), /// Update freeze authority of a compressed mint account. UpdateFreezeAuthority(UpdateAuthority), - /// Mint ctokens from a cmint to a ctoken solana account + /// Mint tokens from a compressed mint to a token solana account /// (tokens are not compressed but not spl tokens). - MintToCToken(MintToCTokenAction), + MintToToken(MintToTokenAction), UpdateMetadataField(UpdateMetadataFieldAction), UpdateMetadataAuthority(UpdateMetadataAuthorityAction), RemoveMetadataKey(RemoveMetadataKeyAction), @@ -101,7 +101,7 @@ pub struct CompressedMintInstructionData { } impl TryFrom for CompressedMintInstructionData { - type Error = CTokenError; + type Error = TokenError; fn try_from(mint: CompressedMint) -> Result { let extensions = match mint.extensions { @@ -121,7 +121,7 @@ impl TryFrom for CompressedMintInstructionData { )); } _ => { - return Err(CTokenError::UnsupportedExtension); + return Err(TokenError::UnsupportedExtension); } } } @@ -142,7 +142,7 @@ impl TryFrom for CompressedMintInstructionData { } impl<'a> TryFrom<&ZCompressedMintInstructionData<'a>> for CompressedMint { - type Error = CTokenError; + type Error = TokenError; fn try_from( instruction_data: &ZCompressedMintInstructionData<'a>, @@ -176,7 +176,7 @@ impl<'a> TryFrom<&ZCompressedMintInstructionData<'a>> for CompressedMint { .unwrap_or_else(Vec::new), })) } - _ => Err(CTokenError::UnsupportedExtension), + _ => Err(TokenError::UnsupportedExtension), }) .collect::, _>>()?; if converted_exts.is_empty() { diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/mint_to_compressed.rs b/program-libs/token-interface/src/instructions/mint_action/mint_to_compressed.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/mint_action/mint_to_compressed.rs rename to program-libs/token-interface/src/instructions/mint_action/mint_to_compressed.rs diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/mint_to_ctoken.rs b/program-libs/token-interface/src/instructions/mint_action/mint_to_token.rs similarity index 89% rename from program-libs/ctoken-interface/src/instructions/mint_action/mint_to_ctoken.rs rename to program-libs/token-interface/src/instructions/mint_action/mint_to_token.rs index 72e0dfca4a..10928f8641 100644 --- a/program-libs/ctoken-interface/src/instructions/mint_action/mint_to_ctoken.rs +++ b/program-libs/token-interface/src/instructions/mint_action/mint_to_token.rs @@ -4,7 +4,7 @@ use crate::{AnchorDeserialize, AnchorSerialize}; #[repr(C)] #[derive(Debug, Clone, Copy, AnchorSerialize, AnchorDeserialize, ZeroCopy)] -pub struct MintToCTokenAction { +pub struct MintToTokenAction { pub account_index: u8, // Index into remaining accounts for the recipient token account pub amount: u64, } diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/mod.rs b/program-libs/token-interface/src/instructions/mint_action/mod.rs similarity index 88% rename from program-libs/ctoken-interface/src/instructions/mint_action/mod.rs rename to program-libs/token-interface/src/instructions/mint_action/mod.rs index 7ba2438bfd..791c74c997 100644 --- a/program-libs/ctoken-interface/src/instructions/mint_action/mod.rs +++ b/program-libs/token-interface/src/instructions/mint_action/mod.rs @@ -4,7 +4,7 @@ mod cpi_context; mod decompress_mint; mod instruction_data; mod mint_to_compressed; -mod mint_to_ctoken; +mod mint_to_token; mod update_metadata; mod update_mint; @@ -13,6 +13,6 @@ pub use cpi_context::*; pub use decompress_mint::*; pub use instruction_data::*; pub use mint_to_compressed::*; -pub use mint_to_ctoken::*; +pub use mint_to_token::*; pub use update_metadata::*; pub use update_mint::*; diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/update_metadata.rs b/program-libs/token-interface/src/instructions/mint_action/update_metadata.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/mint_action/update_metadata.rs rename to program-libs/token-interface/src/instructions/mint_action/update_metadata.rs diff --git a/program-libs/ctoken-interface/src/instructions/mint_action/update_mint.rs b/program-libs/token-interface/src/instructions/mint_action/update_mint.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/mint_action/update_mint.rs rename to program-libs/token-interface/src/instructions/mint_action/update_mint.rs diff --git a/program-libs/ctoken-interface/src/instructions/mod.rs b/program-libs/token-interface/src/instructions/mod.rs similarity index 76% rename from program-libs/ctoken-interface/src/instructions/mod.rs rename to program-libs/token-interface/src/instructions/mod.rs index ef33ca4384..e88325b5e2 100644 --- a/program-libs/ctoken-interface/src/instructions/mod.rs +++ b/program-libs/token-interface/src/instructions/mod.rs @@ -1,6 +1,6 @@ pub mod create_associated_token_account; pub mod transfer2; -pub mod create_ctoken_account; +pub mod create_token_account; pub mod extensions; pub mod mint_action; diff --git a/program-libs/ctoken-interface/src/instructions/transfer2/compression.rs b/program-libs/token-interface/src/instructions/transfer2/compression.rs similarity index 85% rename from program-libs/ctoken-interface/src/instructions/transfer2/compression.rs rename to program-libs/token-interface/src/instructions/transfer2/compression.rs index 03e89551f1..2bc0238187 100644 --- a/program-libs/ctoken-interface/src/instructions/transfer2/compression.rs +++ b/program-libs/token-interface/src/instructions/transfer2/compression.rs @@ -5,15 +5,15 @@ use light_zero_copy::{ }; use zerocopy::Ref; -use crate::{AnchorDeserialize, AnchorSerialize, CTokenError}; +use crate::{AnchorDeserialize, AnchorSerialize, TokenError}; #[derive(Clone, Copy, Debug, PartialEq, Eq, AnchorSerialize, AnchorDeserialize, ZeroCopy)] #[repr(C)] pub enum CompressionMode { Compress, Decompress, - /// Compresses ctoken account and closes it - /// Signer must be rent authority, ctoken account must be compressible + /// Compresses token account and closes it + /// Signer must be rent authority, token account must be compressible /// Not implemented for spl token accounts. CompressAndClose, } @@ -88,29 +88,29 @@ pub struct Compression { } impl ZCompression<'_> { - pub fn get_rent_sponsor_index(&self) -> Result { + pub fn get_rent_sponsor_index(&self) -> Result { match self.mode { ZCompressionMode::CompressAndClose => Ok(self.pool_account_index), - _ => Err(CTokenError::InvalidCompressionMode), + _ => Err(TokenError::InvalidCompressionMode), } } - pub fn get_compressed_token_account_index(&self) -> Result { + pub fn get_compressed_token_account_index(&self) -> Result { match self.mode { ZCompressionMode::CompressAndClose => Ok(self.pool_index), - _ => Err(CTokenError::InvalidCompressionMode), + _ => Err(TokenError::InvalidCompressionMode), } } - pub fn get_destination_index(&self) -> Result { + pub fn get_destination_index(&self) -> Result { match self.mode { ZCompressionMode::CompressAndClose => Ok(self.bump), - _ => Err(CTokenError::InvalidCompressionMode), + _ => Err(TokenError::InvalidCompressionMode), } } } impl Compression { #[allow(clippy::too_many_arguments)] - pub fn compress_and_close_ctoken( + pub fn compress_and_close_token( amount: u64, mint: u8, source: u8, @@ -120,7 +120,7 @@ impl Compression { destination_index: u8, ) -> Self { Compression { - amount, // the full balance of the ctoken account to be compressed + amount, // the full balance of the token account to be compressed mode: CompressionMode::CompressAndClose, mint, source_or_recipient: source, @@ -155,7 +155,7 @@ impl Compression { decimals, } } - pub fn compress_ctoken(amount: u64, mint: u8, source: u8, authority: u8) -> Self { + pub fn compress_token(amount: u64, mint: u8, source: u8, authority: u8) -> Self { Compression { amount, mode: CompressionMode::Compress, @@ -191,7 +191,7 @@ impl Compression { } } - pub fn decompress_ctoken(amount: u64, mint: u8, recipient: u8) -> Self { + pub fn decompress_token(amount: u64, mint: u8, recipient: u8) -> Self { Compression { amount, mode: CompressionMode::Decompress, @@ -207,30 +207,30 @@ impl Compression { } impl ZCompressionMut<'_> { - pub fn mode(&self) -> Result { + pub fn mode(&self) -> Result { match *self.mode { COMPRESS => Ok(CompressionMode::Compress), DECOMPRESS => Ok(CompressionMode::Decompress), COMPRESS_AND_CLOSE => Ok(CompressionMode::CompressAndClose), - _ => Err(CTokenError::InvalidCompressionMode), + _ => Err(TokenError::InvalidCompressionMode), } } } impl ZCompression<'_> { - pub fn new_balance_compressed_account(&self, current_balance: u64) -> Result { + pub fn new_balance_compressed_account(&self, current_balance: u64) -> Result { let new_balance = match self.mode { ZCompressionMode::Compress | ZCompressionMode::CompressAndClose => { // Compress: add to balance (tokens are being added to spl token pool) current_balance .checked_add((*self.amount).into()) - .ok_or(CTokenError::ArithmeticOverflow) + .ok_or(TokenError::ArithmeticOverflow) } ZCompressionMode::Decompress => { // Decompress: subtract from balance (tokens are being removed from spl token pool) current_balance .checked_sub((*self.amount).into()) - .ok_or(CTokenError::CompressInsufficientFunds) + .ok_or(TokenError::CompressInsufficientFunds) } }?; Ok(new_balance) diff --git a/program-libs/ctoken-interface/src/instructions/transfer2/cpi_context.rs b/program-libs/token-interface/src/instructions/transfer2/cpi_context.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/transfer2/cpi_context.rs rename to program-libs/token-interface/src/instructions/transfer2/cpi_context.rs diff --git a/program-libs/ctoken-interface/src/instructions/transfer2/instruction_data.rs b/program-libs/token-interface/src/instructions/transfer2/instruction_data.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/transfer2/instruction_data.rs rename to program-libs/token-interface/src/instructions/transfer2/instruction_data.rs diff --git a/program-libs/ctoken-interface/src/instructions/transfer2/mod.rs b/program-libs/token-interface/src/instructions/transfer2/mod.rs similarity index 100% rename from program-libs/ctoken-interface/src/instructions/transfer2/mod.rs rename to program-libs/token-interface/src/instructions/transfer2/mod.rs diff --git a/program-libs/ctoken-interface/src/lib.rs b/program-libs/token-interface/src/lib.rs similarity index 100% rename from program-libs/ctoken-interface/src/lib.rs rename to program-libs/token-interface/src/lib.rs diff --git a/program-libs/ctoken-interface/src/pool_derivation.rs b/program-libs/token-interface/src/pool_derivation.rs similarity index 95% rename from program-libs/ctoken-interface/src/pool_derivation.rs rename to program-libs/token-interface/src/pool_derivation.rs index 8eb77bde05..6eb73fa7af 100644 --- a/program-libs/ctoken-interface/src/pool_derivation.rs +++ b/program-libs/token-interface/src/pool_derivation.rs @@ -12,7 +12,7 @@ use spl_token_2022::{ }; use crate::{ - constants::{CTOKEN_PROGRAM_ID, POOL_SEED, RESTRICTED_POOL_SEED}, + constants::{LIGHT_TOKEN_PROGRAM_ID, POOL_SEED, RESTRICTED_POOL_SEED}, is_restricted_extension, }; @@ -20,7 +20,7 @@ use crate::{ pub const NUM_MAX_POOL_ACCOUNTS: u8 = 5; // ============================================================================ -// SPL interface PDA derivation (uses CTOKEN_PROGRAM_ID) +// SPL interface PDA derivation (uses LIGHT_TOKEN_PROGRAM_ID) // ============================================================================ /// Find the SPL interface PDA for a given mint (index 0). @@ -53,7 +53,7 @@ pub fn find_spl_interface_pda_with_index( index: u8, restricted: bool, ) -> (Pubkey, u8) { - let program_id = Pubkey::from(CTOKEN_PROGRAM_ID); + let program_id = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let index_bytes = [index]; let seeds: &[&[u8]] = if restricted { @@ -99,7 +99,7 @@ pub fn is_valid_spl_interface_pda( bump: Option, restricted: bool, ) -> bool { - let program_id = Pubkey::from(CTOKEN_PROGRAM_ID); + let program_id = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let index_bytes = [pool_index]; let pda = if let Some(bump) = bump { diff --git a/program-libs/ctoken-interface/src/state/compressed_token/hash.rs b/program-libs/token-interface/src/state/compressed_token/hash.rs similarity index 100% rename from program-libs/ctoken-interface/src/state/compressed_token/hash.rs rename to program-libs/token-interface/src/state/compressed_token/hash.rs diff --git a/program-libs/ctoken-interface/src/state/compressed_token/mod.rs b/program-libs/token-interface/src/state/compressed_token/mod.rs similarity index 100% rename from program-libs/ctoken-interface/src/state/compressed_token/mod.rs rename to program-libs/token-interface/src/state/compressed_token/mod.rs diff --git a/program-libs/ctoken-interface/src/state/compressed_token/token_data.rs b/program-libs/token-interface/src/state/compressed_token/token_data.rs similarity index 84% rename from program-libs/ctoken-interface/src/state/compressed_token/token_data.rs rename to program-libs/token-interface/src/state/compressed_token/token_data.rs index 2630be22da..962721e326 100644 --- a/program-libs/ctoken-interface/src/state/compressed_token/token_data.rs +++ b/program-libs/token-interface/src/state/compressed_token/token_data.rs @@ -5,7 +5,7 @@ use light_zero_copy::{num_trait::ZeroCopyNumTrait, ZeroCopy, ZeroCopyMut}; use crate::{ instructions::extensions::ZExtensionInstructionData, state::extensions::{ExtensionStruct, ZExtensionStructMut}, - AnchorDeserialize, AnchorSerialize, CTokenError, + AnchorDeserialize, AnchorSerialize, TokenError, }; #[derive(Clone, Copy, Debug, PartialEq, Eq, AnchorSerialize, AnchorDeserialize)] @@ -17,13 +17,13 @@ pub enum CompressedTokenAccountState { } impl TryFrom for CompressedTokenAccountState { - type Error = CTokenError; + type Error = TokenError; fn try_from(value: u8) -> Result { match value { 0 => Ok(CompressedTokenAccountState::Initialized), 1 => Ok(CompressedTokenAccountState::Frozen), - _ => Err(CTokenError::InvalidAccountState), + _ => Err(TokenError::InvalidAccountState), } } } @@ -50,7 +50,7 @@ pub struct TokenData { } impl TokenData { - pub fn state(&self) -> Result { + pub fn state(&self) -> Result { CompressedTokenAccountState::try_from(self.state) } } @@ -69,15 +69,15 @@ impl<'a> ZTokenDataMut<'a> { delegate: Option, state: CompressedTokenAccountState, tlv_data: Option<&[ZExtensionInstructionData<'_>]>, - ) -> Result<(), CTokenError> { + ) -> Result<(), TokenError> { self.mint = mint; self.owner = owner; self.amount.set(amount.into()); if let Some(z_delegate) = self.delegate.as_deref_mut() { - *z_delegate = delegate.ok_or(CTokenError::InstructionDataExpectedDelegate)?; + *z_delegate = delegate.ok_or(TokenError::InstructionDataExpectedDelegate)?; } if self.delegate.is_none() && delegate.is_some() { - return Err(CTokenError::ZeroCopyExpectedDelegate); + return Err(TokenError::ZeroCopyExpectedDelegate); } *self.state = state as u8; @@ -86,7 +86,7 @@ impl<'a> ZTokenDataMut<'a> { match (self.tlv.as_mut(), tlv_data) { (Some(tlv_vec), Some(exts)) => { if tlv_vec.len() != 1 || exts.len() != 1 { - return Err(CTokenError::TlvExtensionLengthMismatch); + return Err(TokenError::TlvExtensionLengthMismatch); } for (tlv_ext, instruction_ext) in tlv_vec.iter_mut().zip(exts.iter()) { match (tlv_ext, instruction_ext) { @@ -98,12 +98,12 @@ impl<'a> ZTokenDataMut<'a> { compressed_only.withheld_transfer_fee = data.withheld_transfer_fee; compressed_only.is_ata = if data.is_ata() { 1 } else { 0 }; } - _ => return Err(CTokenError::UnsupportedTlvExtensionType), + _ => return Err(TokenError::UnsupportedTlvExtensionType), } } } (Some(_), None) | (None, Some(_)) => { - return Err(CTokenError::TlvExtensionLengthMismatch); + return Err(TokenError::TlvExtensionLengthMismatch); } (None, None) => {} } diff --git a/program-libs/ctoken-interface/src/state/compressed_token/token_data_version.rs b/program-libs/token-interface/src/state/compressed_token/token_data_version.rs similarity index 85% rename from program-libs/ctoken-interface/src/state/compressed_token/token_data_version.rs rename to program-libs/token-interface/src/state/compressed_token/token_data_version.rs index 8ee76584e3..352e7614ad 100644 --- a/program-libs/ctoken-interface/src/state/compressed_token/token_data_version.rs +++ b/program-libs/token-interface/src/state/compressed_token/token_data_version.rs @@ -1,4 +1,4 @@ -use crate::CTokenError; +use crate::TokenError; /// TokenDataVersion is recorded in the token account discriminator. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] @@ -18,18 +18,18 @@ impl TokenDataVersion { } } - pub fn from_discriminator(discriminator: [u8; 8]) -> Result { + pub fn from_discriminator(discriminator: [u8; 8]) -> Result { match discriminator { [2, 0, 0, 0, 0, 0, 0, 0] => Ok(TokenDataVersion::V1), // 2 le [0, 0, 0, 0, 0, 0, 0, 3] => Ok(TokenDataVersion::V2), // 3 be [0, 0, 0, 0, 0, 0, 0, 4] => Ok(TokenDataVersion::ShaFlat), // 4 be - _ => Err(CTokenError::InvalidTokenDataVersion), + _ => Err(TokenError::InvalidTokenDataVersion), } } /// Serializes amount to bytes using version-specific endianness /// V1: little-endian, V2: big-endian - pub fn serialize_amount_bytes(&self, amount: u64) -> Result<[u8; 32], CTokenError> { + pub fn serialize_amount_bytes(&self, amount: u64) -> Result<[u8; 32], TokenError> { let mut amount_bytes = [0u8; 32]; match self { TokenDataVersion::V1 => { @@ -39,7 +39,7 @@ impl TokenDataVersion { amount_bytes[24..].copy_from_slice(&amount.to_be_bytes()); } _ => { - return Err(CTokenError::InvalidTokenDataVersion); + return Err(TokenError::InvalidTokenDataVersion); } } Ok(amount_bytes) @@ -47,14 +47,14 @@ impl TokenDataVersion { } impl TryFrom for TokenDataVersion { - type Error = crate::CTokenError; + type Error = crate::TokenError; fn try_from(value: u8) -> Result { match value { 1 => Ok(TokenDataVersion::V1), 2 => Ok(TokenDataVersion::V2), 3 => Ok(TokenDataVersion::ShaFlat), - _ => Err(crate::CTokenError::InvalidTokenDataVersion), + _ => Err(crate::TokenError::InvalidTokenDataVersion), } } } diff --git a/program-libs/ctoken-interface/src/state/extensions/compressed_only.rs b/program-libs/token-interface/src/state/extensions/compressed_only.rs similarity index 76% rename from program-libs/ctoken-interface/src/state/extensions/compressed_only.rs rename to program-libs/token-interface/src/state/extensions/compressed_only.rs index b269f92b38..edd9dcafa0 100644 --- a/program-libs/ctoken-interface/src/state/extensions/compressed_only.rs +++ b/program-libs/token-interface/src/state/extensions/compressed_only.rs @@ -4,7 +4,7 @@ use crate::{AnchorDeserialize, AnchorSerialize}; /// CompressedOnly extension for compressed token accounts. /// This extension marks a compressed account as decompress-only (cannot be transferred). -/// It stores the delegated amount from the source CToken account when it was compressed-and-closed. +/// It stores the delegated amount from the source Token account when it was compressed-and-closed. #[derive( Debug, Clone, @@ -19,10 +19,10 @@ use crate::{AnchorDeserialize, AnchorSerialize}; )] #[repr(C)] pub struct CompressedOnlyExtension { - /// The delegated amount from the source CToken account's delegate field. + /// The delegated amount from the source Token account's delegate field. /// When decompressing, the decompression amount must match this value. pub delegated_amount: u64, - /// Withheld transfer fee amount from the source CToken account. + /// Withheld transfer fee amount from the source Token account. pub withheld_transfer_fee: u64, /// Whether the source was an ATA (1) or regular token account (0). /// When is_ata=1, decompress must verify ATA derivation matches. diff --git a/program-libs/ctoken-interface/src/state/extensions/compressible.rs b/program-libs/token-interface/src/state/extensions/compressible.rs similarity index 98% rename from program-libs/ctoken-interface/src/state/extensions/compressible.rs rename to program-libs/token-interface/src/state/extensions/compressible.rs index 52ef5979fd..d8cd0f10e1 100644 --- a/program-libs/ctoken-interface/src/state/extensions/compressible.rs +++ b/program-libs/token-interface/src/state/extensions/compressible.rs @@ -4,7 +4,7 @@ use light_zero_copy::{ZeroCopy, ZeroCopyMut}; use crate::{AnchorDeserialize, AnchorSerialize}; -/// Compressible extension for ctoken accounts. +/// Compressible extension for token accounts. /// This extension contains compression configuration and timing data. #[derive( Debug, diff --git a/program-libs/ctoken-interface/src/state/extensions/extension_struct.rs b/program-libs/token-interface/src/state/extensions/extension_struct.rs similarity index 99% rename from program-libs/ctoken-interface/src/state/extensions/extension_struct.rs rename to program-libs/token-interface/src/state/extensions/extension_struct.rs index cf190e71db..6ecc5e2fb8 100644 --- a/program-libs/ctoken-interface/src/state/extensions/extension_struct.rs +++ b/program-libs/token-interface/src/state/extensions/extension_struct.rs @@ -56,7 +56,7 @@ pub enum ExtensionStruct { TransferHookAccount(TransferHookAccountExtension), /// CompressedOnly extension for compressed token accounts (stores delegated amount) CompressedOnly(CompressedOnlyExtension), - /// Compressible extension for ctoken accounts (compression config and timing data) + /// Compressible extension for token accounts (compression config and timing data) Compressible(CompressibleExtension), } @@ -102,7 +102,7 @@ pub enum ZExtensionStructMut<'a> { CompressedOnly( >::ZeroCopyAtMut, ), - /// Compressible extension for ctoken accounts + /// Compressible extension for token accounts Compressible( >::ZeroCopyAtMut, ), diff --git a/program-libs/ctoken-interface/src/state/extensions/extension_type.rs b/program-libs/token-interface/src/state/extensions/extension_type.rs similarity index 95% rename from program-libs/ctoken-interface/src/state/extensions/extension_type.rs rename to program-libs/token-interface/src/state/extensions/extension_type.rs index 04e173233b..a1e3a01ede 100644 --- a/program-libs/ctoken-interface/src/state/extensions/extension_type.rs +++ b/program-libs/token-interface/src/state/extensions/extension_type.rs @@ -52,7 +52,7 @@ pub enum ExtensionType { } impl TryFrom for ExtensionType { - type Error = crate::CTokenError; + type Error = crate::TokenError; fn try_from(value: u8) -> Result { match value { @@ -63,7 +63,7 @@ impl TryFrom for ExtensionType { 30 => Ok(ExtensionType::TransferHookAccount), 31 => Ok(ExtensionType::CompressedOnly), 32 => Ok(ExtensionType::Compressible), - _ => Err(crate::CTokenError::UnsupportedExtension), + _ => Err(crate::TokenError::UnsupportedExtension), } } } diff --git a/program-libs/ctoken-interface/src/state/extensions/mod.rs b/program-libs/token-interface/src/state/extensions/mod.rs similarity index 100% rename from program-libs/ctoken-interface/src/state/extensions/mod.rs rename to program-libs/token-interface/src/state/extensions/mod.rs diff --git a/program-libs/ctoken-interface/src/state/extensions/pausable.rs b/program-libs/token-interface/src/state/extensions/pausable.rs similarity index 100% rename from program-libs/ctoken-interface/src/state/extensions/pausable.rs rename to program-libs/token-interface/src/state/extensions/pausable.rs diff --git a/program-libs/ctoken-interface/src/state/extensions/permanent_delegate.rs b/program-libs/token-interface/src/state/extensions/permanent_delegate.rs similarity index 100% rename from program-libs/ctoken-interface/src/state/extensions/permanent_delegate.rs rename to program-libs/token-interface/src/state/extensions/permanent_delegate.rs diff --git a/program-libs/ctoken-interface/src/state/extensions/token_metadata.rs b/program-libs/token-interface/src/state/extensions/token_metadata.rs similarity index 100% rename from program-libs/ctoken-interface/src/state/extensions/token_metadata.rs rename to program-libs/token-interface/src/state/extensions/token_metadata.rs diff --git a/program-libs/ctoken-interface/src/state/extensions/transfer_fee.rs b/program-libs/token-interface/src/state/extensions/transfer_fee.rs similarity index 83% rename from program-libs/ctoken-interface/src/state/extensions/transfer_fee.rs rename to program-libs/token-interface/src/state/extensions/transfer_fee.rs index a9a5efe1f5..c8d8ca8155 100644 --- a/program-libs/ctoken-interface/src/state/extensions/transfer_fee.rs +++ b/program-libs/token-interface/src/state/extensions/transfer_fee.rs @@ -1,8 +1,8 @@ use light_zero_copy::{ZeroCopy, ZeroCopyMut}; -use crate::{AnchorDeserialize, AnchorSerialize, CTokenError}; +use crate::{AnchorDeserialize, AnchorSerialize, TokenError}; -/// Transfer fee extension for CToken accounts. +/// Transfer fee extension for Token accounts. /// Stores withheld fees that accumulate during transfers. /// Mirrors SPL Token-2022's TransferFeeAmount extension. #[derive( @@ -27,11 +27,11 @@ pub struct TransferFeeAccountExtension { impl<'a> ZTransferFeeAccountExtensionMut<'a> { /// Add fee to withheld amount (used during transfers). /// Returns error if addition would overflow. - pub fn add_withheld_amount(&mut self, fee: u64) -> Result<(), CTokenError> { + pub fn add_withheld_amount(&mut self, fee: u64) -> Result<(), TokenError> { let current: u64 = self.withheld_amount.get(); let new_amount = current .checked_add(fee) - .ok_or(CTokenError::ArithmeticOverflow)?; + .ok_or(TokenError::ArithmeticOverflow)?; self.withheld_amount.set(new_amount); Ok(()) } diff --git a/program-libs/ctoken-interface/src/state/extensions/transfer_hook.rs b/program-libs/token-interface/src/state/extensions/transfer_hook.rs similarity index 100% rename from program-libs/ctoken-interface/src/state/extensions/transfer_hook.rs rename to program-libs/token-interface/src/state/extensions/transfer_hook.rs diff --git a/program-libs/ctoken-interface/src/state/mint/borsh.rs b/program-libs/token-interface/src/state/mint/borsh.rs similarity index 100% rename from program-libs/ctoken-interface/src/state/mint/borsh.rs rename to program-libs/token-interface/src/state/mint/borsh.rs diff --git a/program-libs/ctoken-interface/src/state/mint/compressed_mint.rs b/program-libs/token-interface/src/state/mint/compressed_mint.rs similarity index 87% rename from program-libs/ctoken-interface/src/state/mint/compressed_mint.rs rename to program-libs/token-interface/src/state/mint/compressed_mint.rs index ca6fec13f3..2c42def3d7 100644 --- a/program-libs/ctoken-interface/src/state/mint/compressed_mint.rs +++ b/program-libs/token-interface/src/state/mint/compressed_mint.rs @@ -8,7 +8,7 @@ use pinocchio::account_info::AccountInfo; use solana_msg::msg; use crate::{ - state::ExtensionStruct, AnchorDeserialize, AnchorSerialize, CTokenError, CTOKEN_PROGRAM_ID, + state::ExtensionStruct, AnchorDeserialize, AnchorSerialize, TokenError, LIGHT_TOKEN_PROGRAM_ID, }; /// AccountType::Mint discriminator value @@ -79,14 +79,14 @@ pub struct CompressedMintMetadata { } impl CompressedMint { - pub fn hash(&self) -> Result<[u8; 32], CTokenError> { + pub fn hash(&self) -> Result<[u8; 32], TokenError> { match self.metadata.version { 3 => Ok(Sha256BE::hash( self.try_to_vec() - .map_err(|_| CTokenError::BorshFailed)? + .map_err(|_| TokenError::BorshFailed)? .as_slice(), )?), - _ => Err(CTokenError::InvalidTokenDataVersion), + _ => Err(TokenError::InvalidTokenDataVersion), } } @@ -98,33 +98,33 @@ impl CompressedMint { /// /// Note: CMint accounts follow SPL token mint pattern (no discriminator). /// Validation is done via owner check + PDA derivation (caller responsibility). - pub fn from_account_info_checked(account_info: &AccountInfo) -> Result { + pub fn from_account_info_checked(account_info: &AccountInfo) -> Result { // 1. Check program ownership - if !account_info.is_owned_by(&CTOKEN_PROGRAM_ID) { + if !account_info.is_owned_by(&LIGHT_TOKEN_PROGRAM_ID) { #[cfg(feature = "solana")] msg!("CMint account has invalid owner"); - return Err(CTokenError::InvalidCMintOwner); + return Err(TokenError::InvalidCMintOwner); } // 2. Borrow and deserialize account data let data = account_info .try_borrow_data() - .map_err(|_| CTokenError::CMintBorrowFailed)?; + .map_err(|_| TokenError::CMintBorrowFailed)?; let mint = - Self::try_from_slice(&data).map_err(|_| CTokenError::CMintDeserializationFailed)?; + Self::try_from_slice(&data).map_err(|_| TokenError::CMintDeserializationFailed)?; // 3. Check is_initialized if !mint.base.is_initialized { #[cfg(feature = "solana")] msg!("CMint account is not initialized"); - return Err(CTokenError::CMintNotInitialized); + return Err(TokenError::CMintNotInitialized); } if !mint.is_cmint_account() { #[cfg(feature = "solana")] msg!("CMint account is not a CMint account"); - return Err(CTokenError::MintMismatch); + return Err(TokenError::MintMismatch); } Ok(mint) diff --git a/program-libs/ctoken-interface/src/state/mint/mod.rs b/program-libs/token-interface/src/state/mint/mod.rs similarity index 100% rename from program-libs/ctoken-interface/src/state/mint/mod.rs rename to program-libs/token-interface/src/state/mint/mod.rs diff --git a/program-libs/ctoken-interface/src/state/mint/top_up.rs b/program-libs/token-interface/src/state/mint/top_up.rs similarity index 92% rename from program-libs/ctoken-interface/src/state/mint/top_up.rs rename to program-libs/token-interface/src/state/mint/top_up.rs index f5d92057e1..8ac86db8aa 100644 --- a/program-libs/ctoken-interface/src/state/mint/top_up.rs +++ b/program-libs/token-interface/src/state/mint/top_up.rs @@ -47,7 +47,7 @@ pub fn cmint_top_up_lamports_from_slice( } /// Calculate top-up lamports from a CMint AccountInfo. -/// Verifies account owner is the CToken program. Returns None if owner mismatch or invalid. +/// Verifies account owner is the Token program. Returns None if owner mismatch or invalid. /// Pass `current_slot` as 0 to fetch from Clock sysvar; non-zero values are used directly. #[cfg(target_os = "solana")] #[inline(always)] @@ -58,8 +58,8 @@ pub fn cmint_top_up_lamports_from_account_info( ) -> Option { use pinocchio::sysvars::{clock::Clock, Sysvar}; - // Check owner is CToken program - if !account_info.is_owned_by(&crate::CTOKEN_PROGRAM_ID) { + // Check owner is Token program + if !account_info.is_owned_by(&crate::LIGHT_TOKEN_PROGRAM_ID) { return None; } diff --git a/program-libs/ctoken-interface/src/state/mint/zero_copy.rs b/program-libs/token-interface/src/state/mint/zero_copy.rs similarity index 94% rename from program-libs/ctoken-interface/src/state/mint/zero_copy.rs rename to program-libs/token-interface/src/state/mint/zero_copy.rs index 055e44fa04..7f8068bd63 100644 --- a/program-libs/ctoken-interface/src/state/mint/zero_copy.rs +++ b/program-libs/token-interface/src/state/mint/zero_copy.rs @@ -17,7 +17,7 @@ use crate::{ CompressedMint, ExtensionStruct, ExtensionStructConfig, TokenDataVersion, ZExtensionStruct, ZExtensionStructMut, }, - AnchorDeserialize, AnchorSerialize, CTokenError, + AnchorDeserialize, AnchorSerialize, TokenError, }; /// Base size for CMint accounts (without extensions) @@ -324,24 +324,24 @@ impl CompressedMint { /// - Account is not initialized (is_initialized == false) /// - Account type is not ACCOUNT_TYPE_MINT (byte 165 != 1) #[profile] - pub fn zero_copy_at_checked(bytes: &[u8]) -> Result<(ZCompressedMint<'_>, &[u8]), CTokenError> { - // Check minimum size (use CMint-specific size, not CToken size) + pub fn zero_copy_at_checked(bytes: &[u8]) -> Result<(ZCompressedMint<'_>, &[u8]), TokenError> { + // Check minimum size (use CMint-specific size, not Token size) if bytes.len() < BASE_MINT_ACCOUNT_SIZE as usize { - return Err(CTokenError::InvalidAccountData); + return Err(TokenError::InvalidAccountData); } // Proceed with deserialization first let (mint, remaining) = CompressedMint::zero_copy_at(bytes) - .map_err(|_| CTokenError::CMintDeserializationFailed)?; + .map_err(|_| TokenError::CMintDeserializationFailed)?; // Verify account_type using the method if !mint.is_cmint_account() { - return Err(CTokenError::InvalidAccountType); + return Err(TokenError::InvalidAccountType); } // Check is_initialized if !mint.is_initialized() { - return Err(CTokenError::CMintNotInitialized); + return Err(TokenError::CMintNotInitialized); } Ok((mint, remaining)) @@ -354,24 +354,24 @@ impl CompressedMint { #[profile] pub fn zero_copy_at_mut_checked( bytes: &mut [u8], - ) -> Result<(ZCompressedMintMut<'_>, &mut [u8]), CTokenError> { - // Check minimum size (use CMint-specific size, not CToken size) + ) -> Result<(ZCompressedMintMut<'_>, &mut [u8]), TokenError> { + // Check minimum size (use CMint-specific size, not Token size) if bytes.len() < BASE_MINT_ACCOUNT_SIZE as usize { msg!( "zero_copy_at_mut_checked bytes.len() < BASE_MINT_ACCOUNT_SIZE {}", bytes.len() ); - return Err(CTokenError::InvalidAccountData); + return Err(TokenError::InvalidAccountData); } let (mint, remaining) = CompressedMint::zero_copy_at_mut(bytes) - .map_err(|_| CTokenError::CMintDeserializationFailed)?; + .map_err(|_| TokenError::CMintDeserializationFailed)?; if !mint.is_initialized() { - return Err(CTokenError::CMintNotInitialized); + return Err(TokenError::CMintNotInitialized); } if !mint.is_cmint_account() { - return Err(CTokenError::InvalidAccountType); + return Err(TokenError::InvalidAccountType); } Ok((mint, remaining)) @@ -414,14 +414,14 @@ impl ZCompressedMintMut<'_> { &mut self, ix_data: &>::ZeroCopyAt, cmint_decompressed: bool, - ) -> Result<(), CTokenError> { + ) -> Result<(), TokenError> { if ix_data.metadata.version != TokenDataVersion::ShaFlat as u8 { #[cfg(feature = "solana")] msg!( "Only shaflat version 3 is supported got {}", ix_data.metadata.version ); - return Err(CTokenError::InvalidTokenMetadataVersion); + return Err(TokenError::InvalidTokenMetadataVersion); } // Set metadata fields from instruction data self.base.metadata.version = ix_data.metadata.version; diff --git a/program-libs/ctoken-interface/src/state/mod.rs b/program-libs/token-interface/src/state/mod.rs similarity index 78% rename from program-libs/ctoken-interface/src/state/mod.rs rename to program-libs/token-interface/src/state/mod.rs index 5b3adc1c72..fe5b05cca4 100644 --- a/program-libs/ctoken-interface/src/state/mod.rs +++ b/program-libs/token-interface/src/state/mod.rs @@ -1,9 +1,9 @@ mod compressed_token; -pub mod ctoken; +pub mod token; pub mod extensions; pub mod mint; pub use compressed_token::*; -pub use ctoken::*; +pub use token::*; pub use extensions::*; pub use mint::*; diff --git a/program-libs/ctoken-interface/src/state/ctoken/borsh.rs b/program-libs/token-interface/src/state/token/borsh.rs similarity index 94% rename from program-libs/ctoken-interface/src/state/ctoken/borsh.rs rename to program-libs/token-interface/src/state/token/borsh.rs index 8b040b5459..b62375e5d4 100644 --- a/program-libs/ctoken-interface/src/state/ctoken/borsh.rs +++ b/program-libs/token-interface/src/state/token/borsh.rs @@ -1,10 +1,10 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_compressed_account::Pubkey; -use crate::state::{AccountState, CToken, ExtensionStruct, ACCOUNT_TYPE_TOKEN_ACCOUNT}; +use crate::state::{AccountState, Token, ExtensionStruct, ACCOUNT_TYPE_TOKEN_ACCOUNT}; // Manual implementation of BorshSerialize for SPL compatibility -impl BorshSerialize for CToken { +impl BorshSerialize for Token { fn serialize(&self, writer: &mut W) -> std::io::Result<()> { // Write mint (32 bytes) writer.write_all(&self.mint.to_bytes())?; @@ -61,7 +61,7 @@ impl BorshSerialize for CToken { } // Manual implementation of BorshDeserialize for SPL compatibility -impl BorshDeserialize for CToken { +impl BorshDeserialize for Token { fn deserialize_reader(buf: &mut R) -> std::io::Result { // Read mint (32 bytes) let mut mint_bytes = [0u8; 32]; @@ -133,12 +133,12 @@ impl BorshDeserialize for CToken { Option::>::deserialize_reader(buf).unwrap_or_default(); (account_type, extensions) } else { - // Account type byte present but not CToken - store it but no extensions + // Account type byte present but not Token - store it but no extensions (account_type, None) } } else { // No account_type byte - base SPL token account without extensions - // Default to ACCOUNT_TYPE_TOKEN_ACCOUNT for CToken + // Default to ACCOUNT_TYPE_TOKEN_ACCOUNT for Token (ACCOUNT_TYPE_TOKEN_ACCOUNT, None) }; diff --git a/program-libs/ctoken-interface/src/state/ctoken/mod.rs b/program-libs/token-interface/src/state/token/mod.rs similarity index 70% rename from program-libs/ctoken-interface/src/state/ctoken/mod.rs rename to program-libs/token-interface/src/state/token/mod.rs index af14abbcf0..8b6582b758 100644 --- a/program-libs/ctoken-interface/src/state/ctoken/mod.rs +++ b/program-libs/token-interface/src/state/token/mod.rs @@ -1,10 +1,10 @@ mod borsh; -mod ctoken_struct; +mod token_struct; mod size; mod top_up; mod zero_copy; -pub use ctoken_struct::*; +pub use token_struct::*; pub use size::*; pub use top_up::*; pub use zero_copy::*; diff --git a/program-libs/ctoken-interface/src/state/ctoken/size.rs b/program-libs/token-interface/src/state/token/size.rs similarity index 89% rename from program-libs/ctoken-interface/src/state/ctoken/size.rs rename to program-libs/token-interface/src/state/token/size.rs index e4c1dcba99..b37d4c6238 100644 --- a/program-libs/ctoken-interface/src/state/ctoken/size.rs +++ b/program-libs/token-interface/src/state/token/size.rs @@ -5,7 +5,7 @@ use crate::{ BASE_TOKEN_ACCOUNT_SIZE, }; -/// Calculates the size of a ctoken account based on which extensions are present. +/// Calculates the size of a token account based on which extensions are present. /// /// Note: Compressible extension is required if the T22 mint has restricted extensions /// (Pausable, PermanentDelegate, TransferFee, TransferHook). @@ -16,7 +16,7 @@ use crate::{ /// # Returns /// * `Ok(usize)` - The total account size in bytes /// * `Err(ZeroCopyError)` - If extension size calculation fails -pub fn calculate_ctoken_account_size( +pub fn calculate_token_account_size( extensions: Option<&[ExtensionStructConfig]>, ) -> Result { let mut size = BASE_TOKEN_ACCOUNT_SIZE as usize; diff --git a/program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs b/program-libs/token-interface/src/state/token/token_struct.rs similarity index 90% rename from program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs rename to program-libs/token-interface/src/state/token/token_struct.rs index 20e1e5e0ea..6eb0aa312b 100644 --- a/program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs +++ b/program-libs/token-interface/src/state/token/token_struct.rs @@ -1,7 +1,7 @@ use light_compressed_account::Pubkey; use light_zero_copy::errors::ZeroCopyError; -use crate::{state::ExtensionStruct, AnchorDeserialize, AnchorSerialize, CTokenError}; +use crate::{state::ExtensionStruct, AnchorDeserialize, AnchorSerialize, TokenError}; /// AccountType discriminator value for token accounts (at byte 165) pub const ACCOUNT_TYPE_TOKEN_ACCOUNT: u8 = 2; @@ -15,14 +15,14 @@ pub enum AccountState { } impl TryFrom for AccountState { - type Error = CTokenError; + type Error = TokenError; fn try_from(value: u8) -> Result { match value { 0 => Ok(AccountState::Uninitialized), 1 => Ok(AccountState::Initialized), 2 => Ok(AccountState::Frozen), - _ => Err(CTokenError::InvalidAccountState), + _ => Err(TokenError::InvalidAccountState), } } } @@ -31,7 +31,7 @@ impl TryFrom for AccountState { /// Ctokens are solana accounts, compressed tokens are stored /// as TokenData that is optimized for compressed accounts. #[derive(Debug, PartialEq, Eq, Hash, Clone)] -pub struct CToken { +pub struct Token { /// The mint associated with this account pub mint: Pubkey, /// The owner of this account. @@ -53,15 +53,15 @@ pub struct CToken { /// Optional authority to close the account. pub close_authority: Option, /// Account type discriminator (at byte 165 when extensions present). - /// For valid CToken accounts this is ACCOUNT_TYPE_TOKEN_ACCOUNT (2). + /// For valid Token accounts this is ACCOUNT_TYPE_TOKEN_ACCOUNT (2). pub account_type: u8, /// Extensions for the token account (including compressible config) pub extensions: Option>, } -impl CToken { +impl Token { /// Extract amount directly from account data slice using hardcoded offset - /// CToken layout: mint (32 bytes) + owner (32 bytes) + amount (8 bytes) + /// Token layout: mint (32 bytes) + owner (32 bytes) + amount (8 bytes) pub fn amount_from_slice(data: &[u8]) -> Result { const AMOUNT_OFFSET: usize = 64; // 32 (mint) + 32 (owner) @@ -115,9 +115,9 @@ impl CToken { self.account_type } - /// Checks if account_type matches CToken discriminator value + /// Checks if account_type matches Token discriminator value #[inline(always)] - pub fn is_ctoken_account(&self) -> bool { + pub fn is_token_account(&self) -> bool { self.account_type == ACCOUNT_TYPE_TOKEN_ACCOUNT } } diff --git a/program-libs/ctoken-interface/src/state/ctoken/top_up.rs b/program-libs/token-interface/src/state/token/top_up.rs similarity index 93% rename from program-libs/ctoken-interface/src/state/ctoken/top_up.rs rename to program-libs/token-interface/src/state/token/top_up.rs index 629b148353..39dda66a1e 100644 --- a/program-libs/ctoken-interface/src/state/ctoken/top_up.rs +++ b/program-libs/token-interface/src/state/token/top_up.rs @@ -1,4 +1,4 @@ -//! Optimized top-up lamports calculation for CToken accounts. +//! Optimized top-up lamports calculation for Token accounts. use light_compressible::compression_info::CompressionInfo; use light_program_profiler::profile; @@ -8,7 +8,7 @@ use pinocchio::account_info::AccountInfo; use super::ACCOUNT_TYPE_TOKEN_ACCOUNT; use crate::state::ExtensionType; -/// Minimum size for CToken with Compressible extension as first extension. +/// Minimum size for Token with Compressible extension as first extension. /// 176 (offset to CompressionInfo) + 96 (CompressionInfo size) = 272 pub const MIN_SIZE_WITH_COMPRESSIBLE: usize = COMPRESSION_INFO_OFFSET + COMPRESSION_INFO_SIZE; @@ -34,7 +34,7 @@ const FIRST_EXT_DISCRIMINATOR_OFFSET: usize = 171; /// Option discriminator value for Some. const OPTION_SOME: u8 = 1; -/// Calculate top-up lamports directly from CToken account bytes. +/// Calculate top-up lamports directly from Token account bytes. /// Returns None if account doesn't have Compressible extension as first extension. #[inline(always)] #[profile] diff --git a/program-libs/ctoken-interface/src/state/ctoken/zero_copy.rs b/program-libs/token-interface/src/state/token/zero_copy.rs similarity index 85% rename from program-libs/ctoken-interface/src/state/ctoken/zero_copy.rs rename to program-libs/token-interface/src/state/token/zero_copy.rs index 49dc27104a..b6ebd2ac36 100644 --- a/program-libs/ctoken-interface/src/state/ctoken/zero_copy.rs +++ b/program-libs/token-interface/src/state/token/zero_copy.rs @@ -10,24 +10,24 @@ use light_zero_copy::{ use crate::{ state::{ - CToken, ExtensionStruct, ExtensionStructConfig, ZExtensionStruct, ZExtensionStructMut, + Token, ExtensionStruct, ExtensionStructConfig, ZExtensionStruct, ZExtensionStructMut, ACCOUNT_TYPE_TOKEN_ACCOUNT, }, AnchorDeserialize, AnchorSerialize, }; /// SPL Token Account base size (165 bytes) -pub const BASE_TOKEN_ACCOUNT_SIZE: u64 = CTokenZeroCopyMeta::LEN as u64; +pub const BASE_TOKEN_ACCOUNT_SIZE: u64 = TokenZeroCopyMeta::LEN as u64; -/// SPL-compatible CToken zero copy struct (165 bytes). -/// Uses derive macros to generate ZCTokenZeroCopyMeta<'a> and ZCTokenZeroCopyMetaMut<'a>. +/// SPL-compatible Token zero copy struct (165 bytes). +/// Uses derive macros to generate TokenZeroCopyMeta<'a> and TokenZeroCopyMetaMut<'a>. /// Note: account_type byte at position 165 is handled separately in ZeroCopyAt/ZeroCopyAtMut implementations. #[derive( Debug, PartialEq, Eq, Clone, AnchorSerialize, AnchorDeserialize, ZeroCopy, ZeroCopyMut, )] #[repr(C)] #[aligned_sized] -struct CTokenZeroCopyMeta { +struct TokenZeroCopyMeta { /// The mint associated with this account pub mint: Pubkey, /// The owner of this account. @@ -54,27 +54,27 @@ struct CTokenZeroCopyMeta { // End of SPL Token Account compatible layout (165 bytes) } -/// Zero-copy view of CToken with base and optional extensions +/// Zero-copy view of Token with base and optional extensions #[derive(Debug)] -pub struct ZCToken<'a> { - pub base: ZCTokenZeroCopyMeta<'a>, +pub struct ZToken<'a> { + pub base: ZTokenZeroCopyMeta<'a>, /// Account type byte read from position 165 (immutable) account_type: u8, pub extensions: Option>>, } -/// Mutable zero-copy view of CToken with base and optional extensions +/// Mutable zero-copy view of Token with base and optional extensions #[derive(Debug)] -pub struct ZCTokenMut<'a> { - pub base: ZCTokenZeroCopyMetaMut<'a>, +pub struct ZTokenMut<'a> { + pub base: ZTokenZeroCopyMetaMut<'a>, /// Account type byte read from position 165 (immutable even for mut) account_type: u8, pub extensions: Option>>, } -/// Configuration for creating a new CToken via ZeroCopyNew +/// Configuration for creating a new Token via ZeroCopyNew #[derive(Debug, Clone, PartialEq)] -pub struct CompressedTokenConfig { +pub struct TokenConfig { /// The mint pubkey pub mint: Pubkey, /// The owner pubkey @@ -85,9 +85,9 @@ pub struct CompressedTokenConfig { pub extensions: Option>, } -impl<'a> ZeroCopyNew<'a> for CToken { - type ZeroCopyConfig = CompressedTokenConfig; - type Output = ZCTokenMut<'a>; +impl<'a> ZeroCopyNew<'a> for Token { + type ZeroCopyConfig = TokenConfig; + type Output = ZTokenMut<'a>; fn byte_len( config: &Self::ZeroCopyConfig, @@ -117,7 +117,7 @@ impl<'a> ZeroCopyNew<'a> for CToken { } // Use derived new_zero_copy for base struct (config type is () for fixed-size struct) let (mut base, mut remaining) = - >::new_zero_copy(bytes, ())?; + >::new_zero_copy(bytes, ())?; // Set base token account fields from config base.mint = config.mint; @@ -168,7 +168,7 @@ impl<'a> ZeroCopyNew<'a> for CToken { return Err(light_zero_copy::errors::ZeroCopyError::Size); } Ok(( - ZCTokenMut { + ZTokenMut { base, account_type, extensions, @@ -178,14 +178,14 @@ impl<'a> ZeroCopyNew<'a> for CToken { } } -impl<'a> ZeroCopyAt<'a> for CToken { - type ZeroCopyAt = ZCToken<'a>; +impl<'a> ZeroCopyAt<'a> for Token { + type ZeroCopyAt = ZToken<'a>; #[inline(always)] fn zero_copy_at( bytes: &'a [u8], ) -> Result<(Self::ZeroCopyAt, &'a [u8]), light_zero_copy::errors::ZeroCopyError> { - let (base, bytes) = >::zero_copy_at(bytes)?; + let (base, bytes) = >::zero_copy_at(bytes)?; // Check if there are extensions by looking at account_type byte at position 165 if !bytes.is_empty() { @@ -197,7 +197,7 @@ impl<'a> ZeroCopyAt<'a> for CToken { let (extensions, bytes) = > as ZeroCopyAt<'a>>::zero_copy_at(bytes)?; Ok(( - ZCToken { + ZToken { base, account_type, extensions, @@ -207,7 +207,7 @@ impl<'a> ZeroCopyAt<'a> for CToken { } else { // No extensions - account_type defaults to TOKEN_ACCOUNT type Ok(( - ZCToken { + ZToken { base, account_type: ACCOUNT_TYPE_TOKEN_ACCOUNT, extensions: None, @@ -218,14 +218,14 @@ impl<'a> ZeroCopyAt<'a> for CToken { } } -impl<'a> ZeroCopyAtMut<'a> for CToken { - type ZeroCopyAtMut = ZCTokenMut<'a>; +impl<'a> ZeroCopyAtMut<'a> for Token { + type ZeroCopyAtMut = ZTokenMut<'a>; #[inline(always)] fn zero_copy_at_mut( bytes: &'a mut [u8], ) -> Result<(Self::ZeroCopyAtMut, &'a mut [u8]), light_zero_copy::errors::ZeroCopyError> { - let (base, bytes) = >::zero_copy_at_mut(bytes)?; + let (base, bytes) = >::zero_copy_at_mut(bytes)?; // Check if there are extensions by looking at account_type byte at position 165 if !bytes.is_empty() { @@ -237,7 +237,7 @@ impl<'a> ZeroCopyAtMut<'a> for CToken { let (extensions, bytes) = > as ZeroCopyAtMut<'a>>::zero_copy_at_mut(bytes)?; Ok(( - ZCTokenMut { + ZTokenMut { base, account_type, extensions, @@ -247,7 +247,7 @@ impl<'a> ZeroCopyAtMut<'a> for CToken { } else { // No extensions - account_type defaults to TOKEN_ACCOUNT type Ok(( - ZCTokenMut { + ZTokenMut { base, account_type: ACCOUNT_TYPE_TOKEN_ACCOUNT, extensions: None, @@ -259,39 +259,39 @@ impl<'a> ZeroCopyAtMut<'a> for CToken { } // Deref implementations for field access -impl<'a> Deref for ZCToken<'a> { - type Target = ZCTokenZeroCopyMeta<'a>; +impl<'a> Deref for ZToken<'a> { + type Target = ZTokenZeroCopyMeta<'a>; fn deref(&self) -> &Self::Target { &self.base } } -impl<'a> Deref for ZCTokenMut<'a> { - type Target = ZCTokenZeroCopyMetaMut<'a>; +impl<'a> Deref for ZTokenMut<'a> { + type Target = ZTokenZeroCopyMetaMut<'a>; fn deref(&self) -> &Self::Target { &self.base } } -impl<'a> DerefMut for ZCTokenMut<'a> { +impl<'a> DerefMut for ZTokenMut<'a> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.base } } -// Getters on ZCToken (immutable view) -impl<'a> ZCToken<'a> { +// Getters on ZToken (immutable view) +impl<'a> ZToken<'a> { /// Returns the account_type byte read from position 165 #[inline(always)] pub fn account_type(&self) -> u8 { self.account_type } - /// Checks if account_type matches CToken discriminator value + /// Checks if account_type matches Token discriminator value #[inline(always)] - pub fn is_ctoken_account(&self) -> bool { + pub fn is_token_account(&self) -> bool { self.account_type == ACCOUNT_TYPE_TOKEN_ACCOUNT } @@ -309,17 +309,17 @@ impl<'a> ZCToken<'a> { } } -// Getters on ZCTokenMut (account_type is still immutable) -impl<'a> ZCTokenMut<'a> { +// Getters on ZTokenMut (account_type is still immutable) +impl<'a> ZTokenMut<'a> { /// Returns the account_type byte read from position 165 #[inline(always)] pub fn account_type(&self) -> u8 { self.account_type } - /// Checks if account_type matches CToken discriminator value + /// Checks if account_type matches Token discriminator value #[inline(always)] - pub fn is_ctoken_account(&self) -> bool { + pub fn is_token_account(&self) -> bool { self.account_type == ACCOUNT_TYPE_TOKEN_ACCOUNT } @@ -350,8 +350,8 @@ impl<'a> ZCTokenMut<'a> { } } -// Getters on ZCTokenZeroCopyMeta (immutable) -impl ZCTokenZeroCopyMeta<'_> { +// Getters on ZTokenZeroCopyMeta (immutable) +impl ZTokenZeroCopyMeta<'_> { /// Checks if account is uninitialized (state == 0) #[inline(always)] pub fn is_uninitialized(&self) -> bool { @@ -401,8 +401,8 @@ impl ZCTokenZeroCopyMeta<'_> { } } -// Getters on ZCTokenZeroCopyMetaMut (mutable) -impl ZCTokenZeroCopyMetaMut<'_> { +// Getters on ZTokenZeroCopyMetaMut (mutable) +impl ZTokenZeroCopyMetaMut<'_> { /// Checks if account is uninitialized (state == 0) #[inline(always)] pub fn is_uninitialized(&self) -> bool { @@ -453,7 +453,7 @@ impl ZCTokenZeroCopyMetaMut<'_> { /// Set delegate (Some to set, None to clear) #[inline(always)] - pub fn set_delegate(&mut self, delegate: Option) -> Result<(), crate::CTokenError> { + pub fn set_delegate(&mut self, delegate: Option) -> Result<(), crate::TokenError> { match delegate { Some(pubkey) => { self.delegate_option_prefix.set(1); @@ -481,8 +481,8 @@ impl ZCTokenZeroCopyMetaMut<'_> { } } -// Checked methods on CTokenZeroCopy -impl CToken { +// Checked methods on TokenZeroCopy +impl Token { /// Zero-copy deserialization with initialization and account_type check. /// Returns an error if: /// - Account is uninitialized (byte 108 == 0) @@ -492,17 +492,17 @@ impl CToken { #[inline(always)] pub fn zero_copy_at_checked( bytes: &[u8], - ) -> Result<(ZCToken<'_>, &[u8]), crate::error::CTokenError> { - let (ctoken, remaining) = CToken::zero_copy_at(bytes)?; + ) -> Result<(ZToken<'_>, &[u8]), crate::error::TokenError> { + let (token, remaining) = Token::zero_copy_at(bytes)?; - if !ctoken.is_initialized() { - return Err(crate::error::CTokenError::InvalidAccountState); + if !token.is_initialized() { + return Err(crate::error::TokenError::InvalidAccountState); } - if !ctoken.is_ctoken_account() { - return Err(crate::error::CTokenError::InvalidAccountType); + if !token.is_token_account() { + return Err(crate::error::TokenError::InvalidAccountType); } - Ok((ctoken, remaining)) + Ok((token, remaining)) } /// Mutable zero-copy deserialization with initialization and account_type check. @@ -513,96 +513,96 @@ impl CToken { #[inline(always)] pub fn zero_copy_at_mut_checked( bytes: &mut [u8], - ) -> Result<(ZCTokenMut<'_>, &mut [u8]), crate::error::CTokenError> { - let (ctoken, remaining) = CToken::zero_copy_at_mut(bytes)?; + ) -> Result<(ZTokenMut<'_>, &mut [u8]), crate::error::TokenError> { + let (token, remaining) = Token::zero_copy_at_mut(bytes)?; - if !ctoken.is_initialized() { - return Err(crate::error::CTokenError::InvalidAccountState); + if !token.is_initialized() { + return Err(crate::error::TokenError::InvalidAccountState); } - if !ctoken.is_ctoken_account() { - return Err(crate::error::CTokenError::InvalidAccountType); + if !token.is_token_account() { + return Err(crate::error::TokenError::InvalidAccountType); } - Ok((ctoken, remaining)) + Ok((token, remaining)) } - /// Deserialize a CToken from account info with validation using zero-copy. + /// Deserialize a Token from account info with validation using zero-copy. /// /// Checks: /// 1. Account is owned by the CTOKEN program /// 2. Account is initialized (state != 0) /// 3. Account type is ACCOUNT_TYPE_TOKEN_ACCOUNT (byte 165 == 2) - /// 4. No trailing bytes after the CToken structure + /// 4. No trailing bytes after the Token structure /// - /// Safety: The returned ZCToken references the account data which is valid + /// Safety: The returned ZToken references the account data which is valid /// for the duration of the transaction. The caller must ensure the account /// is not modified through other means while this reference exists. #[inline(always)] pub fn from_account_info_checked<'a>( account_info: &pinocchio::account_info::AccountInfo, - ) -> Result, crate::error::CTokenError> { + ) -> Result, crate::error::TokenError> { // 1. Check program ownership - if !account_info.is_owned_by(&crate::CTOKEN_PROGRAM_ID) { - return Err(crate::error::CTokenError::InvalidCTokenOwner); + if !account_info.is_owned_by(&crate::LIGHT_TOKEN_PROGRAM_ID) { + return Err(crate::error::TokenError::InvalidTokenOwner); } let data = account_info .try_borrow_data() - .map_err(|_| crate::error::CTokenError::BorrowFailed)?; + .map_err(|_| crate::error::TokenError::BorrowFailed)?; // Extend lifetime to 'a - safe because account data lives for transaction duration let data_slice: &'a [u8] = unsafe { core::slice::from_raw_parts(data.as_ptr(), data.len()) }; - let (ctoken, remaining) = CToken::zero_copy_at_checked(data_slice)?; + let (token, remaining) = Token::zero_copy_at_checked(data_slice)?; // 4. Check no trailing bytes if !remaining.is_empty() { - return Err(crate::error::CTokenError::InvalidAccountData); + return Err(crate::error::TokenError::InvalidAccountData); } - Ok(ctoken) + Ok(token) } /// Mutable version of from_account_info_checked. - /// Deserialize a CToken from account info with validation using zero-copy. + /// Deserialize a Token from account info with validation using zero-copy. /// /// Checks: /// 1. Account is owned by the CTOKEN program /// 2. Account is initialized (state != 0) /// 3. Account type is ACCOUNT_TYPE_TOKEN_ACCOUNT (byte 165 == 2) - /// 4. No trailing bytes after the CToken structure + /// 4. No trailing bytes after the Token structure #[inline(always)] pub fn from_account_info_mut_checked<'a>( account_info: &pinocchio::account_info::AccountInfo, - ) -> Result, crate::error::CTokenError> { + ) -> Result, crate::error::TokenError> { // 1. Check program ownership - if !account_info.is_owned_by(&crate::CTOKEN_PROGRAM_ID) { - return Err(crate::error::CTokenError::InvalidCTokenOwner); + if !account_info.is_owned_by(&crate::LIGHT_TOKEN_PROGRAM_ID) { + return Err(crate::error::TokenError::InvalidTokenOwner); } let mut data = account_info .try_borrow_mut_data() - .map_err(|_| crate::error::CTokenError::BorrowFailed)?; + .map_err(|_| crate::error::TokenError::BorrowFailed)?; // Extend lifetime to 'a - safe because account data lives for transaction duration let data_slice: &'a mut [u8] = unsafe { core::slice::from_raw_parts_mut(data.as_mut_ptr(), data.len()) }; - let (ctoken, remaining) = CToken::zero_copy_at_mut_checked(data_slice)?; + let (token, remaining) = Token::zero_copy_at_mut_checked(data_slice)?; // 4. Check no trailing bytes if !remaining.is_empty() { - return Err(crate::error::CTokenError::InvalidAccountData); + return Err(crate::error::TokenError::InvalidAccountData); } - Ok(ctoken) + Ok(token) } } #[cfg(feature = "test-only")] -impl PartialEq for ZCToken<'_> { - fn eq(&self, other: &CToken) -> bool { +impl PartialEq for ZToken<'_> { + fn eq(&self, other: &Token) -> bool { // Compare basic fields if self.mint.to_bytes() != other.mint.to_bytes() || self.owner.to_bytes() != other.owner.to_bytes() @@ -806,7 +806,7 @@ impl PartialEq for ZCToken<'_> { // Unknown or unhandled extension types should panic to surface bugs early (zc_ext, regular_ext) => { panic!( - "Unknown extension type comparison: ZCToken extension {:?} vs CToken extension {:?}", + "Unknown extension type comparison: ZToken extension {:?} vs Token extension {:?}", std::mem::discriminant(zc_ext), std::mem::discriminant(regular_ext) ); @@ -823,8 +823,8 @@ impl PartialEq for ZCToken<'_> { } #[cfg(feature = "test-only")] -impl PartialEq> for CToken { - fn eq(&self, other: &ZCToken<'_>) -> bool { +impl PartialEq> for Token { + fn eq(&self, other: &ZToken<'_>) -> bool { other.eq(self) } } diff --git a/program-libs/ctoken-interface/src/token_2022_extensions.rs b/program-libs/token-interface/src/token_2022_extensions.rs similarity index 94% rename from program-libs/ctoken-interface/src/token_2022_extensions.rs rename to program-libs/token-interface/src/token_2022_extensions.rs index f36f8857b3..f0a6b3b363 100644 --- a/program-libs/ctoken-interface/src/token_2022_extensions.rs +++ b/program-libs/token-interface/src/token_2022_extensions.rs @@ -14,7 +14,7 @@ pub const RESTRICTED_EXTENSION_TYPES: [ExtensionType; 5] = [ ExtensionType::DefaultAccountState, ]; -/// Allowed mint extension types for CToken accounts. +/// Allowed mint extension types for Token accounts. /// Extensions not in this list will cause account creation to fail. /// /// Runtime constraints enforced by check_mint_extensions(): @@ -56,7 +56,7 @@ pub const fn is_restricted_extension(ext: &ExtensionType) -> bool { ) } -/// Flags for mint extensions that affect CToken account initialization and transfers +/// Flags for mint extensions that affect Token account initialization and transfers #[derive(Debug, Default, Clone, Copy)] pub struct MintExtensionFlags { /// Whether the mint has the PausableAccount extension @@ -65,7 +65,7 @@ pub struct MintExtensionFlags { pub has_permanent_delegate: bool, /// Whether the mint has the DefaultAccountState extension (restricted regardless of state) pub has_default_account_state: bool, - /// Whether DefaultAccountState is currently set to Frozen (for CToken account creation) + /// Whether DefaultAccountState is currently set to Frozen (for Token account creation) pub default_state_frozen: bool, /// Whether the mint has the TransferFeeConfig extension pub has_transfer_fee: bool, @@ -91,7 +91,7 @@ impl MintExtensionFlags { count } - /// Calculate the ctoken account size based on extension flags. + /// Calculate the token account size based on extension flags. /// /// # Arguments /// * `compressible` - If true, includes the Compressible extension in the size calculation @@ -140,7 +140,7 @@ impl MintExtensionFlags { } else { Some(&extensions[..count]) }; - crate::state::calculate_ctoken_account_size(exts).map(|size| size as u64) + crate::state::calculate_token_account_size(exts).map(|size| size as u64) } /// Returns true if mint has any restricted extensions. diff --git a/program-libs/ctoken-interface/tests/compressed_mint.rs b/program-libs/token-interface/tests/compressed_mint.rs similarity index 99% rename from program-libs/ctoken-interface/tests/compressed_mint.rs rename to program-libs/token-interface/tests/compressed_mint.rs index 13e2f90a06..313eeb1f56 100644 --- a/program-libs/ctoken-interface/tests/compressed_mint.rs +++ b/program-libs/token-interface/tests/compressed_mint.rs @@ -1,7 +1,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_compressed_account::Pubkey; use light_compressible::compression_info::CompressionInfo; -use light_ctoken_interface::state::{ +use light_token_interface::state::{ cmint_top_up_lamports_from_slice, extensions::{AdditionalMetadata, ExtensionStruct, TokenMetadata}, BaseMint, CompressedMint, CompressedMintConfig, CompressedMintMetadata, ACCOUNT_TYPE_MINT, diff --git a/program-libs/ctoken-interface/tests/cross_deserialization.rs b/program-libs/token-interface/tests/cross_deserialization.rs similarity index 73% rename from program-libs/ctoken-interface/tests/cross_deserialization.rs rename to program-libs/token-interface/tests/cross_deserialization.rs index 07705b3fc1..5889ef80e5 100644 --- a/program-libs/ctoken-interface/tests/cross_deserialization.rs +++ b/program-libs/token-interface/tests/cross_deserialization.rs @@ -1,16 +1,16 @@ -//! Cross-deserialization security tests for CToken and CMint accounts. +//! Cross-deserialization security tests for Token and CMint accounts. //! Verifies that account_type discriminator at byte 165 prevents confusion. //! //! With the new extension-based design: -//! - CToken base struct is 165 bytes (SPL-compatible) +//! - Token base struct is 165 bytes (SPL-compatible) //! - Account type byte is at position 165 ONLY when extensions are present //! - Compression info is stored in the Compressible extension use borsh::{BorshDeserialize, BorshSerialize}; use light_compressed_account::Pubkey; use light_compressible::{compression_info::CompressionInfo, rent::RentConfig}; -use light_ctoken_interface::state::{ - AccountState, BaseMint, CToken, CompressedMint, CompressedMintMetadata, CompressibleExtension, +use light_token_interface::state::{ + AccountState, BaseMint, Token, CompressedMint, CompressedMintMetadata, CompressibleExtension, ExtensionStruct, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; @@ -55,9 +55,9 @@ fn create_test_cmint() -> CompressedMint { } } -/// Create a test CToken with Compressible extension -fn create_test_ctoken_with_extension() -> CToken { - CToken { +/// Create a test Token with Compressible extension +fn create_test_ctoken_with_extension() -> Token { + Token { mint: Pubkey::new_from_array([1; 32]), owner: Pubkey::new_from_array([2; 32]), amount: 1000, @@ -94,9 +94,9 @@ fn create_test_ctoken_with_extension() -> CToken { } } -/// Create a simple CToken without extensions (SPL-compatible 165 bytes) -fn create_test_ctoken_simple() -> CToken { - CToken { +/// Create a simple Token without extensions (SPL-compatible 165 bytes) +fn create_test_ctoken_simple() -> Token { + Token { mint: Pubkey::new_from_array([1; 32]), owner: Pubkey::new_from_array([2; 32]), amount: 1000, @@ -119,24 +119,24 @@ fn test_account_type_byte_position() { "CMint account_type should be 1" ); - // CToken with extensions has account_type byte at position 165 - let ctoken = create_test_ctoken_with_extension(); - let ctoken_bytes = ctoken.try_to_vec().unwrap(); + // Token with extensions has account_type byte at position 165 + let token = create_test_ctoken_with_extension(); + let ctoken_bytes = token.try_to_vec().unwrap(); assert_eq!( ctoken_bytes[ACCOUNT_TYPE_OFFSET], 2, - "CToken with extensions account_type should be 2" + "Token with extensions account_type should be 2" ); } #[test] fn test_ctoken_without_extensions_size() { - // CToken without extensions should be exactly 165 bytes (SPL Token Account size) - let ctoken = create_test_ctoken_simple(); - let ctoken_bytes = ctoken.try_to_vec().unwrap(); + // Token without extensions should be exactly 165 bytes (SPL Token Account size) + let token = create_test_ctoken_simple(); + let ctoken_bytes = token.try_to_vec().unwrap(); assert_eq!( ctoken_bytes.len(), 165, - "CToken without extensions should be 165 bytes" + "Token without extensions should be 165 bytes" ); } @@ -145,31 +145,31 @@ fn test_cmint_bytes_fail_zero_copy_checked_as_ctoken() { let cmint = create_test_cmint(); let cmint_bytes = cmint.try_to_vec().unwrap(); - // CToken zero_copy_at_checked verifies account_type == 2, should fail for CMint bytes - let result = CToken::zero_copy_at_checked(&cmint_bytes); + // Token zero_copy_at_checked verifies account_type == 2, should fail for CMint bytes + let result = Token::zero_copy_at_checked(&cmint_bytes); assert!( result.is_err(), - "CMint bytes should fail to parse as CToken zero-copy checked" + "CMint bytes should fail to parse as Token zero-copy checked" ); } #[test] fn test_ctoken_bytes_fail_zero_copy_checked_as_cmint() { - let ctoken = create_test_ctoken_with_extension(); - let ctoken_bytes = ctoken.try_to_vec().unwrap(); + let token = create_test_ctoken_with_extension(); + let ctoken_bytes = token.try_to_vec().unwrap(); - // CompressedMint zero_copy_at_checked verifies account_type == 1, should fail for CToken bytes + // CompressedMint zero_copy_at_checked verifies account_type == 1, should fail for Token bytes let result = CompressedMint::zero_copy_at_checked(&ctoken_bytes); assert!( result.is_err(), - "CToken bytes should fail to parse as CMint zero-copy checked" + "Token bytes should fail to parse as CMint zero-copy checked" ); } #[test] fn test_ctoken_bytes_wrong_account_type_as_cmint() { - let ctoken = create_test_ctoken_with_extension(); - let ctoken_bytes = ctoken.try_to_vec().unwrap(); + let token = create_test_ctoken_with_extension(); + let ctoken_bytes = token.try_to_vec().unwrap(); // Deserialize as CMint - should succeed but have wrong account_type let cmint = CompressedMint::try_from_slice(&ctoken_bytes); @@ -191,19 +191,19 @@ fn test_cmint_bytes_borsh_as_ctoken() { let cmint = create_test_cmint(); let cmint_bytes = cmint.try_to_vec().unwrap(); - // Try to deserialize CMint bytes as CToken - let result = CToken::try_from_slice(&cmint_bytes); + // Try to deserialize CMint bytes as Token + let result = Token::try_from_slice(&cmint_bytes); // Borsh deserialization is lenient, but checked deserialization should detect the wrong type match result { - Ok(ctoken) => { - // Borsh is lenient and may succeed, but is_ctoken_account() check should fail + Ok(token) => { + // Borsh is lenient and may succeed, but is_token_account() check should fail // because CMint has account_type = ACCOUNT_TYPE_MINT (1), not ACCOUNT_TYPE_TOKEN_ACCOUNT (2) assert!( - !ctoken.is_ctoken_account(), - "CMint bytes deserialized as CToken should fail is_ctoken_account() check" + !token.is_token_account(), + "CMint bytes deserialized as Token should fail is_token_account() check" ); assert_eq!( - ctoken.account_type(), + token.account_type(), ACCOUNT_TYPE_MINT, "CMint bytes should retain ACCOUNT_TYPE_MINT discriminator" ); diff --git a/program-libs/ctoken-interface/tests/hash_tests.rs b/program-libs/token-interface/tests/hash_tests.rs similarity index 99% rename from program-libs/ctoken-interface/tests/hash_tests.rs rename to program-libs/token-interface/tests/hash_tests.rs index 2d029cec05..5c4b4c92c3 100644 --- a/program-libs/ctoken-interface/tests/hash_tests.rs +++ b/program-libs/token-interface/tests/hash_tests.rs @@ -1,7 +1,7 @@ // #[cfg(test)] // mod hash_tests { // use light_compressed_account::Pubkey; -// use light_ctoken_interface::state::{BaseMint, CompressedMint, CompressedMintMetadata}; +// use light_token_interface::state::{BaseMint, CompressedMint, CompressedMintMetadata}; // use rand::Rng; // /// Hash Collision Detection Tests diff --git a/program-libs/ctoken-interface/tests/mint_borsh_zero_copy.rs b/program-libs/token-interface/tests/mint_borsh_zero_copy.rs similarity index 98% rename from program-libs/ctoken-interface/tests/mint_borsh_zero_copy.rs rename to program-libs/token-interface/tests/mint_borsh_zero_copy.rs index 34feaed87f..0e4d8135a5 100644 --- a/program-libs/ctoken-interface/tests/mint_borsh_zero_copy.rs +++ b/program-libs/token-interface/tests/mint_borsh_zero_copy.rs @@ -5,7 +5,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_compressed_account::Pubkey; use light_compressible::compression_info::CompressionInfo; -use light_ctoken_interface::state::{ +use light_token_interface::state::{ extensions::{AdditionalMetadata, ExtensionStruct, TokenMetadata}, mint::{BaseMint, CompressedMint, CompressedMintMetadata, ACCOUNT_TYPE_MINT}, }; @@ -114,12 +114,12 @@ fn generate_random_mint() -> CompressedMint { /// Reconstruct extensions from zero-copy format fn reconstruct_extensions( - zc_extensions: &Option>, + zc_extensions: &Option>, ) -> Option> { zc_extensions.as_ref().map(|exts| { exts.iter() .map(|ext| match ext { - light_ctoken_interface::state::extensions::ZExtensionStruct::TokenMetadata( + light_token_interface::state::extensions::ZExtensionStruct::TokenMetadata( zc_metadata, ) => ExtensionStruct::TokenMetadata(TokenMetadata { update_authority: zc_metadata.update_authority, diff --git a/program-libs/ctoken-interface/tests/mint_compat.rs b/program-libs/token-interface/tests/mint_compat.rs similarity index 99% rename from program-libs/ctoken-interface/tests/mint_compat.rs rename to program-libs/token-interface/tests/mint_compat.rs index 74b456be84..f954638631 100644 --- a/program-libs/ctoken-interface/tests/mint_compat.rs +++ b/program-libs/token-interface/tests/mint_compat.rs @@ -4,7 +4,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_compressed_account::Pubkey; -use light_ctoken_interface::state::BaseMint; +use light_token_interface::state::BaseMint; use rand::{thread_rng, Rng}; use spl_token_2022::{solana_program::program_pack::Pack, state::Mint}; diff --git a/program-libs/ctoken-interface/tests/mod.rs b/program-libs/token-interface/tests/mod.rs similarity index 56% rename from program-libs/ctoken-interface/tests/mod.rs rename to program-libs/token-interface/tests/mod.rs index cbdef5151a..9c659266ae 100644 --- a/program-libs/ctoken-interface/tests/mod.rs +++ b/program-libs/token-interface/tests/mod.rs @@ -1,2 +1,2 @@ -pub mod ctoken; +pub mod token; pub mod mint_compat; diff --git a/program-libs/ctoken-interface/tests/pool_derivation.rs b/program-libs/token-interface/tests/pool_derivation.rs similarity index 98% rename from program-libs/ctoken-interface/tests/pool_derivation.rs rename to program-libs/token-interface/tests/pool_derivation.rs index 7a5efef6c2..ab45ce82f2 100644 --- a/program-libs/ctoken-interface/tests/pool_derivation.rs +++ b/program-libs/token-interface/tests/pool_derivation.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::{ +use light_token_interface::{ find_spl_interface_pda, find_spl_interface_pda_with_index, is_valid_spl_interface_pda, NUM_MAX_POOL_ACCOUNTS, }; diff --git a/program-libs/ctoken-interface/tests/ctoken/failing.rs b/program-libs/token-interface/tests/token/failing.rs similarity index 69% rename from program-libs/ctoken-interface/tests/ctoken/failing.rs rename to program-libs/token-interface/tests/token/failing.rs index 1ef87e0d0d..17f2331fb7 100644 --- a/program-libs/ctoken-interface/tests/ctoken/failing.rs +++ b/program-libs/token-interface/tests/token/failing.rs @@ -1,12 +1,12 @@ use light_compressed_account::Pubkey; -use light_ctoken_interface::{ - error::CTokenError, - state::{CToken, CompressedTokenConfig, BASE_TOKEN_ACCOUNT_SIZE}, +use light_token_interface::{ + error::TokenError, + state::{Token, TokenConfig, BASE_TOKEN_ACCOUNT_SIZE}, }; use light_zero_copy::ZeroCopyNew; -fn default_config() -> CompressedTokenConfig { - CompressedTokenConfig { +fn default_config() -> TokenConfig { + TokenConfig { mint: Pubkey::default(), owner: Pubkey::default(), state: 1, @@ -20,7 +20,7 @@ fn test_compressed_token_new_zero_copy_buffer_too_small() { // Create buffer that's too small let mut buffer = vec![0u8; 100]; // Less than BASE_TOKEN_ACCOUNT_SIZE - let result = CToken::new_zero_copy(&mut buffer, config); + let result = Token::new_zero_copy(&mut buffer, config); // Should fail with size error assert!(result.is_err()); @@ -32,10 +32,10 @@ fn test_zero_copy_at_checked_uninitialized_account() { let buffer = vec![0u8; BASE_TOKEN_ACCOUNT_SIZE as usize]; // This should fail because state byte is 0 (not initialized) - let result = CToken::zero_copy_at_checked(&buffer); + let result = Token::zero_copy_at_checked(&buffer); // Assert it returns InvalidAccountState error - assert!(matches!(result, Err(CTokenError::InvalidAccountState))); + assert!(matches!(result, Err(TokenError::InvalidAccountState))); } #[test] @@ -44,10 +44,10 @@ fn test_zero_copy_at_mut_checked_uninitialized_account() { let mut buffer = vec![0u8; BASE_TOKEN_ACCOUNT_SIZE as usize]; // This should fail because state byte is 0 (not initialized) - let result = CToken::zero_copy_at_mut_checked(&mut buffer); + let result = Token::zero_copy_at_mut_checked(&mut buffer); // Assert it returns InvalidAccountState error - assert!(matches!(result, Err(CTokenError::InvalidAccountState))); + assert!(matches!(result, Err(TokenError::InvalidAccountState))); } #[test] @@ -56,10 +56,10 @@ fn test_zero_copy_at_checked_buffer_too_small() { let buffer = vec![0u8; 100]; // This should fail because buffer is too small - let result = CToken::zero_copy_at_checked(&buffer); + let result = Token::zero_copy_at_checked(&buffer); // Assert it returns ZeroCopyError (buffer too small fails at zero_copy_at before checked validation) - assert!(matches!(result, Err(CTokenError::ZeroCopyError(_)))); + assert!(matches!(result, Err(TokenError::ZeroCopyError(_)))); } #[test] @@ -68,8 +68,8 @@ fn test_zero_copy_at_mut_checked_buffer_too_small() { let mut buffer = vec![0u8; 100]; // This should fail because buffer is too small - let result = CToken::zero_copy_at_mut_checked(&mut buffer); + let result = Token::zero_copy_at_mut_checked(&mut buffer); // Assert it returns ZeroCopyError (buffer too small fails at zero_copy_at_mut before checked validation) - assert!(matches!(result, Err(CTokenError::ZeroCopyError(_)))); + assert!(matches!(result, Err(TokenError::ZeroCopyError(_)))); } diff --git a/program-libs/ctoken-interface/tests/ctoken/mod.rs b/program-libs/token-interface/tests/token/mod.rs similarity index 72% rename from program-libs/ctoken-interface/tests/ctoken/mod.rs rename to program-libs/token-interface/tests/token/mod.rs index 5ba623dc6d..226906c1f6 100644 --- a/program-libs/ctoken-interface/tests/ctoken/mod.rs +++ b/program-libs/token-interface/tests/token/mod.rs @@ -1,5 +1,5 @@ pub mod failing; -pub mod randomized_solana_ctoken; +pub mod randomized_solana_token; pub mod size; pub mod spl_compat; pub mod top_up; diff --git a/program-libs/ctoken-interface/tests/ctoken/randomized_solana_ctoken.rs b/program-libs/token-interface/tests/token/randomized_solana_token.rs similarity index 98% rename from program-libs/ctoken-interface/tests/ctoken/randomized_solana_ctoken.rs rename to program-libs/token-interface/tests/token/randomized_solana_token.rs index 2e0b2f9aa8..20c7b8beaf 100644 --- a/program-libs/ctoken-interface/tests/ctoken/randomized_solana_ctoken.rs +++ b/program-libs/token-interface/tests/token/randomized_solana_token.rs @@ -3,9 +3,9 @@ // //! // use light_compressed_account::Pubkey; -// use light_ctoken_interface::state::{ +// use light_token_interface::state::{ // extensions::ExtensionStructConfig, -// solana_ctoken::{CompressedToken, CompressedTokenConfig}, +// solana_ctoken::{CompressedToken, TokenConfig}, // CompressionInfoConfig, ZExtensionStruct, ZExtensionStructMut, // }; // use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyAtMut, ZeroCopyNew}; @@ -118,8 +118,8 @@ // account_data // } -// fn create_config(data: &RandomTokenData) -> CompressedTokenConfig { -// CompressedTokenConfig { +// fn create_config(data: &RandomTokenData) -> TokenConfig { +// TokenConfig { // delegate: data.delegate.is_some(), // is_native: data.is_native.is_some(), // close_authority: data.close_authority.is_some(), diff --git a/program-libs/ctoken-interface/tests/ctoken/size.rs b/program-libs/token-interface/tests/token/size.rs similarity index 74% rename from program-libs/ctoken-interface/tests/ctoken/size.rs rename to program-libs/token-interface/tests/token/size.rs index 96d981812b..7574b1c08a 100644 --- a/program-libs/ctoken-interface/tests/ctoken/size.rs +++ b/program-libs/token-interface/tests/token/size.rs @@ -1,5 +1,5 @@ -use light_ctoken_interface::{ - state::{calculate_ctoken_account_size, CompressedOnlyExtension, ExtensionStructConfig}, +use light_token_interface::{ + state::{calculate_token_account_size, CompressedOnlyExtension, ExtensionStructConfig}, BASE_TOKEN_ACCOUNT_SIZE, }; @@ -7,23 +7,23 @@ use light_ctoken_interface::{ fn test_ctoken_account_size_calculation() { // Base only (no extensions) - SPL-compatible 165 bytes assert_eq!( - calculate_ctoken_account_size(None).unwrap(), + calculate_token_account_size(None).unwrap(), BASE_TOKEN_ACCOUNT_SIZE as usize ); // With pausable only (165 base + 1 account_type + 1 Option discriminator + 4 vec length + 1 ext discriminant = 172) let pausable_size = - calculate_ctoken_account_size(Some(&[ExtensionStructConfig::PausableAccount(())])).unwrap(); + calculate_token_account_size(Some(&[ExtensionStructConfig::PausableAccount(())])).unwrap(); assert_eq!(pausable_size, 172); // With permanent_delegate only (165 + 1 + 1 + 4 + 1 = 172) let perm_delegate_size = - calculate_ctoken_account_size(Some(&[ExtensionStructConfig::PermanentDelegateAccount(())])) + calculate_token_account_size(Some(&[ExtensionStructConfig::PermanentDelegateAccount(())])) .unwrap(); assert_eq!(perm_delegate_size, 172); // With pausable + permanent_delegate (165 + 1 + 1 + 4 + 1 + 1 = 173) - let both_size = calculate_ctoken_account_size(Some(&[ + let both_size = calculate_token_account_size(Some(&[ ExtensionStructConfig::PausableAccount(()), ExtensionStructConfig::PermanentDelegateAccount(()), ])) @@ -32,18 +32,18 @@ fn test_ctoken_account_size_calculation() { // With transfer_fee only (165 + 1 + 1 + 4 + 1 + 8 = 180) let transfer_fee_size = - calculate_ctoken_account_size(Some(&[ExtensionStructConfig::TransferFeeAccount(())])) + calculate_token_account_size(Some(&[ExtensionStructConfig::TransferFeeAccount(())])) .unwrap(); assert_eq!(transfer_fee_size, 180); // With transfer_hook only (165 + 1 + 1 + 4 + 1 + 1 = 173) let transfer_hook_size = - calculate_ctoken_account_size(Some(&[ExtensionStructConfig::TransferHookAccount(())])) + calculate_token_account_size(Some(&[ExtensionStructConfig::TransferHookAccount(())])) .unwrap(); assert_eq!(transfer_hook_size, 173); // With all 4 extensions (165 + 1 + 1 + 4 + 1 + 1 + 9 + 2 = 184) - let all_size = calculate_ctoken_account_size(Some(&[ + let all_size = calculate_token_account_size(Some(&[ ExtensionStructConfig::PausableAccount(()), ExtensionStructConfig::PermanentDelegateAccount(()), ExtensionStructConfig::TransferFeeAccount(()), @@ -55,7 +55,7 @@ fn test_ctoken_account_size_calculation() { #[test] fn test_compressed_only_extension_size() { - use light_ctoken_interface::state::ExtensionStruct; + use light_token_interface::state::ExtensionStruct; use light_zero_copy::ZeroCopyNew; // CompressedOnlyExtension: delegated_amount (u64=8) + withheld_transfer_fee (u64=8) + is_ata (u8=1) = 17 bytes diff --git a/program-libs/ctoken-interface/tests/ctoken/spl_compat.rs b/program-libs/token-interface/tests/token/spl_compat.rs similarity index 88% rename from program-libs/ctoken-interface/tests/ctoken/spl_compat.rs rename to program-libs/token-interface/tests/token/spl_compat.rs index 80c69d9b62..cb66d67f9d 100644 --- a/program-libs/ctoken-interface/tests/ctoken/spl_compat.rs +++ b/program-libs/token-interface/tests/token/spl_compat.rs @@ -1,4 +1,4 @@ -//! Tests ctoken solana account - spl token account layout compatibility +//! Tests token solana account - spl token account layout compatibility //! //! Tests: //! 1. test_compressed_token_equivalent_to_pod_account @@ -6,8 +6,8 @@ //! 3. test_account_type_compatibility_with_spl_parsing use light_compressed_account::Pubkey; -use light_ctoken_interface::state::{ - ctoken::{CToken, CompressedTokenConfig, ZCToken, ZCTokenMut, BASE_TOKEN_ACCOUNT_SIZE}, +use light_token_interface::state::{ + token::{Token, TokenConfig, ZToken, ZTokenMut, BASE_TOKEN_ACCOUNT_SIZE}, extensions::ExtensionStructConfig, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; @@ -21,8 +21,8 @@ use spl_token_2022::{ state::{Account, AccountState}, }; -fn default_config() -> CompressedTokenConfig { - CompressedTokenConfig { +fn default_config() -> TokenConfig { + TokenConfig { mint: Pubkey::default(), owner: Pubkey::default(), state: 1, @@ -31,7 +31,7 @@ fn default_config() -> CompressedTokenConfig { } /// Generate random token account data using SPL Token's pack method -/// Creates a buffer large enough for the full CToken meta struct +/// Creates a buffer large enough for the full Token meta struct fn generate_random_token_account_data(rng: &mut impl Rng) -> Vec { let account = Account { mint: solana_pubkey::Pubkey::new_from_array(rng.gen::<[u8; 32]>()), @@ -68,9 +68,9 @@ fn generate_random_token_account_data(rng: &mut impl Rng) -> Vec { account_data } -/// Compare all fields between our CToken zero-copy implementation and Pod account +/// Compare all fields between our Token zero-copy implementation and Pod account fn compare_compressed_token_with_pod_account( - compressed_token: &ZCToken, + compressed_token: &ZToken, pod_account: &PodAccount, ) -> bool { // Extensions should be None for basic SPL Token accounts @@ -173,9 +173,9 @@ fn compare_compressed_token_with_pod_account( true } -/// Compare all fields between our CToken mutable zero-copy implementation and Pod account +/// Compare all fields between our Token mutable zero-copy implementation and Pod account fn compare_compressed_token_mut_with_pod_account( - compressed_token: &ZCTokenMut, + compressed_token: &ZTokenMut, pod_account: &PodAccount, ) -> bool { // Extensions should be None for basic SPL Token accounts @@ -293,7 +293,7 @@ fn test_compressed_token_equivalent_to_pod_account() { let pod_account = pod_from_bytes::(&account_data_clone[..165]).unwrap(); // Test immutable version - let (compressed_token, _) = CToken::zero_copy_at(&account_data).unwrap(); + let (compressed_token, _) = Token::zero_copy_at(&account_data).unwrap(); println!("Compressed Token: {:?}", compressed_token); println!("Pod Account: {:?}", pod_account); assert!(compare_compressed_token_with_pod_account( @@ -305,7 +305,7 @@ fn test_compressed_token_equivalent_to_pod_account() { // Pod account only knows about the first 165 bytes let pod_account = pod_from_bytes::(&account_data_clone[..165]).unwrap(); // Test mutable version - let (compressed_token_mut, _) = CToken::zero_copy_at_mut(&mut account_data).unwrap(); + let (compressed_token_mut, _) = Token::zero_copy_at_mut(&mut account_data).unwrap(); println!("Compressed Token Mut: {:?}", compressed_token_mut); println!("Pod Account: {:?}", pod_account); @@ -319,12 +319,12 @@ fn test_compressed_token_equivalent_to_pod_account() { #[test] fn test_compressed_token_with_pausable_extension() { - let config = CompressedTokenConfig { + let config = TokenConfig { extensions: Some(vec![ExtensionStructConfig::PausableAccount(())]), ..default_config() }; - let required_size = CToken::byte_len(&config).unwrap(); + let required_size = Token::byte_len(&config).unwrap(); println!("Required size for pausable extension: {}", required_size); // Should be more than 165 bytes due to AccountType byte and extension @@ -332,7 +332,7 @@ fn test_compressed_token_with_pausable_extension() { let mut buffer = vec![0u8; required_size]; { - let (_, remaining_bytes) = CToken::new_zero_copy(&mut buffer, config) + let (_, remaining_bytes) = Token::new_zero_copy(&mut buffer, config) .expect("Failed to initialize compressed token with pausable extension"); assert_eq!(remaining_bytes.len(), 0); @@ -342,7 +342,7 @@ fn test_compressed_token_with_pausable_extension() { // Test zero-copy deserialization round-trip - extensions are parsed from bytes let (deserialized_token, _) = - CToken::zero_copy_at(&buffer).expect("Failed to deserialize token with pausable extension"); + Token::zero_copy_at(&buffer).expect("Failed to deserialize token with pausable extension"); assert!(deserialized_token.extensions.is_some()); let deserialized_extensions = deserialized_token.extensions.as_ref().unwrap(); @@ -350,7 +350,7 @@ fn test_compressed_token_with_pausable_extension() { // Test mutable deserialization with a fresh buffer let mut buffer_copy = buffer.clone(); - let (mutable_token, _) = CToken::zero_copy_at_mut(&mut buffer_copy) + let (mutable_token, _) = Token::zero_copy_at_mut(&mut buffer_copy) .expect("Failed to deserialize mutable token with pausable extension"); assert!(mutable_token.extensions.is_some()); @@ -358,14 +358,14 @@ fn test_compressed_token_with_pausable_extension() { #[test] fn test_account_type_compatibility_with_spl_parsing() { - let config = CompressedTokenConfig { + let config = TokenConfig { extensions: Some(vec![ExtensionStructConfig::PausableAccount(())]), ..default_config() }; - let mut buffer = vec![0u8; CToken::byte_len(&config).unwrap()]; + let mut buffer = vec![0u8; Token::byte_len(&config).unwrap()]; { - let (mut compressed_token, _) = CToken::new_zero_copy(&mut buffer, config) + let (mut compressed_token, _) = Token::new_zero_copy(&mut buffer, config) .expect("Failed to create token with extension"); // Set state to Initialized (1) for SPL compatibility - required for SPL parsing compressed_token.base.state = 1; @@ -395,24 +395,24 @@ fn test_account_type_compatibility_with_spl_parsing() { println!("token_account_data {:?}", token_account_data); } -/// Test PartialEq between ZCToken and CToken with Pausable extension. +/// Test PartialEq between ZToken and Token with Pausable extension. #[test] fn test_pausable_extension_partial_eq() { - use light_ctoken_interface::state::{ - ctoken::AccountState as CtokenAccountState, + use light_token_interface::state::{ + token::AccountState as CtokenAccountState, extensions::{ExtensionStruct, PausableAccountExtension}, }; - let config = CompressedTokenConfig { + let config = TokenConfig { extensions: Some(vec![ExtensionStructConfig::PausableAccount(())]), ..default_config() }; - let mut buffer = vec![0u8; CToken::byte_len(&config).unwrap()]; - let _ = CToken::new_zero_copy(&mut buffer, config).unwrap(); + let mut buffer = vec![0u8; Token::byte_len(&config).unwrap()]; + let _ = Token::new_zero_copy(&mut buffer, config).unwrap(); // new_zero_copy now sets fields from config - let expected = CToken { + let expected = Token { mint: Pubkey::default(), owner: Pubkey::default(), amount: 0, @@ -427,6 +427,6 @@ fn test_pausable_extension_partial_eq() { )]), }; - let (zctoken, _) = CToken::zero_copy_at(&buffer).unwrap(); + let (zctoken, _) = Token::zero_copy_at(&buffer).unwrap(); assert_eq!(zctoken, expected); } diff --git a/program-libs/ctoken-interface/tests/ctoken/top_up.rs b/program-libs/token-interface/tests/token/top_up.rs similarity index 76% rename from program-libs/ctoken-interface/tests/ctoken/top_up.rs rename to program-libs/token-interface/tests/token/top_up.rs index f331e8c804..4c5feffbcd 100644 --- a/program-libs/ctoken-interface/tests/ctoken/top_up.rs +++ b/program-libs/token-interface/tests/token/top_up.rs @@ -1,16 +1,16 @@ //! Test that top_up_lamports_from_slice produces identical results to full deserialization. use light_compressed_account::Pubkey; -use light_ctoken_interface::state::{ - top_up_lamports_from_slice, CToken, CompressedTokenConfig, CompressibleExtensionConfig, +use light_token_interface::state::{ + top_up_lamports_from_slice, Token, TokenConfig, CompressibleExtensionConfig, CompressionInfoConfig, ExtensionStructConfig, }; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyNew}; #[test] fn test_top_up_lamports_matches_full_deserialization() { - // Create a CToken with Compressible extension - let config = CompressedTokenConfig { + // Create a Token with Compressible extension + let config = TokenConfig { mint: Pubkey::default(), owner: Pubkey::default(), state: 1, @@ -21,16 +21,16 @@ fn test_top_up_lamports_matches_full_deserialization() { )]), }; - let size = CToken::byte_len(&config).unwrap(); + let size = Token::byte_len(&config).unwrap(); let mut buffer = vec![0u8; size]; - let (mut ctoken, _) = CToken::new_zero_copy(&mut buffer, config).unwrap(); + let (mut token, _) = Token::new_zero_copy(&mut buffer, config).unwrap(); // Set known values in CompressionInfo via zero-copy - let ext = ctoken.extensions.as_mut().unwrap(); + let ext = token.extensions.as_mut().unwrap(); let compressible = ext .iter_mut() .find_map(|e| match e { - light_ctoken_interface::state::ZExtensionStructMut::Compressible(c) => Some(c), + light_token_interface::state::ZExtensionStructMut::Compressible(c) => Some(c), _ => None, }) .unwrap(); @@ -53,14 +53,14 @@ fn test_top_up_lamports_matches_full_deserialization() { .expect("Should return Some"); // Calculate using full deserialization - let (ctoken_read, _) = CToken::zero_copy_at(&buffer).unwrap(); + let (ctoken_read, _) = Token::zero_copy_at(&buffer).unwrap(); let compressible_read = ctoken_read .extensions .as_ref() .unwrap() .iter() .find_map(|e| match e { - light_ctoken_interface::state::ZExtensionStruct::Compressible(c) => Some(c), + light_token_interface::state::ZExtensionStruct::Compressible(c) => Some(c), _ => None, }) .unwrap(); diff --git a/program-libs/ctoken-interface/tests/ctoken/zero_copy_new.rs b/program-libs/token-interface/tests/token/zero_copy_new.rs similarity index 68% rename from program-libs/ctoken-interface/tests/ctoken/zero_copy_new.rs rename to program-libs/token-interface/tests/token/zero_copy_new.rs index 22effe6182..dfb9c26cfd 100644 --- a/program-libs/ctoken-interface/tests/ctoken/zero_copy_new.rs +++ b/program-libs/token-interface/tests/token/zero_copy_new.rs @@ -6,17 +6,17 @@ //! 2. test_compressed_token_new_zero_copy_with_pausable_extension - with extension use light_compressed_account::Pubkey; -use light_ctoken_interface::state::{ - ctoken::{ - AccountState, CToken, CompressedTokenConfig, ACCOUNT_TYPE_TOKEN_ACCOUNT, +use light_token_interface::state::{ + token::{ + AccountState, Token, TokenConfig, ACCOUNT_TYPE_TOKEN_ACCOUNT, BASE_TOKEN_ACCOUNT_SIZE, }, extensions::{ExtensionStruct, ExtensionStructConfig, PausableAccountExtension}, }; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyNew}; -fn default_config() -> CompressedTokenConfig { - CompressedTokenConfig { +fn default_config() -> TokenConfig { + TokenConfig { mint: Pubkey::default(), owner: Pubkey::default(), state: 1, @@ -28,17 +28,17 @@ fn default_config() -> CompressedTokenConfig { fn test_compressed_token_new_zero_copy() { let config = default_config(); - let required_size = CToken::byte_len(&config).unwrap(); + let required_size = Token::byte_len(&config).unwrap(); assert_eq!(required_size, BASE_TOKEN_ACCOUNT_SIZE as usize); let mut buffer = vec![0u8; required_size]; - let _ = CToken::new_zero_copy(&mut buffer, config).expect("Failed to initialize"); + let _ = Token::new_zero_copy(&mut buffer, config).expect("Failed to initialize"); - let (zctoken, remaining) = CToken::zero_copy_at(&buffer).unwrap(); + let (zctoken, remaining) = Token::zero_copy_at(&buffer).unwrap(); // new_zero_copy now sets fields from config - // Without extensions, CToken has SPL-compatible base layout only - let expected = CToken { + // Without extensions, Token has SPL-compatible base layout only + let expected = Token { mint: Pubkey::default(), owner: Pubkey::default(), amount: 0, @@ -57,21 +57,21 @@ fn test_compressed_token_new_zero_copy() { #[test] fn test_compressed_token_new_zero_copy_with_pausable_extension() { - let config = CompressedTokenConfig { + let config = TokenConfig { extensions: Some(vec![ExtensionStructConfig::PausableAccount(())]), ..default_config() }; - let required_size = CToken::byte_len(&config).unwrap(); + let required_size = Token::byte_len(&config).unwrap(); assert!(required_size > BASE_TOKEN_ACCOUNT_SIZE as usize); let mut buffer = vec![0u8; required_size]; - let _ = CToken::new_zero_copy(&mut buffer, config).expect("Failed to initialize"); + let _ = Token::new_zero_copy(&mut buffer, config).expect("Failed to initialize"); - let (zctoken, remaining) = CToken::zero_copy_at(&buffer).unwrap(); + let (zctoken, remaining) = Token::zero_copy_at(&buffer).unwrap(); // new_zero_copy now sets fields from config - let expected = CToken { + let expected = Token { mint: Pubkey::default(), owner: Pubkey::default(), amount: 0, @@ -94,19 +94,19 @@ fn test_compressed_token_new_zero_copy_with_pausable_extension() { fn test_compressed_token_byte_len_consistency() { // No extensions let config_no_ext = default_config(); - let size_no_ext = CToken::byte_len(&config_no_ext).unwrap(); + let size_no_ext = Token::byte_len(&config_no_ext).unwrap(); let mut buffer_no_ext = vec![0u8; size_no_ext]; - let (_, remaining) = CToken::new_zero_copy(&mut buffer_no_ext, config_no_ext).unwrap(); + let (_, remaining) = Token::new_zero_copy(&mut buffer_no_ext, config_no_ext).unwrap(); assert_eq!(remaining.len(), 0); // With pausable extension - let config_with_ext = CompressedTokenConfig { + let config_with_ext = TokenConfig { extensions: Some(vec![ExtensionStructConfig::PausableAccount(())]), ..default_config() }; - let size_with_ext = CToken::byte_len(&config_with_ext).unwrap(); + let size_with_ext = Token::byte_len(&config_with_ext).unwrap(); let mut buffer_with_ext = vec![0u8; size_with_ext]; - let (_, remaining) = CToken::new_zero_copy(&mut buffer_with_ext, config_with_ext).unwrap(); + let (_, remaining) = Token::new_zero_copy(&mut buffer_with_ext, config_with_ext).unwrap(); assert_eq!(remaining.len(), 0); assert!(size_with_ext > size_no_ext); @@ -115,14 +115,14 @@ fn test_compressed_token_byte_len_consistency() { #[test] fn test_new_zero_copy_fails_if_already_initialized() { let config = default_config(); - let required_size = CToken::byte_len(&config).unwrap(); + let required_size = Token::byte_len(&config).unwrap(); let mut buffer = vec![0u8; required_size]; // First initialization should succeed - let _ = CToken::new_zero_copy(&mut buffer, config.clone()).expect("First init should succeed"); + let _ = Token::new_zero_copy(&mut buffer, config.clone()).expect("First init should succeed"); // Second initialization should fail because account is already initialized - let result = CToken::new_zero_copy(&mut buffer, config); + let result = Token::new_zero_copy(&mut buffer, config); assert!( result.is_err(), "new_zero_copy should fail if account is already initialized" diff --git a/program-libs/ctoken-interface/tests/token_data.rs b/program-libs/token-interface/tests/token_data.rs similarity index 99% rename from program-libs/ctoken-interface/tests/token_data.rs rename to program-libs/token-interface/tests/token_data.rs index 4598d5422e..7e4ccf952a 100644 --- a/program-libs/ctoken-interface/tests/token_data.rs +++ b/program-libs/token-interface/tests/token_data.rs @@ -1,7 +1,7 @@ #![cfg(feature = "poseidon")] use light_compressed_account::{hash_to_bn254_field_size_be, Pubkey}; -use light_ctoken_interface::state::{CompressedTokenAccountState, TokenData}; +use light_token_interface::state::{CompressedTokenAccountState, TokenData}; use light_hasher::HasherError; use num_bigint::BigUint; use rand::Rng; diff --git a/program-libs/ctoken-interface/tests/token_data_hash.rs b/program-libs/token-interface/tests/token_data_hash.rs similarity index 99% rename from program-libs/ctoken-interface/tests/token_data_hash.rs rename to program-libs/token-interface/tests/token_data_hash.rs index 0a74e965b4..c5b796f2ba 100644 --- a/program-libs/ctoken-interface/tests/token_data_hash.rs +++ b/program-libs/token-interface/tests/token_data_hash.rs @@ -1,5 +1,5 @@ use light_compressed_account::Pubkey; -use light_ctoken_interface::state::{CompressedTokenAccountState, TokenData}; +use light_token_interface::state::{CompressedTokenAccountState, TokenData}; pub struct TestCase { pub name: String, diff --git a/program-libs/ctoken-interface/tests/token_metadata.rs b/program-libs/token-interface/tests/token_metadata.rs similarity index 99% rename from program-libs/ctoken-interface/tests/token_metadata.rs rename to program-libs/token-interface/tests/token_metadata.rs index e97ac221b2..f275842fe0 100644 --- a/program-libs/ctoken-interface/tests/token_metadata.rs +++ b/program-libs/token-interface/tests/token_metadata.rs @@ -5,7 +5,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_compressed_account::Pubkey; -use light_ctoken_interface::state::extensions::{ +use light_token_interface::state::extensions::{ AdditionalMetadata, TokenMetadata as LightTokenMetadata, }; use rand::{distributions::Alphanumeric, thread_rng, Rng}; diff --git a/program-tests/compressed-token-test/Cargo.toml b/program-tests/compressed-token-test/Cargo.toml index c4e9a3507c..be8b18dd88 100644 --- a/program-tests/compressed-token-test/Cargo.toml +++ b/program-tests/compressed-token-test/Cargo.toml @@ -43,7 +43,7 @@ spl-token = { workspace = true } anchor-spl = { workspace = true } rand = { workspace = true } serial_test = { workspace = true } -light-ctoken-interface = { workspace = true } +light-token-interface = { workspace = true } light-token-client = { workspace = true } light-compressible = { workspace = true } light-ctoken-sdk = { workspace = true } diff --git a/program-tests/compressed-token-test/tests/compress_only/all.rs b/program-tests/compressed-token-test/tests/compress_only/all.rs index 6aacc77993..0bd7307fde 100644 --- a/program-tests/compressed-token-test/tests/compress_only/all.rs +++ b/program-tests/compressed-token-test/tests/compress_only/all.rs @@ -3,8 +3,8 @@ //! This module tests the full compress -> decompress cycle with all extensions enabled. use borsh::BorshDeserialize; -use light_ctoken_interface::state::{ - AccountState, CToken, ExtensionStruct, ACCOUNT_TYPE_TOKEN_ACCOUNT, +use light_token_interface::state::{ + AccountState, Token, ExtensionStruct, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; use light_program_test::program_test::TestRpc; use serial_test::serial; @@ -20,7 +20,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { #[allow(unused_imports)] use light_client::indexer::CompressedTokenAccount; use light_client::indexer::Indexer; - use light_ctoken_interface::{ + use light_token_interface::{ instructions::extensions::{ CompressedOnlyExtensionInstructionData, ExtensionInstructionData, }, @@ -149,7 +149,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { // Build expected TokenData with CompressedOnly extension // The CToken had marker extensions (PausableAccount, PermanentDelegateAccount), // so the compressed token should have CompressedOnly TLV extension - use light_ctoken_interface::state::{ + use light_token_interface::state::{ CompressedOnlyExtension, CompressedTokenAccountState, TokenData, }; @@ -265,12 +265,12 @@ async fn test_compress_and_close_ctoken_with_extensions() { .unwrap() .unwrap(); - let dest_ctoken = CToken::deserialize(&mut &dest_account_data.data[..]) + let dest_ctoken = Token::deserialize(&mut &dest_account_data.data[..]) .expect("Failed to deserialize destination CToken account"); // Build expected CToken account // Compression fields are now in the Compressible extension - let expected_dest_ctoken = CToken { + let expected_dest_token = Token { mint: mint_pubkey.to_bytes().into(), owner: owner.pubkey().to_bytes().into(), amount: mint_amount, @@ -285,7 +285,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { }; assert_eq!( - dest_ctoken, expected_dest_ctoken, + dest_ctoken, expected_dest_token, "Decompressed CToken account should match expected with all extensions" ); diff --git a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs index 6a08faa6d4..233458af88 100644 --- a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs +++ b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs @@ -4,7 +4,7 @@ //! decompressed to the exact same ATA pubkey that was originally compressed. use light_client::indexer::Indexer; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, state::{ExtensionStruct, TokenDataVersion}, }; @@ -312,14 +312,14 @@ async fn test_ata_decompress_to_correct_ata_succeeds() { // Verify ATA has tokens restored use borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let dest_account = context .rpc .get_account(context.ata_pubkey) .await .unwrap() .unwrap(); - let dest_ctoken = CToken::deserialize(&mut &dest_account.data[..]).unwrap(); + let dest_ctoken = Token::deserialize(&mut &dest_account.data[..]).unwrap(); assert_eq!( dest_ctoken.amount, context.amount, "Decompressed amount should match" @@ -655,14 +655,14 @@ async fn test_decompress_to_account_with_balance_adds() { // Verify final balance is sum of existing + decompressed use borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let dest_account = context .rpc .get_account(context.ata_pubkey) .await .unwrap() .unwrap(); - let dest_ctoken = CToken::deserialize(&mut &dest_account.data[..]).unwrap(); + let dest_ctoken = Token::deserialize(&mut &dest_account.data[..]).unwrap(); assert_eq!( dest_ctoken.amount, pre_existing_amount + context.amount, @@ -763,14 +763,14 @@ async fn test_decompress_skips_delegate_if_destination_has_delegate() { // Verify destination delegate is still Bob (not Alice) use borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let dest_account = context .rpc .get_account(context.ata_pubkey) .await .unwrap() .unwrap(); - let dest_ctoken = CToken::deserialize(&mut &dest_account.data[..]).unwrap(); + let dest_ctoken = Token::deserialize(&mut &dest_account.data[..]).unwrap(); assert_eq!( dest_ctoken.delegate, @@ -790,7 +790,7 @@ async fn test_decompress_skips_delegate_if_destination_has_delegate() { async fn test_ata_decompress_with_mismatched_amount_fails() { use borsh::BorshSerialize; use light_compressed_account::compressed_account::PackedMerkleContext; - use light_ctoken_interface::{ + use light_token_interface::{ instructions::transfer2::{ CompressedTokenInstructionDataTransfer2, Compression, CompressionMode, MultiInputTokenDataWithContext, @@ -963,7 +963,7 @@ async fn test_ata_decompress_with_mismatched_amount_fails() { let instruction_account_metas = get_transfer2_instruction_account_metas(meta_config); let decompress_ix = Instruction { - program_id: light_ctoken_interface::CTOKEN_PROGRAM_ID.into(), + program_id: light_token_interface::LIGHT_TOKEN_PROGRAM_ID.into(), accounts: instruction_account_metas, data, }; @@ -1278,10 +1278,10 @@ async fn test_ata_multiple_compress_decompress_cycles() { // Verify ATA has combined balance use borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let ata_account = rpc.get_account(ata_pubkey).await.unwrap().unwrap(); - let ata_ctoken = CToken::deserialize(&mut &ata_account.data[..]).unwrap(); + let ata_ctoken = Token::deserialize(&mut &ata_account.data[..]).unwrap(); assert_eq!( ata_ctoken.amount, @@ -1505,13 +1505,13 @@ async fn test_non_ata_compress_only_decompress() { // Verify tokens restored use borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let dest_account = context .rpc .get_account(new_account_keypair.pubkey()) .await .unwrap() .unwrap(); - let dest_ctoken = CToken::deserialize(&mut &dest_account.data[..]).unwrap(); + let dest_ctoken = Token::deserialize(&mut &dest_account.data[..]).unwrap(); assert_eq!(dest_ctoken.amount, mint_amount); } diff --git a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs index f25ad4f3b6..78d00e0f81 100644 --- a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs +++ b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs @@ -5,7 +5,7 @@ //! - Spec #14: CompressedOnly inputs must decompress complete account (no change output) use light_client::indexer::Indexer; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, state::TokenDataVersion, }; diff --git a/program-tests/compressed-token-test/tests/compress_only/default_state.rs b/program-tests/compressed-token-test/tests/compress_only/default_state.rs index 918c530776..c95ab55a22 100644 --- a/program-tests/compressed-token-test/tests/compress_only/default_state.rs +++ b/program-tests/compressed-token-test/tests/compress_only/default_state.rs @@ -4,7 +4,7 @@ //! the DefaultAccountState extension set to either Initialized or Frozen. use borsh::BorshDeserialize; -use light_ctoken_interface::state::{AccountState, CToken, ACCOUNT_TYPE_TOKEN_ACCOUNT}; +use light_token_interface::state::{AccountState, Token, ACCOUNT_TYPE_TOKEN_ACCOUNT}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{ mint_2022::{create_mint_22_with_extension_types, create_mint_22_with_frozen_default_state}, @@ -19,7 +19,7 @@ use spl_token_2022::extension::ExtensionType; #[tokio::test] #[serial] async fn test_create_ctoken_with_frozen_default_state() { - use light_ctoken_interface::state::TokenDataVersion; + use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) @@ -72,11 +72,11 @@ async fn test_create_ctoken_with_frozen_default_state() { // Deserialize the CToken account using borsh let ctoken = - CToken::deserialize(&mut &account.data[..]).expect("Failed to deserialize CToken account"); + Token::deserialize(&mut &account.data[..]).expect("Failed to deserialize Token account"); // Build expected CToken account for comparison // Compression fields are now in the Compressible extension - let expected_ctoken = CToken { + let expected_token = Token { mint: mint_pubkey.to_bytes().into(), owner: payer.pubkey().to_bytes().into(), amount: 0, @@ -91,7 +91,7 @@ async fn test_create_ctoken_with_frozen_default_state() { }; assert_eq!( - ctoken, expected_ctoken, + ctoken, expected_token, "CToken account should match expected" ); @@ -107,7 +107,7 @@ async fn test_create_ctoken_with_frozen_default_state() { #[tokio::test] #[serial] async fn test_create_ctoken_with_initialized_default_state() { - use light_ctoken_interface::state::TokenDataVersion; + use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) @@ -160,11 +160,11 @@ async fn test_create_ctoken_with_initialized_default_state() { // Deserialize the CToken account using borsh let ctoken = - CToken::deserialize(&mut &account.data[..]).expect("Failed to deserialize CToken account"); + Token::deserialize(&mut &account.data[..]).expect("Failed to deserialize Token account"); // Build expected CToken account for comparison // Extensions include Compressible (for compression fields) - let expected_ctoken = CToken { + let expected_token = Token { mint: mint_pubkey.to_bytes().into(), owner: payer.pubkey().to_bytes().into(), amount: 0, @@ -178,7 +178,7 @@ async fn test_create_ctoken_with_initialized_default_state() { }; assert_eq!( - ctoken, expected_ctoken, + ctoken, expected_token, "CToken account should match expected" ); diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs index d6804b1525..e123e7f3fc 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs @@ -8,7 +8,7 @@ use anchor_spl::token_2022::spl_token_2022; use light_client::indexer::Indexer; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, state::TokenDataVersion, }; diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs index a12191bad1..6f81250b68 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs @@ -9,7 +9,7 @@ use anchor_lang::{system_program, InstructionData, ToAccountMetas}; use light_client::indexer::Indexer; -use light_ctoken_interface::{ +use light_token_interface::{ find_spl_interface_pda_with_index, instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, state::TokenDataVersion, diff --git a/program-tests/compressed-token-test/tests/compress_only/mod.rs b/program-tests/compressed-token-test/tests/compress_only/mod.rs index 311340fbf6..43fee1b8ea 100644 --- a/program-tests/compressed-token-test/tests/compress_only/mod.rs +++ b/program-tests/compressed-token-test/tests/compress_only/mod.rs @@ -4,7 +4,7 @@ //! with Token-2022 mints that have restricted extensions. use borsh::BorshDeserialize; -use light_ctoken_interface::state::{AccountState, CToken, ExtensionStruct}; +use light_token_interface::state::{AccountState, Token, ExtensionStruct}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; pub use light_test_utils::{mint_2022::ALL_EXTENSIONS, Rpc}; use light_test_utils::{ @@ -108,16 +108,16 @@ pub async fn set_ctoken_withheld_fee( account_pubkey: Pubkey, withheld_amount: u64, ) -> Result<(), RpcError> { - use light_ctoken_interface::state::{ExtensionStruct, TransferFeeAccountExtension}; + use light_token_interface::state::{ExtensionStruct, TransferFeeAccountExtension}; let mut account_info = rpc .get_account(account_pubkey) .await? .ok_or_else(|| RpcError::CustomError("Account not found".to_string()))?; - // Deserialize CToken to find and modify TransferFeeAccount extension - let mut ctoken = CToken::deserialize(&mut &account_info.data[..]) - .map_err(|e| RpcError::CustomError(format!("Failed to deserialize CToken: {:?}", e)))?; + // Deserialize Token to find and modify TransferFeeAccount extension + let mut ctoken = Token::deserialize(&mut &account_info.data[..]) + .map_err(|e| RpcError::CustomError(format!("Failed to deserialize Token: {:?}", e)))?; // Find and update TransferFeeAccount extension let mut found = false; @@ -133,15 +133,15 @@ pub async fn set_ctoken_withheld_fee( if !found { return Err(RpcError::CustomError( - "TransferFeeAccount extension not found in CToken".to_string(), + "TransferFeeAccount extension not found in Token".to_string(), )); } - // Serialize the modified CToken back + // Serialize the modified Token back use borsh::BorshSerialize; let serialized = ctoken .try_to_vec() - .map_err(|e| RpcError::CustomError(format!("Failed to serialize CToken: {:?}", e)))?; + .map_err(|e| RpcError::CustomError(format!("Failed to serialize Token: {:?}", e)))?; // Update account data account_info.data = serialized; @@ -154,7 +154,7 @@ pub async fn run_compress_and_close_extension_test( config: CompressAndCloseTestConfig, ) -> Result<(), RpcError> { use light_client::indexer::Indexer; - use light_ctoken_interface::{ + use light_token_interface::{ instructions::extensions::{ CompressedOnlyExtensionInstructionData, ExtensionInstructionData, }, @@ -446,8 +446,8 @@ pub async fn run_compress_and_close_extension_test( .await? .ok_or_else(|| RpcError::CustomError("Dest account not found".to_string()))?; - let dest_ctoken = CToken::deserialize(&mut &dest_account_data.data[..]) - .map_err(|e| RpcError::CustomError(format!("Failed to deserialize CToken: {:?}", e)))?; + let dest_ctoken = Token::deserialize(&mut &dest_account_data.data[..]) + .map_err(|e| RpcError::CustomError(format!("Failed to deserialize Token: {:?}", e)))?; // Verify state matches config let expected_ctoken_state = if config.is_frozen { diff --git a/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs b/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs index 8493602baa..b5aa3e2f4c 100644 --- a/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs +++ b/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs @@ -4,7 +4,7 @@ //! when the mint has restricted extensions (Pausable, PermanentDelegate, TransferFeeConfig, //! TransferHook, DefaultAccountState). -use light_ctoken_interface::state::TokenDataVersion; +use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; use light_program_test::{ program_test::LightProgramTest, utils::assert::assert_rpc_error, ProgramTestConfig, Rpc, diff --git a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs index a5dea0aaf5..379e367b0b 100644 --- a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs +++ b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs @@ -5,10 +5,10 @@ use borsh::BorshDeserialize; use light_client::indexer::Indexer; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, state::{ - CToken, CompressedOnlyExtension, CompressedTokenAccountState, ExtensionStruct, TokenData, + Token, CompressedOnlyExtension, CompressedTokenAccountState, ExtensionStruct, TokenData, TokenDataVersion, }, }; @@ -105,7 +105,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError // Verify the withheld_amount was set correctly let account_before = rpc.get_account(ctoken_account).await?.unwrap(); - let ctoken_before = CToken::deserialize(&mut &account_before.data[..]) + let ctoken_before = Token::deserialize(&mut &account_before.data[..]) .map_err(|e| RpcError::CustomError(format!("Failed to deserialize CToken: {:?}", e)))?; let withheld_before = ctoken_before @@ -242,7 +242,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError .await? .ok_or_else(|| RpcError::CustomError("Dest account not found".to_string()))?; - let dest_ctoken = CToken::deserialize(&mut &dest_account_data.data[..]) + let dest_ctoken = Token::deserialize(&mut &dest_account_data.data[..]) .map_err(|e| RpcError::CustomError(format!("Failed to deserialize CToken: {:?}", e)))?; let withheld_after = dest_ctoken diff --git a/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs b/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs index 9d6f9f5ff3..cc2b8fcde2 100644 --- a/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs +++ b/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs @@ -163,7 +163,7 @@ async fn test_approve_fails() { 100, Some(1), // max_top_up too low "max_topup_exceeded", - 18043, // CTokenError::MaxTopUpExceeded + 18043, // TokenError::MaxTopUpExceeded ) .await; } @@ -329,7 +329,7 @@ async fn test_revoke_fails() { &owner, Some(1), // max_top_up too low "max_topup_exceeded", - 18043, // CTokenError::MaxTopUpExceeded + 18043, // TokenError::MaxTopUpExceeded ) .await; } @@ -340,7 +340,7 @@ async fn test_revoke_fails() { // ============================================================================ use anchor_lang::AnchorDeserialize; -use light_ctoken_interface::state::{CToken, TokenDataVersion}; +use light_token_interface::state::{Token, TokenDataVersion}; use light_ctoken_sdk::ctoken::{ApproveCToken, CreateCTokenAccount, RevokeCToken}; use light_program_test::program_test::TestRpc; use light_test_utils::RpcError; @@ -417,7 +417,7 @@ async fn test_approve_revoke_compressible() -> Result<(), RpcError> { // Verify initial state let account_data_initial = context.rpc.get_account(account_pubkey).await?.unwrap(); - let ctoken_initial = CToken::deserialize(&mut &account_data_initial.data[..]) + let ctoken_initial = Token::deserialize(&mut &account_data_initial.data[..]) .expect("Failed to deserialize CToken"); assert_eq!(ctoken_initial.amount, token_balance); assert!(ctoken_initial.delegate.is_none()); diff --git a/program-tests/compressed-token-test/tests/ctoken/close.rs b/program-tests/compressed-token-test/tests/ctoken/close.rs index 5849c18eae..21f83b2bb1 100644 --- a/program-tests/compressed-token-test/tests/ctoken/close.rs +++ b/program-tests/compressed-token-test/tests/ctoken/close.rs @@ -171,7 +171,7 @@ async fn test_close_token_account_fails() { rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: context.payer.pubkey(), }; @@ -188,9 +188,9 @@ async fn test_close_token_account_fails() { .unwrap(); // Deserialize, modify amount, serialize back - use light_ctoken_interface::state::ctoken::CToken; + use light_token_interface::state::token::Token; use light_zero_copy::traits::ZeroCopyAtMut; - let (mut ctoken, _) = CToken::zero_copy_at_mut(&mut account.data).unwrap(); + let (mut ctoken, _) = Token::zero_copy_at_mut(&mut account.data).unwrap(); ctoken.amount.set(1u64); drop(ctoken); @@ -224,7 +224,7 @@ async fn test_close_token_account_fails() { rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: context.payer.pubkey(), }; @@ -241,10 +241,10 @@ async fn test_close_token_account_fails() { .unwrap(); // Deserialize, modify state to Uninitialized, serialize back - use light_ctoken_interface::state::ctoken::CToken; + use light_token_interface::state::token::Token; use light_zero_copy::traits::ZeroCopyAtMut; use spl_token_2022::state::AccountState; - let (mut ctoken, _) = CToken::zero_copy_at_mut(&mut account.data).unwrap(); + let (mut ctoken, _) = Token::zero_copy_at_mut(&mut account.data).unwrap(); ctoken.state = AccountState::Uninitialized as u8; drop(ctoken); @@ -264,12 +264,12 @@ async fn test_close_token_account_fails() { &owner_keypair, rent_sponsor, "uninitialized_account", - 18036, // CTokenError::InvalidAccountState + 18036, // TokenError::InvalidAccountState ) .await; } - // Test 11: Frozen account → Error 18036 (CTokenError::InvalidAccountState) + // Test 11: Frozen account → Error 18036 (TokenError::InvalidAccountState) { // Create a fresh account for this test context.token_account_keypair = Keypair::new(); @@ -278,7 +278,7 @@ async fn test_close_token_account_fails() { rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: context.payer.pubkey(), }; @@ -294,10 +294,10 @@ async fn test_close_token_account_fails() { .unwrap(); // Deserialize, modify state to Frozen, serialize back - use light_ctoken_interface::state::ctoken::CToken; + use light_token_interface::state::token::Token; use light_zero_copy::traits::ZeroCopyAtMut; use spl_token_2022::state::AccountState; - let (mut ctoken, _) = CToken::zero_copy_at_mut(&mut account.data).unwrap(); + let (mut ctoken, _) = Token::zero_copy_at_mut(&mut account.data).unwrap(); ctoken.state = AccountState::Frozen as u8; drop(ctoken); @@ -317,7 +317,7 @@ async fn test_close_token_account_fails() { &owner_keypair, rent_sponsor, "frozen_account", - 18036, // CTokenError::InvalidAccountState (frozen accounts rejected by zero_copy_at_mut_checked) + 18036, // TokenError::InvalidAccountState (frozen accounts rejected by zero_copy_at_mut_checked) ) .await; } diff --git a/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs b/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs index 837f4f279d..81f21773cb 100644 --- a/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs +++ b/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs @@ -149,7 +149,7 @@ async fn test_compress_and_close_owner_scenarios() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -244,12 +244,12 @@ async fn test_compress_and_close_rent_authority_scenarios() { let token_account_pubkey = context.token_account_keypair.pubkey(); // Calculate compressible account size - use light_ctoken_interface::state::{ - calculate_ctoken_account_size, CompressibleExtensionConfig, CompressionInfoConfig, + use light_token_interface::state::{ + calculate_token_account_size, CompressibleExtensionConfig, CompressionInfoConfig, ExtensionStructConfig, }; let compressible_account_size = - calculate_ctoken_account_size(Some(&[ExtensionStructConfig::Compressible( + calculate_token_account_size(Some(&[ExtensionStructConfig::Compressible( CompressibleExtensionConfig { info: CompressionInfoConfig { rent_config: () }, }, @@ -443,10 +443,10 @@ async fn test_compress_and_close_compress_to_pubkey() { .unwrap() .unwrap(); - use light_ctoken_interface::state::ctoken::CToken; + use light_token_interface::state::token::Token; // Parse the CToken account - let (mut ctoken, _) = CToken::zero_copy_at_mut(&mut token_account.data) + let (mut ctoken, _) = Token::zero_copy_at_mut(&mut token_account.data) .expect("Failed to deserialize ctoken account"); // Modify compress_to_pubkey in the Compressible extension @@ -513,12 +513,12 @@ async fn test_compressible_account_with_custom_rent_payer_close_with_compression let token_account_pubkey = context.token_account_keypair.pubkey(); // Calculate expected size for account with Compressible extension - use light_ctoken_interface::state::{ - calculate_ctoken_account_size, CompressibleExtensionConfig, CompressionInfoConfig, + use light_token_interface::state::{ + calculate_token_account_size, CompressibleExtensionConfig, CompressionInfoConfig, ExtensionStructConfig, }; let compressible_account_size = - calculate_ctoken_account_size(Some(&[ExtensionStructConfig::Compressible( + calculate_token_account_size(Some(&[ExtensionStructConfig::Compressible( CompressibleExtensionConfig { info: CompressionInfoConfig { rent_config: () }, }, @@ -542,7 +542,7 @@ async fn test_compressible_account_with_custom_rent_payer_close_with_compression pre_pay_num_epochs: num_prepaid_epochs, lamports_per_write, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -586,7 +586,7 @@ async fn test_compressible_account_with_custom_rent_payer_close_with_compression num_prepaid_epochs, lamports_per_write, compress_to_pubkey: false, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, payer: payer_pubkey, }), None, @@ -793,10 +793,10 @@ async fn test_compress_and_close_output_validation_errors() { .unwrap() .unwrap(); - use light_ctoken_interface::state::ctoken::CToken; + use light_token_interface::state::token::Token; // Parse and modify the CToken account - let (mut ctoken, _) = CToken::zero_copy_at_mut(&mut token_account.data) + let (mut ctoken, _) = Token::zero_copy_at_mut(&mut token_account.data) .expect("Failed to deserialize ctoken account"); // Set compress_to_pubkey=true in the Compressible extension diff --git a/program-tests/compressed-token-test/tests/ctoken/create.rs b/program-tests/compressed-token-test/tests/ctoken/create.rs index 6082cead8e..aa17d802c7 100644 --- a/program-tests/compressed-token-test/tests/ctoken/create.rs +++ b/program-tests/compressed-token-test/tests/ctoken/create.rs @@ -17,7 +17,7 @@ async fn test_create_compressible_token_account_instruction() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -34,7 +34,7 @@ async fn test_create_compressible_token_account_instruction() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -51,7 +51,7 @@ async fn test_create_compressible_token_account_instruction() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 10, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -68,7 +68,7 @@ async fn test_create_compressible_token_account_instruction() { rent_sponsor: payer_pubkey, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -82,7 +82,7 @@ async fn test_create_compressible_token_account_instruction() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -98,7 +98,7 @@ async fn test_create_compressible_token_account_instruction() { rent_sponsor: payer_pubkey, // Use payer as rent sponsor for large epoch payment num_prepaid_epochs: 255, // Maximum u8 value lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -115,7 +115,7 @@ async fn test_create_compressible_token_account_instruction() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(max_top_up), // Exactly at limit (should succeed) - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -135,7 +135,7 @@ async fn test_create_compressible_token_account_instruction() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(0), // Zero (should succeed) - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -181,7 +181,7 @@ async fn test_create_account_random() { } else { None }, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, // Only V3 supported + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, // Only V3 supported compress_to_pubkey: false, // Can only be tested with cpi payer: payer_pubkey, }; @@ -218,7 +218,7 @@ async fn test_create_compressible_token_account_failing() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 1, // Forbidden value lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -258,7 +258,7 @@ async fn test_create_compressible_token_account_failing() { pre_pay_num_epochs: 10, // High number to require more lamports lamports_per_write: Some(1000), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -293,9 +293,9 @@ async fn test_create_compressible_token_account_failing() { // Test 3: Invalid PDA seeds for compress_to_account_pubkey // When compress_to_account_pubkey is provided, the seeds must derive to the token account. // Providing invalid seeds should fail the PDA validation. - // Error: 18002 (InvalidAccountData from CTokenError) + // Error: 18002 (InvalidAccountData from TokenError) { - use light_ctoken_interface::instructions::extensions::CompressToPubkey; + use light_token_interface::instructions::extensions::CompressToPubkey; context.token_account_keypair = Keypair::new(); let token_account_pubkey = context.token_account_keypair.pubkey(); @@ -313,7 +313,7 @@ async fn test_create_compressible_token_account_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: Some(invalid_compress_to_pubkey), - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -336,7 +336,7 @@ async fn test_create_compressible_token_account_failing() { ) .await; - // Should fail with InvalidAccountData (18002) from CTokenError + // Should fail with InvalidAccountData (18002) from TokenError light_program_test::utils::assert::assert_rpc_error(result, 0, 18002).unwrap(); } @@ -364,7 +364,7 @@ async fn test_create_compressible_token_account_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -394,7 +394,7 @@ async fn test_create_compressible_token_account_failing() { // Test 7: write_top_up exceeds max_top_up from RentConfig // Accounts cannot be created with lamports_per_write > max_top_up. // This protects against griefing attacks where recipient creates account with excessive top-up. - // Error: 18042 (WriteTopUpExceedsMaximum from CTokenError) + // Error: 18042 (WriteTopUpExceedsMaximum from TokenError) { context.token_account_keypair = Keypair::new(); @@ -406,7 +406,7 @@ async fn test_create_compressible_token_account_failing() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(excessive_lamports_per_write), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -415,7 +415,7 @@ async fn test_create_compressible_token_account_failing() { &mut context, compressible_data, "write_top_up_exceeds_max_top_up", - 18042, // WriteTopUpExceedsMaximum from CTokenError + 18042, // WriteTopUpExceedsMaximum from TokenError ) .await; } @@ -436,7 +436,7 @@ async fn test_create_compressible_token_account_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -480,7 +480,7 @@ async fn test_create_compressible_token_account_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -624,7 +624,7 @@ async fn test_create_compressible_token_account_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, // Required for restricted extensions }; @@ -667,7 +667,7 @@ async fn test_create_compressible_token_account_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::V1, // Not supported! + token_account_version: light_token_interface::state::TokenDataVersion::V1, // Not supported! compression_only: false, }; diff --git a/program-tests/compressed-token-test/tests/ctoken/create_ata.rs b/program-tests/compressed-token-test/tests/ctoken/create_ata.rs index 256d4eafe8..2cfd5caf72 100644 --- a/program-tests/compressed-token-test/tests/ctoken/create_ata.rs +++ b/program-tests/compressed-token-test/tests/ctoken/create_ata.rs @@ -14,7 +14,7 @@ async fn test_create_compressible_ata() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -38,7 +38,7 @@ async fn test_create_compressible_ata() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -62,7 +62,7 @@ async fn test_create_compressible_ata() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 10, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -86,7 +86,7 @@ async fn test_create_compressible_ata() { rent_sponsor: payer_pubkey, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -110,7 +110,7 @@ async fn test_create_compressible_ata() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -134,7 +134,7 @@ async fn test_create_compressible_ata() { rent_sponsor: payer_pubkey, // Use payer as rent sponsor for large epoch payment num_prepaid_epochs: 255, // Maximum u8 value lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -164,7 +164,7 @@ async fn test_create_compressible_ata() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -209,7 +209,7 @@ async fn test_create_ata_idempotent() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -241,12 +241,12 @@ async fn test_create_ata_idempotent() { let account = context.rpc.get_account(ata_pubkey).await.unwrap().unwrap(); // Calculate expected size for account with Compressible extension - use light_ctoken_interface::state::{ - calculate_ctoken_account_size, CompressibleExtensionConfig, CompressionInfoConfig, + use light_token_interface::state::{ + calculate_token_account_size, CompressibleExtensionConfig, CompressionInfoConfig, ExtensionStructConfig, }; let expected_size = - calculate_ctoken_account_size(Some(&[ExtensionStructConfig::Compressible( + calculate_token_account_size(Some(&[ExtensionStructConfig::Compressible( CompressibleExtensionConfig { info: CompressionInfoConfig { rent_config: () }, }, @@ -277,7 +277,7 @@ async fn test_create_non_compressible_ata() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -308,7 +308,7 @@ async fn test_create_ata_failing() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 1, // Forbidden value lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -335,7 +335,7 @@ async fn test_create_ata_failing() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -384,7 +384,7 @@ async fn test_create_ata_failing() { pre_pay_num_epochs: 10, // High number to require more lamports lamports_per_write: Some(1000), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -411,7 +411,7 @@ async fn test_create_ata_failing() { // Error: 2 (InvalidInstructionData) { use anchor_lang::prelude::borsh::BorshSerialize; - use light_ctoken_interface::instructions::{ + use light_token_interface::instructions::{ create_associated_token_account::CreateAssociatedTokenAccountInstructionData, extensions::{CompressToPubkey, CompressibleExtensionInstructionData}, }; @@ -432,7 +432,7 @@ async fn test_create_ata_failing() { let instruction_data = CreateAssociatedTokenAccountInstructionData { bump, compressible_config: Some(CompressibleExtensionInstructionData { - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat as u8, rent_payment: 2, compression_only: 1, // ATAs always compression_only @@ -482,7 +482,7 @@ async fn test_create_ata_failing() { // Error: 21 (ProgramFailedToComplete - provided seeds do not result in valid address) { use anchor_lang::prelude::borsh::BorshSerialize; - use light_ctoken_interface::instructions::{ + use light_token_interface::instructions::{ create_associated_token_account::CreateAssociatedTokenAccountInstructionData, extensions::CompressibleExtensionInstructionData, }; @@ -504,7 +504,7 @@ async fn test_create_ata_failing() { let instruction_data = CreateAssociatedTokenAccountInstructionData { bump: wrong_bump, // Wrong bump! compressible_config: Some(CompressibleExtensionInstructionData { - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat as u8, rent_payment: 2, compression_only: 1, // ATAs always compression_only @@ -573,7 +573,7 @@ async fn test_create_ata_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -598,7 +598,7 @@ async fn test_create_ata_failing() { // Test 7: write_top_up exceeds max_top_up from RentConfig // Accounts cannot be created with lamports_per_write > max_top_up. // This protects against griefing attacks where recipient creates account with excessive top-up. - // Error: 18042 (WriteTopUpExceedsMaximum from CTokenError) + // Error: 18042 (WriteTopUpExceedsMaximum from TokenError) { // Use different mint for this test context.mint_pubkey = solana_sdk::pubkey::Pubkey::new_unique(); @@ -611,7 +611,7 @@ async fn test_create_ata_failing() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(excessive_lamports_per_write), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -621,7 +621,7 @@ async fn test_create_ata_failing() { Some(compressible_data), false, // Non-idempotent "write_top_up_exceeds_max_top_up", - 18042, // WriteTopUpExceedsMaximum from CTokenError + 18042, // WriteTopUpExceedsMaximum from TokenError ) .await; } @@ -643,7 +643,7 @@ async fn test_create_ata_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -682,7 +682,7 @@ async fn test_create_ata_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -713,7 +713,7 @@ async fn test_create_ata_failing() { // Error: 19 (PrivilegeEscalation - CPI tries to sign for wrong address) { use anchor_lang::prelude::borsh::BorshSerialize; - use light_ctoken_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; + use light_token_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; use solana_sdk::instruction::Instruction; // Use different mint for this test @@ -778,7 +778,7 @@ async fn test_create_ata_failing() { // Error: 6115 (MissingCompressibleConfig) { use anchor_lang::prelude::borsh::BorshSerialize; - use light_ctoken_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; + use light_token_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; use light_test_utils::mint_2022::create_mint_22_with_extension_types; use solana_sdk::instruction::Instruction; use spl_token_2022::extension::ExtensionType; @@ -874,7 +874,7 @@ async fn test_create_ata_failing() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, // Required for restricted extensions }; @@ -914,7 +914,7 @@ async fn test_ata_multiple_mints_same_owner() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -983,7 +983,7 @@ async fn test_ata_multiple_owners_same_mint() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -995,7 +995,7 @@ async fn test_ata_multiple_owners_same_mint() { pre_pay_num_epochs: 2, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -1138,7 +1138,7 @@ async fn test_create_ata_random() { } else { None }, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, // Only V3 supported + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, // Only V3 supported compress_to_pubkey: false, // Cannot be used with ATAs payer: payer_pubkey, }; diff --git a/program-tests/compressed-token-test/tests/ctoken/create_ata2.rs b/program-tests/compressed-token-test/tests/ctoken/create_ata2.rs index 092d4c96ab..236f85cd5f 100644 --- a/program-tests/compressed-token-test/tests/ctoken/create_ata2.rs +++ b/program-tests/compressed-token-test/tests/ctoken/create_ata2.rs @@ -81,7 +81,7 @@ async fn test_create_ata2_basic() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -104,7 +104,7 @@ async fn test_create_ata2_basic() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -128,7 +128,7 @@ async fn test_create_ata2_idempotent() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 2, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -157,12 +157,12 @@ async fn test_create_ata2_idempotent() { let account = context.rpc.get_account(ata_pubkey).await.unwrap().unwrap(); // Calculate expected size for account with Compressible extension - use light_ctoken_interface::state::{ - calculate_ctoken_account_size, CompressibleExtensionConfig, CompressionInfoConfig, + use light_token_interface::state::{ + calculate_token_account_size, CompressibleExtensionConfig, CompressionInfoConfig, ExtensionStructConfig, }; let expected_size = - calculate_ctoken_account_size(Some(&[ExtensionStructConfig::Compressible( + calculate_token_account_size(Some(&[ExtensionStructConfig::Compressible( CompressibleExtensionConfig { info: CompressionInfoConfig { rent_config: () }, }, diff --git a/program-tests/compressed-token-test/tests/ctoken/extensions.rs b/program-tests/compressed-token-test/tests/ctoken/extensions.rs index b4c6ef3f24..d2bbedee93 100644 --- a/program-tests/compressed-token-test/tests/ctoken/extensions.rs +++ b/program-tests/compressed-token-test/tests/ctoken/extensions.rs @@ -3,7 +3,7 @@ //! This module tests the creation and verification of Token 2022 mints //! with all supported extensions. -use light_ctoken_interface::state::{ +use light_token_interface::state::{ ExtensionStruct, PausableAccountExtension, PermanentDelegateAccountExtension, TransferFeeAccountExtension, TransferHookAccountExtension, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; @@ -79,7 +79,7 @@ async fn test_setup_mint_22_with_all_extensions() { #[tokio::test] #[serial] async fn test_mint_and_compress_with_extensions() { - use light_ctoken_interface::state::TokenDataVersion; + use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::{ ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, spl_interface::find_spl_interface_pda_with_index, @@ -199,7 +199,7 @@ async fn test_mint_and_compress_with_extensions() { #[tokio::test] #[serial] async fn test_create_ctoken_with_extensions() { - use light_ctoken_interface::state::TokenDataVersion; + use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; use light_test_utils::assert_create_token_account::{ assert_create_token_account, CompressibleData, @@ -284,7 +284,7 @@ async fn test_create_ctoken_with_extensions() { async fn test_transfer_with_permanent_delegate() { use anchor_lang::prelude::AccountMeta; use anchor_spl::token_2022::spl_token_2022; - use light_ctoken_interface::state::TokenDataVersion; + use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::{ ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, spl_interface::find_spl_interface_pda_with_index, @@ -485,7 +485,7 @@ async fn test_transfer_with_owner_authority() { use anchor_lang::prelude::AccountMeta; use anchor_spl::token_2022::spl_token_2022; use borsh::BorshDeserialize; - use light_ctoken_interface::state::{AccountState, CToken, TokenDataVersion}; + use light_token_interface::state::{AccountState, Token, TokenDataVersion}; use light_ctoken_sdk::{ ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, spl_interface::find_spl_interface_pda_with_index, @@ -698,12 +698,12 @@ async fn test_transfer_with_owner_authority() { ); // Deserialize and verify TransferFeeAccount extension on both accounts - let ctoken_a = CToken::deserialize(&mut &account_a.data[..]).unwrap(); - let ctoken_b = CToken::deserialize(&mut &account_b.data[..]).unwrap(); + let ctoken_a = Token::deserialize(&mut &account_a.data[..]).unwrap(); + let ctoken_b = Token::deserialize(&mut &account_b.data[..]).unwrap(); - // Build expected CToken accounts + // Build expected Token accounts // Compression fields are now in the Compressible extension - let expected_ctoken_a = CToken { + let expected_token_a = Token { mint: mint_pubkey.to_bytes().into(), owner: owner.pubkey().to_bytes().into(), amount: mint_amount - transfer_amount, @@ -716,7 +716,7 @@ async fn test_transfer_with_owner_authority() { extensions: ctoken_a.extensions.clone(), }; - let expected_ctoken_b = CToken { + let expected_token_b = Token { mint: mint_pubkey.to_bytes().into(), owner: owner.pubkey().to_bytes().into(), amount: transfer_amount, @@ -730,11 +730,11 @@ async fn test_transfer_with_owner_authority() { }; assert_eq!( - ctoken_a, expected_ctoken_a, + ctoken_a, expected_token_a, "Account A should match expected with withheld_amount=0" ); assert_eq!( - ctoken_b, expected_ctoken_b, + ctoken_b, expected_token_b, "Account B should match expected with withheld_amount=0" ); diff --git a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs b/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs index 24c03dbdb7..2d392a92af 100644 --- a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs +++ b/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs @@ -8,7 +8,7 @@ //! in compress_only/invalid_extension_state.rs. It succeeds with invalid extension //! state because it exits compressed state without creating new compressed accounts. -use light_ctoken_interface::state::TokenDataVersion; +use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::{ ctoken::{CompressibleParams, CreateCTokenAccount, TransferCTokenChecked, TransferSplToCtoken}, spl_interface::find_spl_interface_pda_with_index, diff --git a/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs b/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs index f0c717f046..e7e018ae2b 100644 --- a/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs +++ b/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs @@ -4,7 +4,7 @@ //! for both basic mints and Token-2022 mints with extensions. use anchor_lang::AnchorDeserialize; -use light_ctoken_interface::state::{AccountState, CToken, TokenDataVersion}; +use light_token_interface::state::{AccountState, Token, TokenDataVersion}; use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount, FreezeCToken, ThawCToken}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{ @@ -66,7 +66,7 @@ async fn test_freeze_thaw_with_basic_mint() -> Result<(), RpcError> { // Verify initial state is Initialized let account_data = rpc.get_account(token_account_pubkey).await?.unwrap(); let ctoken_before = - CToken::deserialize(&mut &account_data.data[..]).expect("Failed to deserialize CToken"); + Token::deserialize(&mut &account_data.data[..]).expect("Failed to deserialize CToken"); assert_eq!( ctoken_before.state, AccountState::Initialized, @@ -161,7 +161,7 @@ async fn test_freeze_thaw_with_extensions() -> Result<(), RpcError> { ); // Deserialize and verify initial state - let ctoken_initial = CToken::deserialize(&mut &account_data_initial.data[..]) + let ctoken_initial = Token::deserialize(&mut &account_data_initial.data[..]) .expect("Failed to deserialize CToken"); assert_eq!( ctoken_initial.state, diff --git a/program-tests/compressed-token-test/tests/ctoken/functional.rs b/program-tests/compressed-token-test/tests/ctoken/functional.rs index 80d65f04d4..35bed84705 100644 --- a/program-tests/compressed-token-test/tests/ctoken/functional.rs +++ b/program-tests/compressed-token-test/tests/ctoken/functional.rs @@ -18,7 +18,7 @@ async fn test_spl_sdk_compatible_account_lifecycle() -> Result<(), RpcError> { pre_pay_num_epochs: 0, lamports_per_write: None, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -51,7 +51,7 @@ async fn test_spl_sdk_compatible_account_lifecycle() -> Result<(), RpcError> { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -123,12 +123,12 @@ async fn test_compressible_account_with_compression_authority_lifecycle() { .lamports; // Calculate expected size for account with Compressible extension - use light_ctoken_interface::state::{ - calculate_ctoken_account_size, CompressibleExtensionConfig, CompressionInfoConfig, + use light_token_interface::state::{ + calculate_token_account_size, CompressibleExtensionConfig, CompressionInfoConfig, ExtensionStructConfig, }; let compressible_account_size = - calculate_ctoken_account_size(Some(&[ExtensionStructConfig::Compressible( + calculate_token_account_size(Some(&[ExtensionStructConfig::Compressible( CompressibleExtensionConfig { info: CompressionInfoConfig { rent_config: () }, }, @@ -152,7 +152,7 @@ async fn test_compressible_account_with_compression_authority_lifecycle() { pre_pay_num_epochs: num_prepaid_epochs, lamports_per_write, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -202,7 +202,7 @@ async fn test_compressible_account_with_compression_authority_lifecycle() { num_prepaid_epochs, lamports_per_write, compress_to_pubkey: false, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, payer: payer_pubkey, }), None, diff --git a/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs b/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs index 90f55cd6d2..49203ee490 100644 --- a/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs +++ b/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs @@ -26,7 +26,7 @@ async fn test_associated_token_account_operations() { pre_pay_num_epochs: 0, lamports_per_write: None, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -49,7 +49,7 @@ async fn test_associated_token_account_operations() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -76,7 +76,7 @@ async fn test_associated_token_account_operations() { pre_pay_num_epochs: num_prepaid_epochs, lamports_per_write, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -110,7 +110,7 @@ async fn test_associated_token_account_operations() { num_prepaid_epochs, // Use actual balance with rent lamports_per_write, compress_to_pubkey: false, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, payer: payer_pubkey, }), None, @@ -177,7 +177,7 @@ async fn test_create_ata_idempotent() { pre_pay_num_epochs: 0, lamports_per_write: None, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -199,7 +199,7 @@ async fn test_create_ata_idempotent() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -253,7 +253,7 @@ async fn test_create_ata_idempotent() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }), @@ -305,7 +305,7 @@ async fn test_create_ata_with_prefunded_lamports() { pre_pay_num_epochs: 0, lamports_per_write: None, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -337,7 +337,7 @@ async fn test_create_ata_with_prefunded_lamports() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 0, lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }), @@ -397,7 +397,7 @@ async fn test_create_token_account_with_prefunded_lamports() { pre_pay_num_epochs: 0, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, // Must be false for non-restricted mints (non-ATA accounts) }; @@ -433,7 +433,7 @@ async fn test_create_token_account_with_prefunded_lamports() { num_prepaid_epochs: 0, lamports_per_write: Some(100), compress_to_pubkey: false, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, payer: payer_pubkey, }), None, diff --git a/program-tests/compressed-token-test/tests/ctoken/shared.rs b/program-tests/compressed-token-test/tests/ctoken/shared.rs index 0136629e3e..082a445e55 100644 --- a/program-tests/compressed-token-test/tests/ctoken/shared.rs +++ b/program-tests/compressed-token-test/tests/ctoken/shared.rs @@ -199,7 +199,7 @@ pub async fn setup_account_test_with_created_account( rent_sponsor, num_prepaid_epochs: epochs, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: context.payer.pubkey(), }; @@ -228,7 +228,7 @@ pub async fn create_non_compressible_token_account( pre_pay_num_epochs: 0, lamports_per_write: None, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -259,7 +259,7 @@ pub async fn create_non_compressible_token_account( num_prepaid_epochs: 0, lamports_per_write: None, compress_to_pubkey: false, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, payer: payer_pubkey, }; assert_create_token_account( @@ -293,10 +293,10 @@ pub async fn close_and_assert_token_account( .unwrap(); // Read rent_sponsor from the account's Compressible extension - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; - let (ctoken, _) = CToken::zero_copy_at(&account_info.data).unwrap(); + let (ctoken, _) = Token::zero_copy_at(&account_info.data).unwrap(); let compressible = ctoken .get_compressible_extension() .expect("CToken should have Compressible extension"); @@ -656,7 +656,7 @@ pub async fn compress_and_close_forester_with_invalid_output( use anchor_lang::{InstructionData, ToAccountMetas}; use light_compressible::config::CompressibleConfig; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; use light_registry::{ accounts::CompressAndCloseContext as CompressAndCloseAccounts, instruction::CompressAndClose, utils::get_forester_epoch_pda_from_authority, @@ -694,7 +694,7 @@ pub async fn compress_and_close_forester_with_invalid_output( .unwrap() .unwrap(); - let (ctoken, _) = CToken::zero_copy_at(&token_account_info.data).unwrap(); + let (ctoken, _) = Token::zero_copy_at(&token_account_info.data).unwrap(); let mint_pubkey = Pubkey::from(ctoken.mint.to_bytes()); // Extract compression info from Compressible extension diff --git a/program-tests/compressed-token-test/tests/ctoken/transfer.rs b/program-tests/compressed-token-test/tests/ctoken/transfer.rs index bf58bb89ee..bac0cd44cf 100644 --- a/program-tests/compressed-token-test/tests/ctoken/transfer.rs +++ b/program-tests/compressed-token-test/tests/ctoken/transfer.rs @@ -37,7 +37,7 @@ async fn setup_transfer_test( rent_sponsor, num_prepaid_epochs: source_epochs, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -53,7 +53,7 @@ async fn setup_transfer_test( rent_sponsor, num_prepaid_epochs: dest_epochs, lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -343,7 +343,7 @@ async fn test_ctoken_transfer_frozen_source() { let owner_keypair = context.owner_keypair.insecure_clone(); // Try to transfer from frozen account - // Expected error: CTokenError::InvalidAccountState (frozen accounts rejected by zero_copy_at_mut_checked) + // Expected error: TokenError::InvalidAccountState (frozen accounts rejected by zero_copy_at_mut_checked) transfer_and_assert_fails( &mut context, source, @@ -351,7 +351,7 @@ async fn test_ctoken_transfer_frozen_source() { 500, &owner_keypair, "frozen_source_transfer", - 18036, // CTokenError::InvalidAccountState + 18036, // TokenError::InvalidAccountState ) .await; } @@ -371,7 +371,7 @@ async fn test_ctoken_transfer_frozen_destination() { let owner_keypair = context.owner_keypair.insecure_clone(); // Try to transfer to frozen account - // Expected error: CTokenError::InvalidAccountState (frozen accounts rejected by zero_copy_at_mut_checked) + // Expected error: TokenError::InvalidAccountState (frozen accounts rejected by zero_copy_at_mut_checked) transfer_and_assert_fails( &mut context, source, @@ -379,7 +379,7 @@ async fn test_ctoken_transfer_frozen_destination() { 500, &owner_keypair, "frozen_destination_transfer", - 18036, // CTokenError::InvalidAccountState + 18036, // TokenError::InvalidAccountState ) .await; } @@ -478,7 +478,7 @@ async fn test_ctoken_transfer_mixed_compressible_non_compressible() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 5, // More epochs with higher lamports_per_write lamports_per_write: Some(100), - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -494,7 +494,7 @@ async fn test_ctoken_transfer_mixed_compressible_non_compressible() { rent_sponsor: context.rent_sponsor, num_prepaid_epochs: 3, // Standard 3 epochs sufficient for no top-up lamports_per_write: None, - account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compress_to_pubkey: false, payer: payer_pubkey, }; @@ -613,7 +613,7 @@ async fn setup_transfer_checked_test_with_spl_mint( pre_pay_num_epochs: source_epochs, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -647,7 +647,7 @@ async fn setup_transfer_checked_test_with_spl_mint( pre_pay_num_epochs: dest_epochs, lamports_per_write: Some(100), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; @@ -887,7 +887,7 @@ async fn test_ctoken_transfer_checked_wrong_mint() { 9, &owner_keypair, "wrong_mint_transfer_checked", - 18002, // CTokenError::MintMismatch + 18002, // TokenError::MintMismatch ) .await; } diff --git a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs b/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs index 056f74853a..1a5cf50270 100644 --- a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs +++ b/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs @@ -4,7 +4,7 @@ //! TransferFee, TransferHook) cannot use CTokenTransfer and must use CTokenTransferChecked. use anchor_spl::token_2022::spl_token_2022; -use light_ctoken_interface::state::TokenDataVersion; +use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::{ ctoken::{ CompressibleParams, CreateCTokenAccount, TransferCToken, TransferCTokenChecked, diff --git a/program-tests/compressed-token-test/tests/freeze/compress_only.rs b/program-tests/compressed-token-test/tests/freeze/compress_only.rs index ae818aae1e..6e5be329eb 100644 --- a/program-tests/compressed-token-test/tests/freeze/compress_only.rs +++ b/program-tests/compressed-token-test/tests/freeze/compress_only.rs @@ -7,7 +7,7 @@ use light_client::indexer::{CompressedTokenAccount, Indexer}; use light_compressed_token::freeze::sdk::{ create_instruction, CreateInstructionInputs as FreezeInputs, }; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, state::TokenDataVersion, }; @@ -405,15 +405,15 @@ async fn run_freeze_thaw_compressed_only_test( .create_and_send_transaction(&[decompress_ix], &payer.pubkey(), &[&payer, &owner]) .await?; - // 14. Verify CToken account has tokens + // 14. Verify Token account has tokens use borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let dest_account = context .rpc .get_account(dest_account_keypair.pubkey()) .await? .unwrap(); - let dest_ctoken = CToken::deserialize(&mut &dest_account.data[..]).unwrap(); + let dest_ctoken = Token::deserialize(&mut &dest_account.data[..]).unwrap(); assert_eq!( dest_ctoken.amount, mint_amount, "Decompressed amount should match" diff --git a/program-tests/compressed-token-test/tests/freeze/functional.rs b/program-tests/compressed-token-test/tests/freeze/functional.rs index 7ee5cf632b..6ae6be2b35 100644 --- a/program-tests/compressed-token-test/tests/freeze/functional.rs +++ b/program-tests/compressed-token-test/tests/freeze/functional.rs @@ -7,7 +7,7 @@ use light_client::indexer::{CompressedTokenAccount, Indexer}; use light_compressed_token::freeze::sdk::{ create_instruction, CreateInstructionInputs as FreezeInputs, }; -use light_ctoken_interface::state::TokenDataVersion; +use light_token_interface::state::TokenDataVersion; use light_ctoken_sdk::compat::{AccountState, TokenDataWithMerkleContext}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_prover_client::prover::spawn_prover; diff --git a/program-tests/compressed-token-test/tests/mint/burn.rs b/program-tests/compressed-token-test/tests/mint/burn.rs index d00e4be8f0..1f946ac144 100644 --- a/program-tests/compressed-token-test/tests/mint/burn.rs +++ b/program-tests/compressed-token-test/tests/mint/burn.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::instructions::mint_action::Recipient; +use light_token_interface::instructions::mint_action::Recipient; use light_ctoken_sdk::{ compressed_token::create_compressed_mint::find_cmint_address, ctoken::{derive_ctoken_ata, BurnCToken, CreateAssociatedCTokenAccount}, @@ -139,14 +139,14 @@ async fn test_ctoken_burn() { // Verify final balance is 0 use anchor_lang::prelude::borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let ctoken_after = ctx .rpc .get_account(ctx.ctoken_account) .await .unwrap() .unwrap(); - let token_account: CToken = + let token_account: Token = BorshDeserialize::deserialize(&mut ctoken_after.data.as_slice()).unwrap(); assert_eq!( token_account.amount, 0, diff --git a/program-tests/compressed-token-test/tests/mint/cpi_context.rs b/program-tests/compressed-token-test/tests/mint/cpi_context.rs index 90c2e4eebb..e90d30d7f4 100644 --- a/program-tests/compressed-token-test/tests/mint/cpi_context.rs +++ b/program-tests/compressed-token-test/tests/mint/cpi_context.rs @@ -2,13 +2,13 @@ use anchor_lang::InstructionData; use compressed_token_test::ID as WRAPPER_PROGRAM_ID; use light_client::indexer::Indexer; use light_compressed_account::instruction_data::traits::LightInstructionData; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{ CompressedMintInstructionData, CompressedMintWithContext, CpiContext, DecompressMintAction, - MintActionCompressedInstructionData, MintToCTokenAction, + MintActionCompressedInstructionData, MintToTokenAction, }, state::CompressedMintMetadata, - CMINT_ADDRESS_TREE, CTOKEN_PROGRAM_ID, + CMINT_ADDRESS_TREE, LIGHT_TOKEN_PROGRAM_ID, }; use light_ctoken_sdk::compressed_token::{ create_compressed_mint::{derive_cmint_compressed_address, find_cmint_address}, @@ -158,7 +158,7 @@ async fn test_write_to_cpi_context_create_mint() { // Build compressed token instruction let ctoken_instruction = Instruction { - program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data: data.clone(), }; @@ -170,7 +170,7 @@ async fn test_write_to_cpi_context_create_mint() { let wrapper_instruction = Instruction { program_id: WRAPPER_PROGRAM_ID, accounts: vec![AccountMeta::new_readonly( - Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), false, )] .into_iter() @@ -278,7 +278,7 @@ async fn test_write_to_cpi_context_invalid_address_tree() { // Build compressed token instruction let ctoken_instruction = Instruction { - program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data: data.clone(), }; @@ -290,7 +290,7 @@ async fn test_write_to_cpi_context_invalid_address_tree() { let wrapper_instruction = Instruction { program_id: WRAPPER_PROGRAM_ID, accounts: vec![AccountMeta::new_readonly( - Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), false, )] .into_iter() @@ -372,7 +372,7 @@ async fn test_write_to_cpi_context_invalid_compressed_address() { // Build compressed token instruction let ctoken_instruction = Instruction { - program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data: data.clone(), }; @@ -384,7 +384,7 @@ async fn test_write_to_cpi_context_invalid_compressed_address() { let wrapper_instruction = Instruction { program_id: WRAPPER_PROGRAM_ID, accounts: vec![AccountMeta::new_readonly( - Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), false, )] .into_iter() @@ -466,7 +466,7 @@ async fn test_execute_cpi_context_invalid_tree_index() { // Build compressed token instruction let execute_instruction = Instruction { - program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data: data.clone(), }; @@ -478,7 +478,7 @@ async fn test_execute_cpi_context_invalid_tree_index() { let execute_wrapper_instruction = Instruction { program_id: WRAPPER_PROGRAM_ID, accounts: vec![AccountMeta::new_readonly( - Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), false, )] .into_iter() @@ -558,7 +558,7 @@ async fn test_write_to_cpi_context_decompressed_mint_fails() { // Build compressed token instruction let ctoken_instruction = Instruction { - program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data: data.clone(), }; @@ -570,7 +570,7 @@ async fn test_write_to_cpi_context_decompressed_mint_fails() { let wrapper_instruction = Instruction { program_id: WRAPPER_PROGRAM_ID, accounts: vec![AccountMeta::new_readonly( - Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), false, )] .into_iter() @@ -617,7 +617,7 @@ async fn test_write_to_cpi_context_mint_to_ctoken_fails() { CompressedProof::default(), compressed_mint_inputs.mint.clone().unwrap(), ) - .with_mint_to_ctoken(MintToCTokenAction { + .with_mint_to_token(MintToTokenAction { account_index: 0, amount: 1000, }) @@ -650,7 +650,7 @@ async fn test_write_to_cpi_context_mint_to_ctoken_fails() { // Build compressed token instruction let ctoken_instruction = Instruction { - program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data: data.clone(), }; @@ -662,7 +662,7 @@ async fn test_write_to_cpi_context_mint_to_ctoken_fails() { let wrapper_instruction = Instruction { program_id: WRAPPER_PROGRAM_ID, accounts: vec![AccountMeta::new_readonly( - Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), false, )] .into_iter() @@ -743,7 +743,7 @@ async fn test_write_to_cpi_context_decompress_mint_action_fails() { // Build compressed token instruction let ctoken_instruction = Instruction { - program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data: data.clone(), }; @@ -755,7 +755,7 @@ async fn test_write_to_cpi_context_decompress_mint_action_fails() { let wrapper_instruction = Instruction { program_id: WRAPPER_PROGRAM_ID, accounts: vec![AccountMeta::new_readonly( - Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), false, )] .into_iter() diff --git a/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs b/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs index e0b9882f2f..d4546c5271 100644 --- a/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs +++ b/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs @@ -134,14 +134,14 @@ async fn test_ctoken_mint_to() { // Verify final balance is 1000 use anchor_lang::prelude::borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let ctoken_after = ctx .rpc .get_account(ctx.ctoken_account) .await .unwrap() .unwrap(); - let token_account: CToken = + let token_account: Token = BorshDeserialize::deserialize(&mut ctoken_after.data.as_slice()).unwrap(); assert_eq!( token_account.amount, 1000, @@ -183,14 +183,14 @@ async fn test_ctoken_mint_to_checked_success() { // Verify balance use anchor_lang::prelude::borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let ctoken_after = ctx .rpc .get_account(ctx.ctoken_account) .await .unwrap() .unwrap(); - let token_account: CToken = + let token_account: Token = BorshDeserialize::deserialize(&mut ctoken_after.data.as_slice()).unwrap(); assert_eq!(token_account.amount, 500, "Balance should be 500"); diff --git a/program-tests/compressed-token-test/tests/mint/edge_cases.rs b/program-tests/compressed-token-test/tests/mint/edge_cases.rs index 961a1a5d72..cb58e4d3c2 100644 --- a/program-tests/compressed-token-test/tests/mint/edge_cases.rs +++ b/program-tests/compressed-token-test/tests/mint/edge_cases.rs @@ -1,6 +1,6 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::indexer::Indexer; -use light_ctoken_interface::state::{ +use light_token_interface::state::{ extensions::AdditionalMetadata, CompressedMint, TokenDataVersion, }; use light_ctoken_sdk::{ @@ -58,7 +58,7 @@ async fn functional_all_in_one_instruction() { 8, // decimals &authority, Some(authority.pubkey()), - Some(light_ctoken_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { + Some(light_token_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { update_authority: Some(authority.pubkey().into()), name: "Test Token".as_bytes().to_vec(), symbol: "TEST".as_bytes().to_vec(), @@ -106,7 +106,7 @@ async fn functional_all_in_one_instruction() { 8, authority.pubkey(), authority.pubkey(), - Some(light_ctoken_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { + Some(light_token_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { update_authority: Some(authority.pubkey().into()), name: "Test Token".as_bytes().to_vec(), symbol: "TEST".as_bytes().to_vec(), diff --git a/program-tests/compressed-token-test/tests/mint/failing.rs b/program-tests/compressed-token-test/tests/mint/failing.rs index d4fdf2d5a7..0dc6bdd64b 100644 --- a/program-tests/compressed-token-test/tests/mint/failing.rs +++ b/program-tests/compressed-token-test/tests/mint/failing.rs @@ -2,7 +2,7 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::indexer::Indexer; -use light_ctoken_interface::state::{extensions::AdditionalMetadata, CompressedMint}; +use light_token_interface::state::{extensions::AdditionalMetadata, CompressedMint}; use light_ctoken_sdk::{ compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, @@ -72,7 +72,7 @@ async fn functional_and_failing_tests() { 8, // decimals &mint_authority, Some(freeze_authority.pubkey()), - Some(light_ctoken_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { + Some(light_token_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { update_authority: Some(metadata_authority.pubkey().into()), name: "Test Token".as_bytes().to_vec(), symbol: "TEST".as_bytes().to_vec(), @@ -102,7 +102,7 @@ async fn functional_and_failing_tests() { 8, mint_authority.pubkey(), freeze_authority.pubkey(), - Some(light_ctoken_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { + Some(light_token_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { update_authority: Some(metadata_authority.pubkey().into()), name: "Test Token".as_bytes().to_vec(), symbol: "TEST".as_bytes().to_vec(), @@ -124,7 +124,7 @@ async fn functional_and_failing_tests() { 8, // decimals &mint_authority, Some(freeze_authority.pubkey()), - Some(light_ctoken_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { + Some(light_token_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { update_authority: Some(metadata_authority.pubkey().into()), name: "Test Token".as_bytes().to_vec(), symbol: "TEST".as_bytes().to_vec(), @@ -149,7 +149,7 @@ async fn functional_and_failing_tests() { .await; assert_rpc_error( - result, 0, 18040, // CTokenError::DuplicateMetadataKey = 18040 + result, 0, 18040, // TokenError::DuplicateMetadataKey = 18040 ) .unwrap(); } @@ -192,12 +192,12 @@ async fn functional_and_failing_tests() { &mut rpc, spl_mint_pda, vec![ - light_ctoken_interface::instructions::mint_action::Recipient::new( + light_token_interface::instructions::mint_action::Recipient::new( Keypair::new().pubkey(), 1000u64, ), ], - light_ctoken_interface::state::TokenDataVersion::V2, + light_token_interface::state::TokenDataVersion::V2, &invalid_mint_authority, // Invalid authority &payer, ) @@ -230,11 +230,11 @@ async fn functional_and_failing_tests() { &mut rpc, spl_mint_pda, vec![ - light_ctoken_interface::instructions::mint_action::Recipient::new( + light_token_interface::instructions::mint_action::Recipient::new( recipient, 1000u64, ), ], - light_ctoken_interface::state::TokenDataVersion::V2, + light_token_interface::state::TokenDataVersion::V2, &mint_authority, // Valid authority &payer, ) @@ -252,7 +252,7 @@ async fn functional_and_failing_tests() { recipient, amount: 1000u64, }], - token_account_version: light_ctoken_interface::state::TokenDataVersion::V2 as u8, + token_account_version: light_token_interface::state::TokenDataVersion::V2 as u8, }], ) .await; @@ -424,7 +424,7 @@ async fn functional_and_failing_tests() { false, // compress_and_close_cmint vec![], // No compressed recipients vec![ - light_ctoken_interface::instructions::mint_action::Recipient::new( + light_token_interface::instructions::mint_action::Recipient::new( recipient.pubkey(), 1000u64, ), @@ -482,7 +482,7 @@ async fn functional_and_failing_tests() { false, // compress_and_close_cmint vec![], // No compressed recipients vec![ - light_ctoken_interface::instructions::mint_action::Recipient::new( + light_token_interface::instructions::mint_action::Recipient::new( recipient2.pubkey(), 2000u64, ), @@ -813,12 +813,12 @@ async fn functional_and_failing_tests() { #[serial] async fn test_mint_to_ctoken_max_top_up_exceeded() { use light_compressed_account::instruction_data::traits::LightInstructionData; - use light_ctoken_interface::{ + use light_token_interface::{ instructions::mint_action::{ - CompressedMintWithContext, MintActionCompressedInstructionData, MintToCTokenAction, + CompressedMintWithContext, MintActionCompressedInstructionData, MintToTokenAction, }, state::TokenDataVersion, - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, }; use light_ctoken_sdk::compressed_token::{ create_compressed_mint::derive_cmint_compressed_address, mint_action::MintActionMetaConfig, @@ -897,7 +897,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { .value .unwrap(); - let compressed_mint: light_ctoken_interface::state::CompressedMint = + let compressed_mint: light_token_interface::state::CompressedMint = BorshDeserialize::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) .unwrap(); @@ -922,7 +922,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { // Build instruction data with max_top_up = 1 (too low to cover rent top-up) let instruction_data = MintActionCompressedInstructionData::new(compressed_mint_inputs, rpc_proof_result.proof.0) - .with_mint_to_ctoken(MintToCTokenAction { + .with_mint_to_token(MintToTokenAction { account_index: 0, amount: 1000u64, }) @@ -945,7 +945,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { // Build final instruction let ix = Instruction { - program_id: CTOKEN_PROGRAM_ID.into(), + program_id: LIGHT_TOKEN_PROGRAM_ID.into(), accounts: account_metas, data, }; @@ -956,7 +956,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { .await; assert_rpc_error( - result, 0, 18043, // CTokenError::MaxTopUpExceeded = 18043 + result, 0, 18043, // TokenError::MaxTopUpExceeded = 18043 ) .unwrap(); } diff --git a/program-tests/compressed-token-test/tests/mint/functional.rs b/program-tests/compressed-token-test/tests/mint/functional.rs index a7da7c01c8..53a0840c4f 100644 --- a/program-tests/compressed-token-test/tests/mint/functional.rs +++ b/program-tests/compressed-token-test/tests/mint/functional.rs @@ -1,7 +1,7 @@ use anchor_lang::{prelude::borsh::BorshDeserialize, solana_program::program_pack::Pack}; use light_client::indexer::Indexer; use light_compressible::{compression_info::CompressionInfo, rent::SLOTS_PER_EPOCH}; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::token_metadata::TokenMetadataInstructionData, mint_action::Recipient, }, @@ -627,7 +627,7 @@ async fn test_update_compressed_mint_authority() { // Note: We need to get fresh account info after the updates let updated_compressed_accounts = rpc .get_compressed_accounts_by_owner( - &Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + &Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), None, None, ) @@ -700,7 +700,7 @@ async fn test_ctoken_transfer() { pre_pay_num_epochs: 10, lamports_per_write: Some(1000), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -1195,7 +1195,7 @@ async fn test_mint_actions() { supply: 0, mint_authority: mint_authority.pubkey(), freeze_authority: Some(freeze_authority.pubkey()), - metadata: Some(light_ctoken_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { + metadata: Some(light_token_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { update_authority: Some(mint_authority.pubkey().into()), name: "Test Token".as_bytes().to_vec(), symbol: "TEST".as_bytes().to_vec(), @@ -1234,8 +1234,8 @@ async fn test_mint_actions() { account_type: ACCOUNT_TYPE_MINT, compression: CompressionInfo::default(), extensions: Some(vec![ - light_ctoken_interface::state::extensions::ExtensionStruct::TokenMetadata( - light_ctoken_interface::state::extensions::TokenMetadata { + light_token_interface::state::extensions::ExtensionStruct::TokenMetadata( + light_token_interface::state::extensions::TokenMetadata { update_authority: mint_authority.pubkey().into(), // Original authority in metadata mint: spl_mint_pda.into(), name: "Test Token".as_bytes().to_vec(), diff --git a/program-tests/compressed-token-test/tests/mint/random.rs b/program-tests/compressed-token-test/tests/mint/random.rs index c5b84509cf..6b22343ec4 100644 --- a/program-tests/compressed-token-test/tests/mint/random.rs +++ b/program-tests/compressed-token-test/tests/mint/random.rs @@ -1,7 +1,7 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_batched_merkle_tree::initialize_state_tree::InitStateTreeAccountsInstructionData; use light_client::indexer::Indexer; -use light_ctoken_interface::state::{extensions::AdditionalMetadata, CompressedMint}; +use light_token_interface::state::{extensions::AdditionalMetadata, CompressedMint}; use light_ctoken_sdk::{ compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, @@ -84,7 +84,7 @@ async fn test_random_mint_action() { 8, // decimals &authority, Some(authority.pubkey()), - Some(light_ctoken_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { + Some(light_token_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { update_authority: Some(authority.pubkey().into()), name: "Test Token".as_bytes().to_vec(), symbol: "TEST".as_bytes().to_vec(), @@ -111,7 +111,7 @@ async fn test_random_mint_action() { 8, authority.pubkey(), authority.pubkey(), - Some(light_ctoken_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { + Some(light_token_interface::instructions::extensions::token_metadata::TokenMetadataInstructionData { update_authority: Some(authority.pubkey().into()), name: "Test Token".as_bytes().to_vec(), symbol: "TEST".as_bytes().to_vec(), diff --git a/program-tests/compressed-token-test/tests/token_pool.rs b/program-tests/compressed-token-test/tests/token_pool.rs index 2e969ffbf7..fd65411630 100644 --- a/program-tests/compressed-token-test/tests/token_pool.rs +++ b/program-tests/compressed-token-test/tests/token_pool.rs @@ -11,7 +11,7 @@ use light_compressed_token::{ mint_sdk::create_create_token_pool_instruction, process_transfer::get_cpi_authority_pda, spl_compression::check_spl_token_pool_derivation_with_index, ErrorCode, }; -use light_ctoken_interface::{ +use light_token_interface::{ find_spl_interface_pda, find_spl_interface_pda_with_index, has_restricted_extensions, }; use light_ctoken_sdk::spl_interface::CreateSplInterfacePda; diff --git a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs index 8eb610f273..f02bc53fea 100644 --- a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs @@ -35,8 +35,8 @@ // 1. create and mint to one ctoken compressed account // -use light_ctoken_interface::{ - instructions::mint_action::Recipient, state::TokenDataVersion, CTokenError, +use light_token_interface::{ + instructions::mint_action::Recipient, state::TokenDataVersion, TokenError, }; use light_ctoken_sdk::{ compressed_token::{ @@ -223,7 +223,7 @@ fn create_compression_inputs( // Compress tokens from CToken ATA compression_account - .compress_ctoken(compress_amount, ctoken_ata_index, authority_index) + .compress_token(compress_amount, ctoken_ata_index, authority_index) .map_err(|e| RpcError::AssertRpcError(format!("Failed to compress: {:?}", e)))?; // Get account metas from PackedAccounts @@ -455,7 +455,7 @@ async fn test_compression_invalid_mint() -> Result<(), RpcError> { .await; // Should fail with InvalidAccountData - mint mismatch detected during CToken account validation - assert_rpc_error(result, 0, CTokenError::MintMismatch.into()).unwrap(); + assert_rpc_error(result, 0, TokenError::MintMismatch.into()).unwrap(); Ok(()) } @@ -672,7 +672,7 @@ async fn test_compression_max_top_up_exceeded() -> Result<(), RpcError> { let mut compression_account = CTokenAccount2::new_empty(recipient_index, mint_index); compression_account - .compress_ctoken(token_amount, ctoken_ata_index, authority_index) + .compress_token(token_amount, ctoken_ata_index, authority_index) .map_err(|e| RpcError::AssertRpcError(format!("Failed to compress: {:?}", e)))?; let (account_metas, _, _) = packed_accounts.to_account_metas(); diff --git a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs index a093e9912c..5f003bc7f8 100644 --- a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs @@ -32,7 +32,7 @@ // use light_client::indexer::{CompressedTokenAccount, Indexer}; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{mint_action::Recipient, transfer2::MultiInputTokenDataWithContext}, state::TokenDataVersion, }; @@ -253,7 +253,7 @@ async fn create_decompression_inputs( // Add decompression token_account - .decompress_ctoken(decompress_amount, ctoken_ata_index) + .decompress_token(decompress_amount, ctoken_ata_index) .map_err(|e| RpcError::AssertRpcError(format!("Failed to decompress: {:?}", e)))?; // Get account metas diff --git a/program-tests/compressed-token-test/tests/transfer2/functional.rs b/program-tests/compressed-token-test/tests/transfer2/functional.rs index 174b1f4090..7587cb10f1 100644 --- a/program-tests/compressed-token-test/tests/transfer2/functional.rs +++ b/program-tests/compressed-token-test/tests/transfer2/functional.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::state::TokenDataVersion; +use light_token_interface::state::TokenDataVersion; use serial_test::serial; use crate::transfer2::shared::{ diff --git a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs index 8f6683fd1a..cb6e0f565f 100644 --- a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs @@ -43,7 +43,7 @@ // // ============================================================================ -use light_ctoken_interface::instructions::{mint_action::Recipient, transfer2::Compression}; +use light_token_interface::instructions::{mint_action::Recipient, transfer2::Compression}; use light_ctoken_sdk::{ compressed_token::create_compressed_mint::find_cmint_address, ctoken::{derive_ctoken_ata, CreateAssociatedCTokenAccount}, @@ -196,7 +196,7 @@ fn create_compressions_and_packed_accounts( // Create compressions let mut compressions = Vec::new(); if compress_amount > 0 { - compressions.push(Compression::compress_ctoken( + compressions.push(Compression::compress_token( compress_amount, mint_index, source_ata_index, @@ -204,7 +204,7 @@ fn create_compressions_and_packed_accounts( )); } if decompress_amount > 0 { - compressions.push(Compression::decompress_ctoken( + compressions.push(Compression::decompress_token( decompress_amount, mint_index, recipient_ata_index, @@ -225,11 +225,11 @@ fn create_compressions_and_packed_accounts( /// without any compressed-to-compressed token transfers. fn build_compressions_only_instruction( fee_payer: Pubkey, - compressions: Option>, + compressions: Option>, packed_account_metas: Vec, ) -> Result { use anchor_lang::AnchorSerialize; - use light_ctoken_interface::{ + use light_token_interface::{ instructions::transfer2::CompressedTokenInstructionDataTransfer2, CPI_AUTHORITY, TRANSFER2, }; use solana_sdk::instruction::AccountMeta; @@ -274,7 +274,7 @@ fn build_compressions_only_instruction( data.extend(serialized); Ok(solana_sdk::instruction::Instruction { - program_id: light_ctoken_interface::CTOKEN_PROGRAM_ID.into(), + program_id: light_token_interface::LIGHT_TOKEN_PROGRAM_ID.into(), accounts: account_metas, data, }) @@ -533,8 +533,8 @@ async fn test_invalid_authority_compress() { let recipient_ata_index = packed_accounts.insert_or_get_config(recipient_ata, false, true); let compressions = vec![ - Compression::compress_ctoken(500, mint_index, source_ata_index, wrong_authority_index), - Compression::decompress_ctoken(500, mint_index, recipient_ata_index), + Compression::compress_token(500, mint_index, source_ata_index, wrong_authority_index), + Compression::decompress_token(500, mint_index, recipient_ata_index), ]; let (account_metas, _, _) = packed_accounts.to_account_metas(); @@ -574,8 +574,8 @@ async fn test_authority_not_signer_compress() { let recipient_ata_index = packed_accounts.insert_or_get_config(recipient_ata, false, true); let compressions = vec![ - Compression::compress_ctoken(500, mint_index, source_ata_index, owner_index), - Compression::decompress_ctoken(500, mint_index, recipient_ata_index), + Compression::compress_token(500, mint_index, source_ata_index, owner_index), + Compression::decompress_token(500, mint_index, recipient_ata_index), ]; let (account_metas, _, _) = packed_accounts.to_account_metas(); @@ -651,11 +651,11 @@ async fn test_decompress_with_nonzero_authority() { // Create compress with valid authority using helper let compress_compression = - Compression::compress_ctoken(500, mint_index, source_ata_index, owner_index); + Compression::compress_token(500, mint_index, source_ata_index, owner_index); // Create decompress but manually set authority to non-zero (should be 0) let mut decompress_compression = - Compression::decompress_ctoken(500, mint_index, recipient_ata_index); + Compression::decompress_token(500, mint_index, recipient_ata_index); decompress_compression.authority = owner_index; // Invalid: should be 0 for decompress let compressions = vec![compress_compression, decompress_compression]; @@ -779,13 +779,13 @@ async fn test_too_many_mints() { let source_index = packed_accounts.insert_or_get_config(context.source_ata, false, true); let recipient_index = packed_accounts.insert_or_get_config(context.recipient_ata, false, true); - compressions.push(Compression::compress_ctoken( + compressions.push(Compression::compress_token( 100, mint_index, source_index, owner_index, )); - compressions.push(Compression::decompress_ctoken( + compressions.push(Compression::decompress_token( 100, mint_index, recipient_index, @@ -797,13 +797,13 @@ async fn test_too_many_mints() { let source_index = packed_accounts.insert_or_get_config(*source_ata, false, true); let recipient_index = packed_accounts.insert_or_get_config(*recipient_ata, false, true); - compressions.push(Compression::compress_ctoken( + compressions.push(Compression::compress_token( 100, mint_index, source_index, owner_index, )); - compressions.push(Compression::decompress_ctoken( + compressions.push(Compression::decompress_token( 100, mint_index, recipient_index, @@ -857,19 +857,19 @@ async fn test_duplicate_mint_validation() { // Create compression and decompress for first mint index (balanced) let mut compressions = vec![ - Compression::compress_ctoken(500, mint_index_1, source_index, owner_index), - Compression::decompress_ctoken(500, mint_index_1, recipient_index), + Compression::compress_token(500, mint_index_1, source_index, owner_index), + Compression::decompress_token(500, mint_index_1, recipient_index), ]; // Create compression and decompress for second mint index (balanced) // This is the duplicate - same pubkey as mint_index_1 but different index - compressions.push(Compression::compress_ctoken( + compressions.push(Compression::compress_token( 1, mint_index_2, source_index, owner_index, )); - compressions.push(Compression::decompress_ctoken( + compressions.push(Compression::decompress_token( 1, mint_index_2, recipient_index, @@ -916,8 +916,8 @@ async fn test_mint_index_out_of_bounds() { let invalid_mint_index = 99u8; let compressions = vec![ - Compression::compress_ctoken(500, invalid_mint_index, source_index, owner_index), - Compression::decompress_ctoken(500, invalid_mint_index, recipient_index), + Compression::compress_token(500, invalid_mint_index, source_index, owner_index), + Compression::decompress_token(500, invalid_mint_index, recipient_index), ]; // Build instruction @@ -960,8 +960,8 @@ async fn test_account_index_out_of_bounds() { let invalid_account_index = 99u8; let compressions = vec![ - Compression::compress_ctoken(500, mint_index, invalid_account_index, owner_index), - Compression::decompress_ctoken(500, mint_index, invalid_account_index), + Compression::compress_token(500, mint_index, invalid_account_index, owner_index), + Compression::decompress_token(500, mint_index, invalid_account_index), ]; // Build instruction @@ -1006,8 +1006,8 @@ async fn test_authority_index_out_of_bounds() { let invalid_authority_index = 99u8; let compressions = vec![ - Compression::compress_ctoken(500, mint_index, source_index, invalid_authority_index), - Compression::decompress_ctoken(500, mint_index, recipient_index), + Compression::compress_token(500, mint_index, source_index, invalid_authority_index), + Compression::decompress_token(500, mint_index, recipient_index), ]; // Build instruction diff --git a/program-tests/compressed-token-test/tests/transfer2/random.rs b/program-tests/compressed-token-test/tests/transfer2/random.rs index bcff8d8a42..6269d39f1d 100644 --- a/program-tests/compressed-token-test/tests/transfer2/random.rs +++ b/program-tests/compressed-token-test/tests/transfer2/random.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::state::TokenDataVersion; +use light_token_interface::state::TokenDataVersion; use rand::{ rngs::{StdRng, ThreadRng}, Rng, RngCore, SeedableRng, diff --git a/program-tests/compressed-token-test/tests/transfer2/shared.rs b/program-tests/compressed-token-test/tests/transfer2/shared.rs index c0db5e38a5..f4203a3846 100644 --- a/program-tests/compressed-token-test/tests/transfer2/shared.rs +++ b/program-tests/compressed-token-test/tests/transfer2/shared.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use anchor_lang::AnchorDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{mint_action::Recipient, transfer2::CompressedTokenInstructionDataTransfer2}, state::TokenDataVersion, }; diff --git a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs index aa4c54b078..2bffda8ade 100644 --- a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs +++ b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs @@ -1,7 +1,7 @@ use anchor_lang::prelude::{AccountMeta, ProgramError}; // Re-export all necessary imports for test modules pub use anchor_spl::token_2022::spl_token_2022; -use light_ctoken_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; +use light_token_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; pub use light_ctoken_sdk::ctoken::{ derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount, }; @@ -356,7 +356,7 @@ impl CtokenToSplTransferAndClose { let compress_to_pool = CTokenAccount2 { inputs: vec![], output: MultiTokenTransferOutputData::default(), - compression: Some(Compression::compress_and_close_ctoken( + compression: Some(Compression::compress_and_close_token( self.amount, 0, // mint index 1, // source ctoken account index diff --git a/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs b/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs index 640da866c5..8a3cc5ae56 100644 --- a/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs @@ -5,7 +5,7 @@ // ============================================================================ use light_client::indexer::{CompressedTokenAccount, Indexer}; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{mint_action::Recipient, transfer2::MultiInputTokenDataWithContext}, state::TokenDataVersion, }; diff --git a/program-tests/registry-test/Cargo.toml b/program-tests/registry-test/Cargo.toml index 0afeb5f9d5..cd94fdd881 100644 --- a/program-tests/registry-test/Cargo.toml +++ b/program-tests/registry-test/Cargo.toml @@ -40,6 +40,6 @@ light-account-checks = { workspace = true } light-ctoken-sdk = { workspace = true } light-compressible = { workspace = true } light-token-client = { workspace = true } -light-ctoken-interface = { workspace = true } +light-token-interface = { workspace = true } light-zero-copy = { workspace = true } borsh = { workspace = true } diff --git a/program-tests/registry-test/tests/compressible.rs b/program-tests/registry-test/tests/compressible.rs index 0d76abdf14..75b80528da 100644 --- a/program-tests/registry-test/tests/compressible.rs +++ b/program-tests/registry-test/tests/compressible.rs @@ -7,10 +7,10 @@ use light_compressible::{ compression_info::CompressionInfo, config::CompressibleConfig, error::CompressibleError, rent::SLOTS_PER_EPOCH, }; -use light_ctoken_interface::state::{extensions::ExtensionStruct, CToken}; +use light_token_interface::state::{extensions::ExtensionStruct, Token}; -/// Extract CompressionInfo from CToken's Compressible extension -fn get_ctoken_compression_info(ctoken: &CToken) -> Option { +/// Extract CompressionInfo from Token's Compressible extension +fn get_ctoken_compression_info(ctoken: &Token) -> Option { ctoken .extensions .as_ref()? @@ -129,7 +129,7 @@ async fn test_claim_rent_for_completed_epochs() -> Result<(), RpcError> { payer: &payer, token_account_keypair: None, lamports_per_write, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, }, ) .await @@ -188,7 +188,7 @@ async fn test_claim_multiple_accounts_different_epochs() { payer: &payer, token_account_keypair: None, lamports_per_write: Some(100), - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, }, ) .await @@ -665,7 +665,7 @@ async fn test_unpause_compressible_config_with_valid_authority() -> Result<(), R pre_pay_num_epochs: 2, lamports_per_write: None, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -755,7 +755,7 @@ async fn test_deprecate_compressible_config_with_valid_authority() -> Result<(), pre_pay_num_epochs: 10, lamports_per_write: None, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -803,7 +803,7 @@ async fn test_deprecate_compressible_config_with_valid_authority() -> Result<(), pre_pay_num_epochs: 2, lamports_per_write: None, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -1130,12 +1130,12 @@ async fn assert_not_compressible( .get_minimum_balance_for_rent_exemption(account.data.len()) .await?; - let ctoken = CToken::deserialize(&mut account.data.as_slice()) - .map_err(|e| RpcError::AssertRpcError(format!("Failed to deserialize CToken: {:?}", e)))?; + let ctoken = Token::deserialize(&mut account.data.as_slice()) + .map_err(|e| RpcError::AssertRpcError(format!("Failed to deserialize Token: {:?}", e)))?; // Get CompressionInfo from the Compressible extension let compression_info = get_ctoken_compression_info(&ctoken).ok_or_else(|| { - RpcError::AssertRpcError("CToken should have Compressible extension".to_string()) + RpcError::AssertRpcError("Token should have Compressible extension".to_string()) })?; let current_slot = rpc.get_slot().await?; @@ -1182,7 +1182,7 @@ async fn assert_not_compressible_cmint( name: &str, ) -> Result<(), RpcError> { use borsh::BorshDeserialize; - use light_ctoken_interface::state::CompressedMint; + use light_token_interface::state::CompressedMint; let account = rpc .get_account(account_pubkey) @@ -1331,7 +1331,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { payer: &payer, token_account_keypair: None, lamports_per_write: Some(400), - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, }, ) .await @@ -1347,7 +1347,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { payer: &payer, token_account_keypair: None, lamports_per_write: Some(400), - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, }, ) .await @@ -1366,12 +1366,12 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { .await?; let account_a_data = rpc.get_account(account_a).await?.unwrap(); - let ctoken_a = CToken::deserialize(&mut account_a_data.data.as_slice()) - .map_err(|e| RpcError::AssertRpcError(format!("Failed to deserialize CToken: {:?}", e)))?; + let ctoken_a = Token::deserialize(&mut account_a_data.data.as_slice()) + .map_err(|e| RpcError::AssertRpcError(format!("Failed to deserialize Token: {:?}", e)))?; // CompressionInfo is accessed via the Compressible extension let compression = - get_ctoken_compression_info(&ctoken_a).expect("CToken should have Compressible extension"); + get_ctoken_compression_info(&ctoken_a).expect("Token should have Compressible extension"); let rent_config = compression.rent_config; let account_size = account_a_data.data.len() as u64; @@ -1388,18 +1388,18 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { let initial_slot = rpc.get_slot().await?; let get_last_claimed_slot_ctoken = |account_data: &[u8]| -> Result { - let ctoken = CToken::deserialize(&mut &account_data[..]).map_err(|e| { - RpcError::AssertRpcError(format!("Failed to deserialize CToken: {:?}", e)) + let ctoken = Token::deserialize(&mut &account_data[..]).map_err(|e| { + RpcError::AssertRpcError(format!("Failed to deserialize Token: {:?}", e)) })?; let compression = get_ctoken_compression_info(&ctoken).ok_or_else(|| { - RpcError::AssertRpcError("CToken should have Compressible extension".to_string()) + RpcError::AssertRpcError("Token should have Compressible extension".to_string()) })?; Ok(compression.last_claimed_slot) }; let get_last_claimed_slot_cmint = |account_data: &[u8]| -> Result { use borsh::BorshDeserialize; - use light_ctoken_interface::state::CompressedMint; + use light_token_interface::state::CompressedMint; let cmint = CompressedMint::deserialize(&mut &account_data[..]).map_err(|e| { RpcError::AssertRpcError(format!("Failed to deserialize CMint: {:?}", e)) })?; @@ -1416,7 +1416,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { // Get CMint size and rent config for final verification let cmint_account = rpc.get_account(cmint_pda).await?.unwrap(); let cmint_size = cmint_account.data.len() as u64; - let cmint_data = light_ctoken_interface::state::CompressedMint::deserialize( + let cmint_data = light_token_interface::state::CompressedMint::deserialize( &mut cmint_account.data.as_slice(), ) .map_err(|e| RpcError::AssertRpcError(format!("Failed to deserialize CMint: {:?}", e)))?; @@ -1611,7 +1611,7 @@ async fn test_claim_mixed_ctoken_and_cmint() -> Result<(), RpcError> { payer: &payer, token_account_keypair: None, lamports_per_write: Some(100), - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, }, ) .await diff --git a/program-tests/utils/Cargo.toml b/program-tests/utils/Cargo.toml index 224583e94b..311508882a 100644 --- a/program-tests/utils/Cargo.toml +++ b/program-tests/utils/Cargo.toml @@ -22,7 +22,7 @@ solana-system-interface = { workspace = true } thiserror = { workspace = true } account-compression = { workspace = true, features = ["cpi"] } light-compressed-token = { workspace = true, features = ["cpi"] } -light-ctoken-interface = { workspace = true, features = ["test-only"] } +light-token-interface = { workspace = true, features = ["test-only"] } light-system-program-anchor = { workspace = true, features = ["cpi"] } light-registry = { workspace = true, features = ["cpi"] } spl-token = { workspace = true, features = ["no-entrypoint"] } diff --git a/program-tests/utils/src/assert_claim.rs b/program-tests/utils/src/assert_claim.rs index 016694fcbf..e5f103859f 100644 --- a/program-tests/utils/src/assert_claim.rs +++ b/program-tests/utils/src/assert_claim.rs @@ -1,6 +1,6 @@ use light_client::rpc::Rpc; -use light_ctoken_interface::state::{ - CToken, CompressedMint, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, +use light_token_interface::state::{ + Token, CompressedMint, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; use light_program_test::LightProgramTest; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyAtMut}; @@ -42,7 +42,7 @@ fn extract_pre_compression_mut( match account_type { ACCOUNT_TYPE_TOKEN_ACCOUNT => { - let (mut ctoken, _) = CToken::zero_copy_at_mut(data) + let (mut ctoken, _) = Token::zero_copy_at_mut(data) .unwrap_or_else(|e| panic!("Failed to parse ctoken account {}: {:?}", pubkey, e)); let compressible = ctoken .get_compressible_extension_mut() @@ -91,7 +91,7 @@ fn extract_post_compression(data: &[u8], pubkey: &Pubkey) -> u64 { match account_type { ACCOUNT_TYPE_TOKEN_ACCOUNT => { - let (ctoken, _) = CToken::zero_copy_at(data) + let (ctoken, _) = Token::zero_copy_at(data) .unwrap_or_else(|e| panic!("Failed to parse ctoken account {}: {:?}", pubkey, e)); let compressible = ctoken .get_compressible_extension() diff --git a/program-tests/utils/src/assert_close_token_account.rs b/program-tests/utils/src/assert_close_token_account.rs index b51e494e6d..8a2221e6df 100644 --- a/program-tests/utils/src/assert_close_token_account.rs +++ b/program-tests/utils/src/assert_close_token_account.rs @@ -1,6 +1,6 @@ use light_client::rpc::Rpc; use light_compressible::rent::AccountRentState; -use light_ctoken_interface::state::ctoken::CToken; +use light_token_interface::state::token::Token; use light_program_test::LightProgramTest; use light_zero_copy::traits::ZeroCopyAt; use solana_sdk::{pubkey::Pubkey, signer::Signer}; @@ -35,7 +35,7 @@ pub async fn assert_close_token_account( } // Parse to find destination (rent_sponsor) from compressible extension - let (compressed_token, _) = CToken::zero_copy_at(account_data_before_close) + let (compressed_token, _) = Token::zero_copy_at(account_data_before_close) .expect("Failed to deserialize compressible token account"); // Get initial authority balance from pre-transaction context diff --git a/program-tests/utils/src/assert_create_token_account.rs b/program-tests/utils/src/assert_create_token_account.rs index b6b32cc96b..e1da0539bc 100644 --- a/program-tests/utils/src/assert_create_token_account.rs +++ b/program-tests/utils/src/assert_create_token_account.rs @@ -1,8 +1,8 @@ use light_client::rpc::Rpc; use light_compressible::{compression_info::CompressionInfo, rent::RentConfig}; -use light_ctoken_interface::{ +use light_token_interface::{ state::{ - ctoken::CToken, extensions::CompressibleExtension, AccountState, ExtensionStruct, + token::Token, extensions::CompressibleExtension, AccountState, ExtensionStruct, PausableAccountExtension, PermanentDelegateAccountExtension, TransferFeeAccountExtension, TransferHookAccountExtension, ACCOUNT_TYPE_TOKEN_ACCOUNT, }, @@ -28,7 +28,7 @@ pub struct CompressibleData { pub num_prepaid_epochs: u8, pub lamports_per_write: Option, pub compress_to_pubkey: bool, - pub account_version: light_ctoken_interface::state::TokenDataVersion, + pub account_version: light_token_interface::state::TokenDataVersion, pub payer: Pubkey, } @@ -172,7 +172,7 @@ pub async fn assert_create_token_account_internal( ); // Use zero-copy deserialization for compressible account - let (actual_token_account, _) = CToken::zero_copy_at(&account_info.data) + let (actual_token_account, _) = Token::zero_copy_at(&account_info.data) .expect("Failed to deserialize compressible token account with zero-copy"); // Get current slot for validation (program sets this to current slot) @@ -221,7 +221,7 @@ pub async fn assert_create_token_account_internal( all_extensions.insert(0, ExtensionStruct::Compressible(compressible_ext)); // Create expected compressible token account with embedded compression info - let expected_token_account = CToken { + let expected_token_account = Token { mint: mint_pubkey.into(), owner: owner_pubkey.into(), amount: 0, diff --git a/program-tests/utils/src/assert_ctoken_approve_revoke.rs b/program-tests/utils/src/assert_ctoken_approve_revoke.rs index 5791215849..51002e36ed 100644 --- a/program-tests/utils/src/assert_ctoken_approve_revoke.rs +++ b/program-tests/utils/src/assert_ctoken_approve_revoke.rs @@ -6,7 +6,7 @@ use anchor_lang::AnchorDeserialize; use light_client::rpc::Rpc; -use light_ctoken_interface::state::CToken; +use light_token_interface::state::Token; use light_program_test::LightProgramTest; use solana_sdk::pubkey::Pubkey; @@ -40,12 +40,12 @@ pub async fn assert_ctoken_approve( // Parse pre and post CToken states let pre_ctoken = - CToken::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = CToken::deserialize(&mut &post_account.data[..]) + Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); + let post_ctoken = Token::deserialize(&mut &post_account.data[..]) .expect("Failed to deserialize post CToken"); // Build expected by modifying only the changed fields from pre-state - let expected_ctoken = CToken { + let expected_ctoken = Token { delegate: Some(delegate.to_bytes().into()), delegated_amount: amount, ..pre_ctoken @@ -81,12 +81,12 @@ pub async fn assert_ctoken_revoke(rpc: &mut LightProgramTest, token_account: Pub // Parse pre and post CToken states let pre_ctoken = - CToken::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = CToken::deserialize(&mut &post_account.data[..]) + Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); + let post_ctoken = Token::deserialize(&mut &post_account.data[..]) .expect("Failed to deserialize post CToken"); // Build expected by modifying only the changed fields from pre-state - let expected_ctoken = CToken { + let expected_ctoken = Token { delegate: None, delegated_amount: 0, ..pre_ctoken diff --git a/program-tests/utils/src/assert_ctoken_burn.rs b/program-tests/utils/src/assert_ctoken_burn.rs index 34539ba9ec..c6d473cf6d 100644 --- a/program-tests/utils/src/assert_ctoken_burn.rs +++ b/program-tests/utils/src/assert_ctoken_burn.rs @@ -1,12 +1,12 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::rpc::Rpc; use light_compressible::compression_info::CompressionInfo; -use light_ctoken_interface::state::{extensions::ExtensionStruct, CToken, CompressedMint}; +use light_token_interface::state::{extensions::ExtensionStruct, Token, CompressedMint}; use light_program_test::LightProgramTest; use solana_sdk::pubkey::Pubkey; /// Extract CompressionInfo from CToken's Compressible extension -fn get_ctoken_compression_info(ctoken: &CToken) -> Option { +fn get_ctoken_compression_info(ctoken: &Token) -> Option { ctoken .extensions .as_ref()? @@ -58,10 +58,10 @@ pub async fn assert_ctoken_burn( .expect("CMint account should exist after transaction"); // Parse accounts using Borsh - let ctoken_parsed_before: CToken = + let ctoken_parsed_before: Token = BorshDeserialize::deserialize(&mut ctoken_before.data.as_slice()) .expect("Failed to deserialize CToken before"); - let ctoken_parsed_after: CToken = + let ctoken_parsed_after: Token = BorshDeserialize::deserialize(&mut ctoken_after.data.as_slice()) .expect("Failed to deserialize CToken after"); let cmint_parsed_before: CompressedMint = diff --git a/program-tests/utils/src/assert_ctoken_freeze_thaw.rs b/program-tests/utils/src/assert_ctoken_freeze_thaw.rs index 016bb30436..23fbab5270 100644 --- a/program-tests/utils/src/assert_ctoken_freeze_thaw.rs +++ b/program-tests/utils/src/assert_ctoken_freeze_thaw.rs @@ -6,7 +6,7 @@ use anchor_lang::AnchorDeserialize; use light_client::rpc::Rpc; -use light_ctoken_interface::state::{AccountState, CToken}; +use light_token_interface::state::{AccountState, Token}; use light_program_test::LightProgramTest; use solana_sdk::pubkey::Pubkey; @@ -33,12 +33,12 @@ pub async fn assert_ctoken_freeze(rpc: &mut LightProgramTest, token_account: Pub // Parse pre and post CToken states let pre_ctoken = - CToken::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = CToken::deserialize(&mut &post_account.data[..]) + Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); + let post_ctoken = Token::deserialize(&mut &post_account.data[..]) .expect("Failed to deserialize post CToken"); // Build expected by modifying only the changed fields from pre-state - let expected_ctoken = CToken { + let expected_ctoken = Token { state: AccountState::Frozen, ..pre_ctoken }; @@ -72,12 +72,12 @@ pub async fn assert_ctoken_thaw(rpc: &mut LightProgramTest, token_account: Pubke // Parse pre and post CToken states let pre_ctoken = - CToken::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = CToken::deserialize(&mut &post_account.data[..]) + Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); + let post_ctoken = Token::deserialize(&mut &post_account.data[..]) .expect("Failed to deserialize post CToken"); // Build expected by modifying only the changed fields from pre-state - let expected_ctoken = CToken { + let expected_ctoken = Token { state: AccountState::Initialized, ..pre_ctoken }; diff --git a/program-tests/utils/src/assert_ctoken_mint_to.rs b/program-tests/utils/src/assert_ctoken_mint_to.rs index f2290f6cd6..6551802a75 100644 --- a/program-tests/utils/src/assert_ctoken_mint_to.rs +++ b/program-tests/utils/src/assert_ctoken_mint_to.rs @@ -1,12 +1,12 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::rpc::Rpc; use light_compressible::compression_info::CompressionInfo; -use light_ctoken_interface::state::{extensions::ExtensionStruct, CToken, CompressedMint}; +use light_token_interface::state::{extensions::ExtensionStruct, Token, CompressedMint}; use light_program_test::LightProgramTest; use solana_sdk::pubkey::Pubkey; /// Extract CompressionInfo from CToken's Compressible extension -fn get_ctoken_compression_info(ctoken: &CToken) -> Option { +fn get_ctoken_compression_info(ctoken: &Token) -> Option { ctoken .extensions .as_ref()? @@ -58,10 +58,10 @@ pub async fn assert_ctoken_mint_to( .expect("CMint account should exist after transaction"); // Parse accounts using Borsh - let ctoken_parsed_before: CToken = + let ctoken_parsed_before: Token = BorshDeserialize::deserialize(&mut ctoken_before.data.as_slice()) .expect("Failed to deserialize CToken before"); - let ctoken_parsed_after: CToken = + let ctoken_parsed_after: Token = BorshDeserialize::deserialize(&mut ctoken_after.data.as_slice()) .expect("Failed to deserialize CToken after"); let cmint_parsed_before: CompressedMint = diff --git a/program-tests/utils/src/assert_ctoken_transfer.rs b/program-tests/utils/src/assert_ctoken_transfer.rs index 03e757f67b..d1595cfbf9 100644 --- a/program-tests/utils/src/assert_ctoken_transfer.rs +++ b/program-tests/utils/src/assert_ctoken_transfer.rs @@ -1,6 +1,6 @@ use anchor_spl::token_2022::spl_token_2022::{self, solana_program::program_pack::Pack}; use light_client::rpc::Rpc; -use light_ctoken_interface::state::CToken; +use light_token_interface::state::Token; use light_program_test::LightProgramTest; use light_zero_copy::traits::ZeroCopyAt; use solana_sdk::pubkey::Pubkey; @@ -31,13 +31,13 @@ pub async fn assert_compressible_for_account( // Parse tokens let token_before = if data_before.len() > 165 { - CToken::zero_copy_at(data_before).ok() + Token::zero_copy_at(data_before).ok() } else { None }; let token_after = if data_after.len() > 165 { - CToken::zero_copy_at(data_after).ok() + Token::zero_copy_at(data_after).ok() } else { None }; diff --git a/program-tests/utils/src/assert_metadata.rs b/program-tests/utils/src/assert_metadata.rs index ce1c05d0ed..8a0366e4d8 100644 --- a/program-tests/utils/src/assert_metadata.rs +++ b/program-tests/utils/src/assert_metadata.rs @@ -3,7 +3,7 @@ use light_client::{ indexer::{CompressedAccount, Indexer}, rpc::{Rpc, RpcError}, }; -use light_ctoken_interface::state::{ +use light_token_interface::state::{ extensions::{AdditionalMetadata, ExtensionStruct, TokenMetadata}, CompressedMint, }; diff --git a/program-tests/utils/src/assert_mint_action.rs b/program-tests/utils/src/assert_mint_action.rs index 92968374b6..7435ad9c51 100644 --- a/program-tests/utils/src/assert_mint_action.rs +++ b/program-tests/utils/src/assert_mint_action.rs @@ -4,15 +4,15 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::indexer::Indexer; use light_compressed_account::compressed_account::CompressedAccountData; use light_compressible::compression_info::CompressionInfo; -use light_ctoken_interface::state::{ - extensions::AdditionalMetadata, CToken, CompressedMint, ExtensionStruct, +use light_token_interface::state::{ + extensions::AdditionalMetadata, Token, CompressedMint, ExtensionStruct, }; use light_program_test::{LightProgramTest, Rpc}; use light_token_client::instructions::mint_action::MintActionType; use solana_sdk::pubkey::Pubkey; /// Extract CompressionInfo from CToken's Compressible extension -fn get_ctoken_compression_info(ctoken: &CToken) -> Option { +fn get_ctoken_compression_info(ctoken: &Token) -> Option { ctoken .extensions .as_ref()? @@ -239,7 +239,7 @@ pub async fn assert_mint_action( .expect("CToken account should exist before minting"); // Parse pre-transaction CToken state - let mut pre_ctoken: CToken = + let mut pre_ctoken: Token = BorshDeserialize::deserialize(&mut &pre_account.data[..]).unwrap(); // Apply the total minted amount (handles multiple mints to same account) @@ -250,7 +250,7 @@ pub async fn assert_mint_action( // Get actual post-transaction account let account_data = rpc.context.get_account(&account_pubkey).unwrap(); - let post_ctoken: CToken = + let post_ctoken: Token = BorshDeserialize::deserialize(&mut &account_data.data[..]).unwrap(); // Assert token amount matches expected diff --git a/program-tests/utils/src/assert_mint_to_compressed.rs b/program-tests/utils/src/assert_mint_to_compressed.rs index bc4dca48d8..979738e8a2 100644 --- a/program-tests/utils/src/assert_mint_to_compressed.rs +++ b/program-tests/utils/src/assert_mint_to_compressed.rs @@ -5,8 +5,8 @@ use light_client::{ rpc::Rpc, }; use light_compressed_token::instructions::create_token_pool::find_token_pool_pda_with_index; -use light_ctoken_interface::{ - instructions::mint_action::Recipient, state::CompressedMint, CTOKEN_PROGRAM_ID, +use light_token_interface::{ + instructions::mint_action::Recipient, state::CompressedMint, LIGHT_TOKEN_PROGRAM_ID, }; use light_ctoken_sdk::compressed_token::create_compressed_mint::derive_cmint_from_spl_mint; use solana_sdk::{program_pack::Pack, pubkey::Pubkey}; @@ -67,7 +67,7 @@ pub async fn assert_mint_to_compressed( ); assert_eq!( matching_account.account.owner.to_bytes(), - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, "Recipient token account should have correct program owner" ); diff --git a/program-tests/utils/src/assert_transfer2.rs b/program-tests/utils/src/assert_transfer2.rs index 1bd11789de..068f41264e 100644 --- a/program-tests/utils/src/assert_transfer2.rs +++ b/program-tests/utils/src/assert_transfer2.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use anchor_spl::token_2022::spl_token_2022; use light_client::{indexer::Indexer, rpc::Rpc}; -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_program_test::LightProgramTest; use light_token_client::instructions::transfer2::{ CompressInput, DecompressInput, Transfer2InstructionType, TransferInput, @@ -108,7 +108,7 @@ pub async fn assert_transfer2_with_delegate( assert!( recipient_accounts .iter() - .any(|account| account.account.owner.to_bytes() == CTOKEN_PROGRAM_ID), + .any(|account| account.account.owner.to_bytes() == LIGHT_TOKEN_PROGRAM_ID), "Transfer change token account should match expected" ); recipient_accounts.iter().for_each(|account| { @@ -179,7 +179,7 @@ pub async fn assert_transfer2_with_delegate( ); assert_eq!( matching_change_account.account.owner.to_bytes(), - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, "Transfer change token account should match expected" ); } @@ -249,7 +249,7 @@ pub async fn assert_transfer2_with_delegate( ); assert_eq!( matching_change_account.account.owner.to_bytes(), - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, "Decompress change token account should match expected" ); } @@ -300,7 +300,7 @@ pub async fn assert_transfer2_with_delegate( ); assert_eq!( matching_change_account.account.owner.to_bytes(), - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, "Transfer change token account should match expected" ); change_accounts.iter().for_each(|account| { @@ -372,7 +372,7 @@ pub async fn assert_transfer2_with_delegate( ); assert_eq!( matching_account.account.owner.to_bytes(), - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, "Compress recipient token account should match expected" ); } @@ -387,12 +387,12 @@ pub async fn assert_transfer2_with_delegate( .expect("Failed to unpack SPL token account"); // Check if compress_to_pubkey is set in the compression info - use light_ctoken_interface::state::ctoken::CToken; + use light_token_interface::state::token::Token; use light_zero_copy::traits::ZeroCopyAt; let compress_to_pubkey = if pre_account_data.data.len() > 165 { // Parse ctoken account and get compress_to_pubkey from Compressible extension - let (ctoken, _) = CToken::zero_copy_at(&pre_account_data.data) + let (ctoken, _) = Token::zero_copy_at(&pre_account_data.data) .expect("Failed to deserialize ctoken account"); ctoken @@ -475,8 +475,8 @@ pub async fn assert_transfer2_with_delegate( let expected_tlv = if needs_tlv { Some(vec![ - light_ctoken_interface::state::ExtensionStruct::CompressedOnly( - light_ctoken_interface::state::CompressedOnlyExtension { + light_token_interface::state::ExtensionStruct::CompressedOnly( + light_token_interface::state::CompressedOnlyExtension { delegated_amount: pre_token_account.delegated_amount, withheld_transfer_fee: 0, // TODO: extract from TransferFeeAccount if present is_ata: 0, // TODO: determine based on account type @@ -506,7 +506,7 @@ pub async fn assert_transfer2_with_delegate( // Verify compressed account metadata assert_eq!( compressed_account.account.owner.to_bytes(), - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, "CompressAndClose compressed account should be owned by compressed token program" ); assert_eq!( diff --git a/program-tests/utils/src/conversions.rs b/program-tests/utils/src/conversions.rs index f4b4ccb5df..bdff8659a4 100644 --- a/program-tests/utils/src/conversions.rs +++ b/program-tests/utils/src/conversions.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::state::{CompressedTokenAccountState, TokenData as ProgramTokenData}; +use light_token_interface::state::{CompressedTokenAccountState, TokenData as ProgramTokenData}; // TODO: most of this seems to be legacy and can be replaced with into(). // pub fn sdk_to_program_merkle_context( // sdk_merkle_context: sdk::merkle_context::MerkleContext, diff --git a/program-tests/utils/src/mint_2022.rs b/program-tests/utils/src/mint_2022.rs index 0db029842c..b5ddff19e1 100644 --- a/program-tests/utils/src/mint_2022.rs +++ b/program-tests/utils/src/mint_2022.rs @@ -5,7 +5,7 @@ use forester_utils::instructions::create_account::create_account_instruction; use light_client::rpc::Rpc; -use light_ctoken_interface::RESTRICTED_EXTENSION_TYPES; +use light_token_interface::RESTRICTED_EXTENSION_TYPES; use light_ctoken_sdk::spl_interface::{find_spl_interface_pda, CreateSplInterfacePda}; use solana_sdk::{ instruction::Instruction, diff --git a/program-tests/utils/src/mint_assert.rs b/program-tests/utils/src/mint_assert.rs index b73287f159..126d787d91 100644 --- a/program-tests/utils/src/mint_assert.rs +++ b/program-tests/utils/src/mint_assert.rs @@ -1,5 +1,5 @@ use anchor_lang::prelude::borsh::BorshDeserialize; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::TokenMetadataInstructionData, state::{BaseMint, CompressedMint, CompressedMintMetadata, ExtensionStruct, ACCOUNT_TYPE_MINT}, }; @@ -20,7 +20,7 @@ pub fn assert_compressed_mint_account( // Create expected extensions if metadata is provided let expected_extensions = metadata.map(|meta| { vec![ExtensionStruct::TokenMetadata( - light_ctoken_interface::state::extensions::TokenMetadata { + light_token_interface::state::extensions::TokenMetadata { update_authority: meta .update_authority .unwrap_or_else(|| Pubkey::from([0u8; 32]).into()), diff --git a/program-tests/utils/src/spl.rs b/program-tests/utils/src/spl.rs index fbcfe0391e..5405a2cc41 100644 --- a/program-tests/utils/src/spl.rs +++ b/program-tests/utils/src/spl.rs @@ -28,7 +28,7 @@ use light_compressed_token::{ process_compress_spl_token_account::sdk::create_compress_spl_token_account_instruction, process_transfer::{transfer_sdk::create_transfer_instruction, TokenTransferOutputData}, }; -use light_ctoken_interface::state::{CompressedTokenAccountState, TokenData}; +use light_token_interface::state::{CompressedTokenAccountState, TokenData}; use light_ctoken_sdk::compat::TokenDataWithMerkleContext; use light_hasher::Poseidon; use light_program_test::{indexer::TestIndexerExtensions, program_test::TestRpc}; diff --git a/programs/compressed-token/anchor/Cargo.toml b/programs/compressed-token/anchor/Cargo.toml index 5416f5bd53..4cde7e6faa 100644 --- a/programs/compressed-token/anchor/Cargo.toml +++ b/programs/compressed-token/anchor/Cargo.toml @@ -36,7 +36,7 @@ light-compressed-account = { workspace = true, features = ["anchor"] } spl-token-2022 = { workspace = true } light-zero-copy = { workspace = true } zerocopy = { workspace = true } -light-ctoken-interface = { workspace = true, features = ["anchor"] } +light-token-interface = { workspace = true, features = ["anchor"] } pinocchio-pubkey = { workspace = true } [target.'cfg(not(target_os = "solana"))'.dependencies] diff --git a/programs/compressed-token/anchor/src/burn.rs b/programs/compressed-token/anchor/src/burn.rs index 26f55ea9ac..801e76c570 100644 --- a/programs/compressed-token/anchor/src/burn.rs +++ b/programs/compressed-token/anchor/src/burn.rs @@ -316,7 +316,7 @@ mod test { use account_compression::StateMerkleTreeAccount; use anchor_lang::{solana_program::account_info::AccountInfo, Discriminator}; use light_compressed_account::compressed_account::PackedMerkleContext; - use light_ctoken_interface::state::CompressedTokenAccountState; + use light_token_interface::state::CompressedTokenAccountState; use rand::Rng; use super::*; diff --git a/programs/compressed-token/anchor/src/delegation.rs b/programs/compressed-token/anchor/src/delegation.rs index e35dfb74bd..bb64319eb5 100644 --- a/programs/compressed-token/anchor/src/delegation.rs +++ b/programs/compressed-token/anchor/src/delegation.rs @@ -446,7 +446,7 @@ mod test { use account_compression::StateMerkleTreeAccount; use anchor_lang::{solana_program::account_info::AccountInfo, Discriminator}; use light_compressed_account::compressed_account::PackedMerkleContext; - use light_ctoken_interface::state::CompressedTokenAccountState; + use light_token_interface::state::CompressedTokenAccountState; use super::*; use crate::{freeze::test_freeze::create_expected_token_output_accounts, TokenData}; diff --git a/programs/compressed-token/anchor/src/freeze.rs b/programs/compressed-token/anchor/src/freeze.rs index be10899d25..f6e322f2b5 100644 --- a/programs/compressed-token/anchor/src/freeze.rs +++ b/programs/compressed-token/anchor/src/freeze.rs @@ -7,7 +7,7 @@ use light_compressed_account::{ data::OutputCompressedAccountWithPackedContext, with_readonly::InAccount, }, }; -use light_ctoken_interface::state::{CompressedTokenAccountState, TokenDataVersion}; +use light_token_interface::state::{CompressedTokenAccountState, TokenDataVersion}; use crate::{ process_transfer::{ @@ -366,7 +366,7 @@ pub mod test_freeze { use account_compression::StateMerkleTreeAccount; use anchor_lang::{solana_program::account_info::AccountInfo, Discriminator}; use light_compressed_account::{compressed_account::PackedMerkleContext, Pubkey}; - use light_ctoken_interface::state::CompressedTokenAccountState; + use light_token_interface::state::CompressedTokenAccountState; use rand::Rng; use super::*; diff --git a/programs/compressed-token/anchor/src/instructions/create_token_pool.rs b/programs/compressed-token/anchor/src/instructions/create_token_pool.rs index ba94393ca8..5f771d64ad 100644 --- a/programs/compressed-token/anchor/src/instructions/create_token_pool.rs +++ b/programs/compressed-token/anchor/src/instructions/create_token_pool.rs @@ -1,7 +1,7 @@ use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::prelude::*; use anchor_spl::token_interface::{TokenAccount, TokenInterface}; -use light_ctoken_interface::{is_restricted_extension, ALLOWED_EXTENSION_TYPES}; +use light_token_interface::{is_restricted_extension, ALLOWED_EXTENSION_TYPES}; use spl_token_2022::{ extension::{ transfer_fee::TransferFeeConfig, transfer_hook::TransferHook, BaseStateWithExtensions, diff --git a/programs/compressed-token/anchor/src/lib.rs b/programs/compressed-token/anchor/src/lib.rs index 81f090543e..f045a3ccff 100644 --- a/programs/compressed-token/anchor/src/lib.rs +++ b/programs/compressed-token/anchor/src/lib.rs @@ -10,7 +10,7 @@ pub mod process_mint; pub mod process_transfer; use process_compress_spl_token_account::process_compress_spl_token_account; pub mod spl_compression; -pub use light_ctoken_interface::state::TokenData; +pub use light_token_interface::state::TokenData; pub use process_mint::*; pub mod delegation; pub mod freeze; @@ -38,7 +38,7 @@ pub mod light_compressed_token { use constants::{NOT_FROZEN, NUM_MAX_POOL_ACCOUNTS}; use instructions::create_token_pool::restricted_seed; - use light_ctoken_interface::is_valid_spl_interface_pda; + use light_token_interface::is_valid_spl_interface_pda; use light_zero_copy::traits::ZeroCopyAt; use super::*; diff --git a/programs/compressed-token/anchor/src/process_mint.rs b/programs/compressed-token/anchor/src/process_mint.rs index 0dc7419f11..9035f5e034 100644 --- a/programs/compressed-token/anchor/src/process_mint.rs +++ b/programs/compressed-token/anchor/src/process_mint.rs @@ -533,7 +533,7 @@ mod test { data::OutputCompressedAccountWithPackedContext, invoke_cpi::InstructionDataInvokeCpi, }, }; - use light_ctoken_interface::state::{CompressedTokenAccountState, TokenData}; + use light_token_interface::state::{CompressedTokenAccountState, TokenData}; use super::*; use crate::constants::TOKEN_COMPRESSED_ACCOUNT_DISCRIMINATOR; diff --git a/programs/compressed-token/anchor/src/process_transfer.rs b/programs/compressed-token/anchor/src/process_transfer.rs index 5980bda72a..27477708e6 100644 --- a/programs/compressed-token/anchor/src/process_transfer.rs +++ b/programs/compressed-token/anchor/src/process_transfer.rs @@ -11,7 +11,7 @@ use light_compressed_account::{ }, pubkey::AsPubkey, }; -use light_ctoken_interface::state::{ +use light_token_interface::state::{ CompressedTokenAccountState, ExtensionStruct, TokenData, TokenDataVersion, }; use light_heap::{bench_sbf_end, bench_sbf_start}; @@ -1132,7 +1132,7 @@ pub mod transfer_sdk { #[cfg(test)] mod test { - use light_ctoken_interface::state::CompressedTokenAccountState; + use light_token_interface::state::CompressedTokenAccountState; use super::*; diff --git a/programs/compressed-token/program/CLAUDE.md b/programs/compressed-token/program/CLAUDE.md index 49142f7717..e218a065a5 100644 --- a/programs/compressed-token/program/CLAUDE.md +++ b/programs/compressed-token/program/CLAUDE.md @@ -184,7 +184,7 @@ Operations on CToken Solana accounts (decompressed compressed tokens). - **`lib.rs`** - Main entry point and instruction dispatch (contains `InstructionType` enum) ## Data Structures -All state and instruction data structures are defined in **`program-libs/ctoken-interface/`** (`light-ctoken-interface` crate): +All state and instruction data structures are defined in **`program-libs/token-interface/`** (`light-token-interface` crate): - **`state/`** - Account state structures - `compressed_token/` - TokenData, hashing - `ctoken/` - CToken (decompressed account) structure @@ -201,7 +201,7 @@ All state and instruction data structures are defined in **`program-libs/ctoken- Custom error codes are defined in **`programs/compressed-token/anchor/src/lib.rs`** (`anchor_compressed_token::ErrorCode` enum): - Contains all program-specific error codes used across compressed token operations - Errors are returned as `ProgramError::Custom(error_code as u32)` on-chain -- CToken-specific errors are also defined in **`program-libs/ctoken-interface/src/error.rs`** (`CTokenError` enum) +- CToken-specific errors are also defined in **`program-libs/token-interface/src/error.rs`** (`CTokenError` enum) ### Error Conversion Functions (`shared/convert_program_error.rs`) diff --git a/programs/compressed-token/program/Cargo.toml b/programs/compressed-token/program/Cargo.toml index f0e37f57ab..b01613a746 100644 --- a/programs/compressed-token/program/Cargo.toml +++ b/programs/compressed-token/program/Cargo.toml @@ -22,13 +22,13 @@ bench-sbf = [] profile-program = [ "light-program-profiler/profile-program", "light-compressed-account/profile-program", - "light-ctoken-interface/profile-program", + "light-token-interface/profile-program", "light-compressible/profile-program", ] profile-heap = [ "light-program-profiler/profile-heap", "light-compressed-account/profile-heap", - "light-ctoken-interface/profile-heap", + "light-token-interface/profile-heap", ] cpi-context = [] cpi-without-program-ids = [] @@ -59,7 +59,7 @@ arrayvec = { workspace = true } tinyvec = { workspace = true } pinocchio = { workspace = true, features = ["std"] } light-sdk-pinocchio = { workspace = true } -light-ctoken-interface = { workspace = true, features = ["anchor"] } +light-token-interface = { workspace = true, features = ["anchor"] } light-array-map = { workspace = true } pinocchio-pubkey = { workspace = true } pinocchio-system = { workspace = true } diff --git a/programs/compressed-token/program/docs/ACCOUNTS.md b/programs/compressed-token/program/docs/ACCOUNTS.md index 0bf03ba659..9ba4449cd7 100644 --- a/programs/compressed-token/program/docs/ACCOUNTS.md +++ b/programs/compressed-token/program/docs/ACCOUNTS.md @@ -16,8 +16,8 @@ - **description** struct `CToken` ctoken solana account with spl token compatible state layout - path: `program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs` - crate: `light-ctoken-interface` + path: `program-libs/token-interface/src/state/ctoken/ctoken_struct.rs` + crate: `light-token-interface` - **associated instructions** 1. `CTokenTransfer` `3` 2. `CTokenApprove` `4` @@ -41,7 +41,7 @@ borsh and zero copy deserialization deserialize the compressible extension, spl serialization only deserialize the base token data. zero copy: (always use in programs) ```rust - use light_ctoken_interface::state::ctoken::CToken; + use light_token_interface::state::ctoken::CToken; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyAtMut}; let (token, _) = CToken::zero_copy_at(&account_data)?; @@ -51,7 +51,7 @@ borsh: (always use in client non solana program code) ```rust use borsh::BorshDeserialize; - use light_ctoken_interface::state::ctoken::CToken; + use light_token_interface::state::ctoken::CToken; let token = CToken::deserialize(&mut &account_data[..])?; ``` @@ -84,7 +84,7 @@ ### Compressed Token - compressed token account. -- version describes the hashing and the discriminator. (program-libs/ctoken-interface/src/state/compressed_token/token_data_version.rs) +- version describes the hashing and the discriminator. (program-libs/token-interface/src/state/compressed_token/token_data_version.rs) pub enum TokenDataVersion { V1 = 1u8, // discriminator [2, 0, 0, 0, 0, 0, 0, 0], // 2 le (Poseidon hashed) V2 = 2u8, // discriminator [0, 0, 0, 0, 0, 0, 0, 3], // 3 be (Poseidon hashed) @@ -94,14 +94,14 @@ ### Compressed Mint ## Extensions -The compressed token program supports multiple extensions defined in `program-libs/ctoken-interface/src/state/extensions/`. +The compressed token program supports multiple extensions defined in `program-libs/token-interface/src/state/extensions/`. ### Mint Extensions #### TokenMetadata - Mint extension, compatible with TokenMetadata extension of Token2022. - Only available in compressed mints. -- Path: `program-libs/ctoken-interface/src/state/extensions/token_metadata.rs` +- Path: `program-libs/token-interface/src/state/extensions/token_metadata.rs` ### Token Account Extensions @@ -109,24 +109,24 @@ The compressed token program supports multiple extensions defined in `program-li - Token account extension, Token2022 does not have an equivalent extension. - Only available in ctoken solana accounts (decompressed ctokens), not in compressed token accounts. - Stores compression info (rent sponsor, config, creation slot, etc.) for rent management. -- Path: `program-libs/ctoken-interface/src/state/extensions/compressible.rs` +- Path: `program-libs/token-interface/src/state/extensions/compressible.rs` #### CompressedOnly - Marker extension indicating the account can only exist in compressed form. -- Path: `program-libs/ctoken-interface/src/state/extensions/compressed_only.rs` +- Path: `program-libs/token-interface/src/state/extensions/compressed_only.rs` #### Pausable - Token account extension compatible with Token2022 PausableAccount extension. -- Path: `program-libs/ctoken-interface/src/state/extensions/pausable.rs` +- Path: `program-libs/token-interface/src/state/extensions/pausable.rs` #### PermanentDelegate - Token account extension compatible with Token2022 PermanentDelegate extension. -- Path: `program-libs/ctoken-interface/src/state/extensions/permanent_delegate.rs` +- Path: `program-libs/token-interface/src/state/extensions/permanent_delegate.rs` #### TransferFee - Token account extension compatible with Token2022 TransferFee extension. -- Path: `program-libs/ctoken-interface/src/state/extensions/transfer_fee.rs` +- Path: `program-libs/token-interface/src/state/extensions/transfer_fee.rs` #### TransferHook - Token account extension compatible with Token2022 TransferHook extension. -- Path: `program-libs/ctoken-interface/src/state/extensions/transfer_hook.rs` +- Path: `program-libs/token-interface/src/state/extensions/transfer_hook.rs` diff --git a/programs/compressed-token/program/docs/EXTENSIONS.md b/programs/compressed-token/program/docs/EXTENSIONS.md index 7eaff32385..392d06726e 100644 --- a/programs/compressed-token/program/docs/EXTENSIONS.md +++ b/programs/compressed-token/program/docs/EXTENSIONS.md @@ -6,7 +6,7 @@ This document describes how Token-2022 extensions are validated across compresse The compressed token program supports 16 Token-2022 extension types. **5 restricted extensions** require instruction-level validation checks. Pure mint extensions (metadata, group, etc.) are allowed without explicit instruction support. -**Allowed extensions** (defined in `program-libs/ctoken-interface/src/token_2022_extensions.rs:17-44`): +**Allowed extensions** (defined in `program-libs/token-interface/src/token_2022_extensions.rs:17-44`): 1. MetadataPointer 2. TokenMetadata @@ -221,7 +221,7 @@ The CompressedOnly extension preserves CToken account state during CompressAndCl ### Data Structures -**State Extension** (`program-libs/ctoken-interface/src/state/extensions/compressed_only.rs`): +**State Extension** (`program-libs/token-interface/src/state/extensions/compressed_only.rs`): ```rust pub struct CompressedOnlyExtension { /// The delegated amount from the source CToken account's delegate field. @@ -233,7 +233,7 @@ pub struct CompressedOnlyExtension { } ``` -**Instruction Data** (`program-libs/ctoken-interface/src/instructions/extensions/compressed_only.rs`): +**Instruction Data** (`program-libs/token-interface/src/instructions/extensions/compressed_only.rs`): ```rust pub struct CompressedOnlyExtensionInstructionData { /// The delegated amount from the source CToken account's delegate field. @@ -361,7 +361,7 @@ ctoken.base.set_initialized(); 6. Check if DefaultAccountState is set to Frozen (lines 213-220) 7. Return `MintExtensionFlags` with boolean flags -**Returns** (defined in `program-libs/ctoken-interface/src/token_2022_extensions.rs:59-75`): +**Returns** (defined in `program-libs/token-interface/src/token_2022_extensions.rs:59-75`): ```rust MintExtensionFlags { has_pausable: bool, diff --git a/programs/compressed-token/program/docs/compressed_token/ADD_TOKEN_POOL.md b/programs/compressed-token/program/docs/compressed_token/ADD_TOKEN_POOL.md index 870c63cc6d..4f810eddba 100644 --- a/programs/compressed-token/program/docs/compressed_token/ADD_TOKEN_POOL.md +++ b/programs/compressed-token/program/docs/compressed_token/ADD_TOKEN_POOL.md @@ -1,6 +1,6 @@ # Add Token Pool -**discriminator:** `[114, 143, 210, 73, 96, 115, 1, 228]` program-libs/ctoken-interface/src/discriminator.rs +**discriminator:** `[114, 143, 210, 73, 96, 115, 1, 228]` program-libs/token-interface/src/discriminator.rs **enum:** Not applicable - this is an Anchor instruction, not part of the custom `InstructionType` enum @@ -50,7 +50,7 @@ Token pool pda is renamed to spl interface pda in the light-token-sdk. - Error: InvalidTokenPoolBump if index >= 5 2. Determine if mint has restricted extensions via `restricted_seed()` (programs/compressed-token/anchor/src/instructions/create_token_pool.rs:21-39) - Checks for: Pausable, PermanentDelegate, TransferFeeConfig, TransferHook, DefaultAccountState extensions -3. Validate previous pool exists via `is_valid_spl_interface_pda()` (program-libs/ctoken-interface/src/pool_derivation.rs:95-148) +3. Validate previous pool exists via `is_valid_spl_interface_pda()` (program-libs/token-interface/src/pool_derivation.rs:95-148) - Uses `token_pool_index.saturating_sub(1)` as the previous index - Verifies existing_token_pool_pda matches PDA derivation with (token_pool_index - 1) - Uses the same restricted/regular derivation path as the new pool diff --git a/programs/compressed-token/program/docs/compressed_token/CREATE_TOKEN_POOL.md b/programs/compressed-token/program/docs/compressed_token/CREATE_TOKEN_POOL.md index 94b4f3cfa4..770b96c5a3 100644 --- a/programs/compressed-token/program/docs/compressed_token/CREATE_TOKEN_POOL.md +++ b/programs/compressed-token/program/docs/compressed_token/CREATE_TOKEN_POOL.md @@ -1,6 +1,6 @@ # Create Token Pool -**discriminator:** `[23, 169, 27, 122, 147, 169, 209, 152]` program-libs/ctoken-interface/src/discriminator.rs +**discriminator:** `[23, 169, 27, 122, 147, 169, 209, 152]` program-libs/token-interface/src/discriminator.rs **enum:** Not applicable - this is an Anchor instruction, not part of the custom `InstructionType` enum @@ -44,7 +44,7 @@ Token pool pda is renamed to spl interface pda in the light-token-sdk. **Instruction Logic and Checks:** 1. Validate mint extensions via `assert_mint_extensions()` (programs/compressed-token/anchor/src/instructions/create_token_pool.rs:129-165) - - All extensions must be in ALLOWED_EXTENSION_TYPES (program-libs/ctoken-interface/src/token_2022_extensions.rs:24-44) + - All extensions must be in ALLOWED_EXTENSION_TYPES (program-libs/token-interface/src/token_2022_extensions.rs:24-44) - Allowed extensions (16 types): MetadataPointer, TokenMetadata, InterestBearingConfig, GroupPointer, GroupMemberPointer, TokenGroup, TokenGroupMember, MintCloseAuthority, TransferFeeConfig, DefaultAccountState, PermanentDelegate, TransferHook, Pausable, ConfidentialTransferMint, ConfidentialTransferFeeConfig, ConfidentialMintBurn - **Restricted extensions (5 types) require compression_only mode:** - `Pausable` - pause state checked at transfer time from SPL mint diff --git a/programs/compressed-token/program/docs/compressed_token/MINT_ACTION.md b/programs/compressed-token/program/docs/compressed_token/MINT_ACTION.md index 07618b677b..c47869178d 100644 --- a/programs/compressed-token/program/docs/compressed_token/MINT_ACTION.md +++ b/programs/compressed-token/program/docs/compressed_token/MINT_ACTION.md @@ -36,7 +36,7 @@ Key concepts integrated: - **Batch processing**: Multiple actions execute sequentially with state updates persisted between actions **Instruction data:** -1. instruction data is defined in path: program-libs/ctoken-interface/src/instructions/mint_action/instruction_data.rs +1. instruction data is defined in path: program-libs/token-interface/src/instructions/mint_action/instruction_data.rs **Core fields:** - `leaf_index`: u32 - Merkle tree leaf index of existing compressed mint (only used if create_mint is None) @@ -49,7 +49,7 @@ Key concepts integrated: - `cpi_context`: Option - For cross-program invocation support - `mint`: Option - Full mint state including supply, decimals, metadata, authorities, and extensions (None when reading from decompressed CMint) -2. Action types (path: program-libs/ctoken-interface/src/instructions/mint_action/): +2. Action types (path: program-libs/token-interface/src/instructions/mint_action/): - `MintToCompressed(MintToCompressedAction)` - Mint tokens to compressed accounts (mint_to_compressed.rs) - `UpdateMintAuthority(UpdateAuthority)` - Update mint authority (update_mint.rs) - `UpdateFreezeAuthority(UpdateAuthority)` - Update freeze authority (update_mint.rs) diff --git a/programs/compressed-token/program/docs/compressed_token/TRANSFER2.md b/programs/compressed-token/program/docs/compressed_token/TRANSFER2.md index c6feb2c5b3..8a19ca7a20 100644 --- a/programs/compressed-token/program/docs/compressed_token/TRANSFER2.md +++ b/programs/compressed-token/program/docs/compressed_token/TRANSFER2.md @@ -21,8 +21,8 @@ 1. Batch transfer instruction supporting multiple token operations in a single transaction with up to 5 different mints (cmints or spl) 2. Account types and data layouts: - - Compressed accounts: `TokenData` (program-libs/ctoken-interface/src/state/compressed_token/token_data.rs) - - Decompressed Solana accounts: `CToken` for ctokens (program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs) or standard SPL token accounts + - Compressed accounts: `TokenData` (program-libs/token-interface/src/state/compressed_token/token_data.rs) + - Decompressed Solana accounts: `CToken` for ctokens (program-libs/token-interface/src/state/ctoken/ctoken_struct.rs) or standard SPL token accounts - SPL tokens when compressed are backed by tokens stored in ctoken pool PDAs 3. Compression modes: @@ -41,7 +41,7 @@ - Execute mode: All operations supported including compress/decompress **Instruction data:** -1. instruction data is defined in path: program-libs/ctoken-interface/src/instructions/transfer2/instruction_data.rs +1. instruction data is defined in path: program-libs/token-interface/src/instructions/transfer2/instruction_data.rs - `with_transaction_hash`: Compute transaction hash for the complete transaction and include in compressed account data, enables ZK proofs over how compressed accounts are spent - `with_lamports_change_account_merkle_tree_index`: bool - Track lamport changes in specified tree (placeholder, unimplemented) - `lamports_change_account_merkle_tree_index`: u8 - Merkle tree index for lamport change account (placeholder, unimplemented) @@ -58,7 +58,7 @@ - `in_tlv`: Optional TLV data for input accounts (used for CompressedOnly extension during decompress) - `out_tlv`: Optional TLV data for output accounts (used for CompressedOnly extension during CompressAndClose) -2. Compression struct fields (path: program-libs/ctoken-interface/src/instructions/transfer2/compression.rs): +2. Compression struct fields (path: program-libs/token-interface/src/instructions/transfer2/compression.rs): - `mode`: CompressionMode enum (Compress, Decompress, CompressAndClose) - `amount`: u64 - Amount to compress/decompress - `mint`: u8 - Index of mint account in packed accounts diff --git a/programs/compressed-token/program/docs/compressible/CLAIM.md b/programs/compressed-token/program/docs/compressible/CLAIM.md index 0395f3fb12..f40d7100e8 100644 --- a/programs/compressed-token/program/docs/compressible/CLAIM.md +++ b/programs/compressed-token/program/docs/compressible/CLAIM.md @@ -7,8 +7,8 @@ **description:** 1. Claims rent from compressible CToken and CMint solana accounts that have passed their rent expiration epochs 2. Supports both account types: - - CToken (account_type = 2): decompressed token accounts, layout defined in program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs - - CMint (account_type = 1): decompressed mint accounts, layout defined in program-libs/ctoken-interface/src/state/mint/compressed_mint.rs + - CToken (account_type = 2): decompressed token accounts, layout defined in program-libs/token-interface/src/state/ctoken/ctoken_struct.rs + - CMint (account_type = 1): decompressed mint accounts, layout defined in program-libs/token-interface/src/state/mint/compressed_mint.rs 3. CompressionInfo storage differs by account type: - CToken: CompressionInfo is stored inside a Compressible extension (not embedded directly) - CMint: CompressionInfo is embedded directly in the mint struct at `compression` field diff --git a/programs/compressed-token/program/docs/ctoken/APPROVE.md b/programs/compressed-token/program/docs/ctoken/APPROVE.md index 5a735f0845..9c315abff4 100644 --- a/programs/compressed-token/program/docs/ctoken/APPROVE.md +++ b/programs/compressed-token/program/docs/ctoken/APPROVE.md @@ -14,7 +14,7 @@ If the CToken account has a compressible extension and requires a rent top-up, t - **NOT SPL-compatible (system program required):** Compressible accounts that need rent top-up based on current slot **description:** -Delegates a specified amount to a delegate authority on a decompressed ctoken account (account layout `CToken` defined in program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs). After the SPL approve operation, automatically tops up compressible accounts (extension layout `CompressionInfo` defined in program-libs/compressible/src/compression_info.rs) with additional lamports if needed to prevent accounts from becoming compressible during normal operations. The instruction supports a max_top_up parameter (0 = no limit) that enforces transaction failure if the calculated top-up exceeds this limit. Uses pinocchio-token-program for SPL-compatible approve semantics. Supports backwards-compatible instruction data format (8 bytes legacy vs 10 bytes with max_top_up). +Delegates a specified amount to a delegate authority on a decompressed ctoken account (account layout `CToken` defined in program-libs/token-interface/src/state/ctoken/ctoken_struct.rs). After the SPL approve operation, automatically tops up compressible accounts (extension layout `CompressionInfo` defined in program-libs/compressible/src/compression_info.rs) with additional lamports if needed to prevent accounts from becoming compressible during normal operations. The instruction supports a max_top_up parameter (0 = no limit) that enforces transaction failure if the calculated top-up exceeds this limit. Uses pinocchio-token-program for SPL-compatible approve semantics. Supports backwards-compatible instruction data format (8 bytes legacy vs 10 bytes with max_top_up). **Instruction data:** Path: programs/compressed-token/program/src/ctoken/approve_revoke.rs (lines 14-15, 98-106) diff --git a/programs/compressed-token/program/docs/ctoken/BURN.md b/programs/compressed-token/program/docs/ctoken/BURN.md index 93843030e7..57565bf692 100644 --- a/programs/compressed-token/program/docs/ctoken/BURN.md +++ b/programs/compressed-token/program/docs/ctoken/BURN.md @@ -5,7 +5,7 @@ **path:** programs/compressed-token/program/src/ctoken/burn.rs **description:** -Burns tokens from a decompressed CToken account and decreases the CMint supply, fully compatible with SPL Token burn semantics. Account layout `CToken` is defined in `program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs`. Account layout `CompressedMint` (CMint) is defined in `program-libs/ctoken-interface/src/state/mint/compressed_mint.rs`. Extension layout `CompressionInfo` is defined in `program-libs/compressible/src/compression_info.rs` and is embedded in both CToken and CMint structs. Uses pinocchio-token-program to process the burn (handles balance/supply updates, authority check, frozen check). After the burn, automatically tops up compressible accounts with additional lamports if needed. Top-up is calculated for both CMint and source CToken based on current slot and account balance. Top-up prevents accounts from becoming compressible during normal operations. Enforces max_top_up limit if provided (transaction fails if exceeded). Supports max_top_up parameter to limit rent top-up costs (0 = no limit). Instruction data is backwards-compatible: 8-byte format (legacy, no max_top_up enforcement) and 10-byte format (with max_top_up). This instruction only works with CMints (compressed mints). CMints do not support restricted Token-2022 extensions (Pausable, TransferFee, TransferHook, PermanentDelegate, DefaultAccountState) - only TokenMetadata is allowed. To burn tokens from spl or T22 mints, use Transfer2 with decompress mode to convert to SPL tokens first, then burn via SPL Token-2022. +Burns tokens from a decompressed CToken account and decreases the CMint supply, fully compatible with SPL Token burn semantics. Account layout `CToken` is defined in `program-libs/token-interface/src/state/ctoken/ctoken_struct.rs`. Account layout `CompressedMint` (CMint) is defined in `program-libs/token-interface/src/state/mint/compressed_mint.rs`. Extension layout `CompressionInfo` is defined in `program-libs/compressible/src/compression_info.rs` and is embedded in both CToken and CMint structs. Uses pinocchio-token-program to process the burn (handles balance/supply updates, authority check, frozen check). After the burn, automatically tops up compressible accounts with additional lamports if needed. Top-up is calculated for both CMint and source CToken based on current slot and account balance. Top-up prevents accounts from becoming compressible during normal operations. Enforces max_top_up limit if provided (transaction fails if exceeded). Supports max_top_up parameter to limit rent top-up costs (0 = no limit). Instruction data is backwards-compatible: 8-byte format (legacy, no max_top_up enforcement) and 10-byte format (with max_top_up). This instruction only works with CMints (compressed mints). CMints do not support restricted Token-2022 extensions (Pausable, TransferFee, TransferHook, PermanentDelegate, DefaultAccountState) - only TokenMetadata is allowed. To burn tokens from spl or T22 mints, use Transfer2 with decompress mode to convert to SPL tokens first, then burn via SPL Token-2022. **Instruction data:** diff --git a/programs/compressed-token/program/docs/ctoken/BURN_CHECKED.md b/programs/compressed-token/program/docs/ctoken/BURN_CHECKED.md index 9ea1e627d7..7b1fda2e22 100644 --- a/programs/compressed-token/program/docs/ctoken/BURN_CHECKED.md +++ b/programs/compressed-token/program/docs/ctoken/BURN_CHECKED.md @@ -5,7 +5,7 @@ **path:** programs/compressed-token/program/src/ctoken/burn.rs **description:** -Burns tokens from a decompressed CToken account and decreases the CMint supply with decimals validation, fully compatible with SPL Token BurnChecked semantics. Account layout `CToken` is defined in `program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs`. Account layout `CompressedMint` (CMint) is defined in `program-libs/ctoken-interface/src/state/mint/compressed_mint.rs`. Extension layout `CompressionInfo` is defined in `program-libs/compressible/src/compression_info.rs` and is embedded in both CToken and CMint structs. Uses pinocchio-token-program to process the burn_checked (handles balance/supply updates, authority check, frozen check, decimals validation). After the burn, automatically tops up compressible accounts with additional lamports if needed. Top-up prevents accounts from becoming compressible during normal operations. Enforces max_top_up limit if provided (transaction fails if exceeded). Account order is REVERSED from mint_to instruction: [source_ctoken, cmint, authority] vs mint_to's [cmint, destination_ctoken, authority]. +Burns tokens from a decompressed CToken account and decreases the CMint supply with decimals validation, fully compatible with SPL Token BurnChecked semantics. Account layout `CToken` is defined in `program-libs/token-interface/src/state/ctoken/ctoken_struct.rs`. Account layout `CompressedMint` (CMint) is defined in `program-libs/token-interface/src/state/mint/compressed_mint.rs`. Extension layout `CompressionInfo` is defined in `program-libs/compressible/src/compression_info.rs` and is embedded in both CToken and CMint structs. Uses pinocchio-token-program to process the burn_checked (handles balance/supply updates, authority check, frozen check, decimals validation). After the burn, automatically tops up compressible accounts with additional lamports if needed. Top-up prevents accounts from becoming compressible during normal operations. Enforces max_top_up limit if provided (transaction fails if exceeded). Account order is REVERSED from mint_to instruction: [source_ctoken, cmint, authority] vs mint_to's [cmint, destination_ctoken, authority]. **Instruction data:** diff --git a/programs/compressed-token/program/docs/ctoken/CLOSE.md b/programs/compressed-token/program/docs/ctoken/CLOSE.md index 9b179d0535..e7a09278d2 100644 --- a/programs/compressed-token/program/docs/ctoken/CLOSE.md +++ b/programs/compressed-token/program/docs/ctoken/CLOSE.md @@ -6,7 +6,7 @@ **description:** 1. Closes decompressed ctoken solana accounts and distributes remaining lamports to destination account. -2. Account layout `CToken` is defined in path: program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs +2. Account layout `CToken` is defined in path: program-libs/token-interface/src/state/ctoken/ctoken_struct.rs 3. Supports both regular (non-compressible) and compressible token accounts (with compressible extension) 4. For compressible accounts (with compressible extension): - Completed epoch rent lamports are returned to the rent_sponsor diff --git a/programs/compressed-token/program/docs/ctoken/CREATE.md b/programs/compressed-token/program/docs/ctoken/CREATE.md index 2e2c16f2b6..9d12262ec1 100644 --- a/programs/compressed-token/program/docs/ctoken/CREATE.md +++ b/programs/compressed-token/program/docs/ctoken/CREATE.md @@ -10,9 +10,9 @@ **description:** 1. creates ctoken solana accounts with and without Compressible extension - 2. account layout `CToken` is defined in path: program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs + 2. account layout `CToken` is defined in path: program-libs/token-interface/src/state/ctoken/ctoken_struct.rs 3. extension layout `CompressionInfo` is defined in path: - program-libs/ctoken-interface/src/state/extensions/compressible.rs + program-libs/token-interface/src/state/extensions/compressible.rs 4. A compressible token means that the ctoken solana account can be compressed by the rent authority as soon as the account balance is insufficient. 5. Account creation without the compressible extension: - Initializes an existing 165-byte solana account as a ctoken account (SPL-compatible size) @@ -24,11 +24,11 @@ - if the payer is not the rent recipient the fee payer pays the rent and becomes the rent recipient (the rent recipient is a ctoken program pda that funds rent exemption for compressible ctoken solana accounts) **Instruction data:** - 1. instruction data is defined in path: program-libs/ctoken-interface/src/instructions/create_ctoken_account.rs + 1. instruction data is defined in path: program-libs/token-interface/src/instructions/create_ctoken_account.rs - `owner`: The owner pubkey for the token account (32 bytes) - `compressible_config`: Optional `CompressibleExtensionInstructionData` (None = non-compressible account) 2. Instruction data with compressible extension - program-libs/ctoken-interface/src/instructions/extensions/compressible.rs + program-libs/token-interface/src/instructions/extensions/compressible.rs - `token_account_version`: Version of the compressed token account hashing scheme (u8). Must be 3 (ShaFlat) - only version 3 is supported. - `rent_payment`: Number of epochs to prepay for rent (u8) - `rent_payment = 1` is explicitly forbidden to prevent epoch boundary timing edge case (its rent for the current rent epoch) @@ -159,7 +159,7 @@ 7. ATAs for mints with restricted extensions must be compressible (the compression_only marker is part of the Compressible extension) **Instruction data:** - 1. instruction data is defined in path: program-libs/ctoken-interface/src/instructions/create_associated_token_account.rs + 1. instruction data is defined in path: program-libs/token-interface/src/instructions/create_associated_token_account.rs - `bump`: PDA bump seed for derivation (u8) - `compressible_config`: Optional `CompressibleExtensionInstructionData`, same as create ctoken account but: - `compress_to_account_pubkey` must be None (ATAs always compress to owner) diff --git a/programs/compressed-token/program/docs/ctoken/FREEZE_ACCOUNT.md b/programs/compressed-token/program/docs/ctoken/FREEZE_ACCOUNT.md index 3553e86d40..dc133be95b 100644 --- a/programs/compressed-token/program/docs/ctoken/FREEZE_ACCOUNT.md +++ b/programs/compressed-token/program/docs/ctoken/FREEZE_ACCOUNT.md @@ -5,7 +5,7 @@ **path:** programs/compressed-token/program/src/ctoken/freeze_thaw.rs **description:** -Freezes a decompressed ctoken account, preventing transfers and other operations while frozen. This is a pass-through instruction that validates mint ownership (must be owned by SPL Token, Token-2022, or CToken program) before delegating to pinocchio-token-program for standard SPL Token freeze validation. After freezing, the account's state field is set to AccountState::Frozen, and only the freeze_authority of the mint can freeze accounts (mint must have freeze_authority set). The account layout `CToken` is defined in program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs. +Freezes a decompressed ctoken account, preventing transfers and other operations while frozen. This is a pass-through instruction that validates mint ownership (must be owned by SPL Token, Token-2022, or CToken program) before delegating to pinocchio-token-program for standard SPL Token freeze validation. After freezing, the account's state field is set to AccountState::Frozen, and only the freeze_authority of the mint can freeze accounts (mint must have freeze_authority set). The account layout `CToken` is defined in program-libs/token-interface/src/state/ctoken/ctoken_struct.rs. **Instruction data:** No instruction data required beyond the discriminator byte. diff --git a/programs/compressed-token/program/docs/ctoken/MINT_TO.md b/programs/compressed-token/program/docs/ctoken/MINT_TO.md index f3757e2f83..eb55eca502 100644 --- a/programs/compressed-token/program/docs/ctoken/MINT_TO.md +++ b/programs/compressed-token/program/docs/ctoken/MINT_TO.md @@ -8,8 +8,8 @@ Mints tokens from a decompressed CMint account to a destination CToken account, fully compatible with SPL Token mint_to semantics. Uses pinocchio-token-program to process the mint_to operation which handles balance/supply updates, authority validation, and frozen account checks. After minting, automatically tops up compressible accounts with additional lamports if needed to prevent accounts from becoming compressible during normal operations. Both CMint and destination CToken can receive top-ups based on their current slot and account balance. Supports max_top_up parameter to limit rent top-up costs where 0 means no limit. Instruction data is backwards-compatible with two formats: 8-byte format for legacy compatibility without max_top_up enforcement and 10-byte format with max_top_up. This instruction only works with CMints (compressed mints). CMints do not support restricted Token-2022 extensions (Pausable, TransferFee, TransferHook, PermanentDelegate, DefaultAccountState) - only TokenMetadata is allowed. Account layouts: -- `CToken` defined in: program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs -- `CompressedMint` (CMint) defined in: program-libs/ctoken-interface/src/state/mint/compressed_mint.rs +- `CToken` defined in: program-libs/token-interface/src/state/ctoken/ctoken_struct.rs +- `CompressedMint` (CMint) defined in: program-libs/token-interface/src/state/mint/compressed_mint.rs - `CompressionInfo` extension defined in: program-libs/compressible/src/compression_info.rs **Instruction data:** diff --git a/programs/compressed-token/program/docs/ctoken/MINT_TO_CHECKED.md b/programs/compressed-token/program/docs/ctoken/MINT_TO_CHECKED.md index 41fc21e3ba..5f78c7eaca 100644 --- a/programs/compressed-token/program/docs/ctoken/MINT_TO_CHECKED.md +++ b/programs/compressed-token/program/docs/ctoken/MINT_TO_CHECKED.md @@ -8,8 +8,8 @@ Mints tokens from a decompressed CMint account to a destination CToken account with decimals validation, fully compatible with SPL Token MintToChecked semantics. Uses pinocchio-token-program to process the mint_to_checked operation which handles balance/supply updates, authority validation, frozen account checks, and decimals validation. After minting, automatically tops up compressible accounts with additional lamports if needed to prevent accounts from becoming compressible during normal operations. Both CMint and destination CToken can receive top-ups based on their current slot and account balance. Supports max_top_up parameter to limit rent top-up costs where 0 means no limit. Account layouts: -- `CToken` defined in: program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs -- `CompressedMint` (CMint) defined in: program-libs/ctoken-interface/src/state/mint/compressed_mint.rs +- `CToken` defined in: program-libs/token-interface/src/state/ctoken/ctoken_struct.rs +- `CompressedMint` (CMint) defined in: program-libs/token-interface/src/state/mint/compressed_mint.rs - `CompressionInfo` extension defined in: program-libs/compressible/src/compression_info.rs **Instruction data:** diff --git a/programs/compressed-token/program/docs/ctoken/REVOKE.md b/programs/compressed-token/program/docs/ctoken/REVOKE.md index 88e3474bbb..6d0674f176 100644 --- a/programs/compressed-token/program/docs/ctoken/REVOKE.md +++ b/programs/compressed-token/program/docs/ctoken/REVOKE.md @@ -15,7 +15,7 @@ If the CToken account has a compressible extension and requires a rent top-up, t - **NOT SPL-compatible (payer required):** Compressible accounts that need rent top-up based on current slot **description:** -Revokes any previously granted delegation on a decompressed ctoken account (account layout `CToken` defined in program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs). After the revoke operation, automatically tops up compressible accounts (extension layout `CompressionInfo` defined in program-libs/compressible/src/compression_info.rs) with additional lamports if needed to prevent accounts from becoming compressible during normal operations. The instruction supports a max_top_up parameter (0 = no limit) that enforces transaction failure if the calculated top-up exceeds this limit. Uses pinocchio-token-program for SPL-compatible revoke semantics. Supports backwards-compatible instruction data format (0 bytes legacy vs 2 bytes with max_top_up). The revoke operation follows SPL Token rules exactly (clears delegate and delegated_amount). +Revokes any previously granted delegation on a decompressed ctoken account (account layout `CToken` defined in program-libs/token-interface/src/state/ctoken/ctoken_struct.rs). After the revoke operation, automatically tops up compressible accounts (extension layout `CompressionInfo` defined in program-libs/compressible/src/compression_info.rs) with additional lamports if needed to prevent accounts from becoming compressible during normal operations. The instruction supports a max_top_up parameter (0 = no limit) that enforces transaction failure if the calculated top-up exceeds this limit. Uses pinocchio-token-program for SPL-compatible revoke semantics. Supports backwards-compatible instruction data format (0 bytes legacy vs 2 bytes with max_top_up). The revoke operation follows SPL Token rules exactly (clears delegate and delegated_amount). **Instruction data:** Path: programs/compressed-token/program/src/ctoken/approve_revoke.rs (lines 49-59 for revoke, lines 86-124 for top-up processing) diff --git a/programs/compressed-token/program/docs/ctoken/THAW_ACCOUNT.md b/programs/compressed-token/program/docs/ctoken/THAW_ACCOUNT.md index 5017e1a1fc..4e4f4f8e0c 100644 --- a/programs/compressed-token/program/docs/ctoken/THAW_ACCOUNT.md +++ b/programs/compressed-token/program/docs/ctoken/THAW_ACCOUNT.md @@ -5,7 +5,7 @@ **path:** programs/compressed-token/program/src/ctoken/freeze_thaw.rs **description:** -Thaws a frozen decompressed ctoken account, restoring normal operation. This is a pass-through instruction that validates mint ownership (must be owned by SPL Token, Token-2022, or CToken program) before delegating to pinocchio-token-program for standard SPL Token thaw validation. After thawing, the account's state field is set to AccountState::Initialized, and only the freeze_authority of the mint can thaw accounts (mint must have freeze_authority set). The account layout `CToken` is defined in program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs. +Thaws a frozen decompressed ctoken account, restoring normal operation. This is a pass-through instruction that validates mint ownership (must be owned by SPL Token, Token-2022, or CToken program) before delegating to pinocchio-token-program for standard SPL Token thaw validation. After thawing, the account's state field is set to AccountState::Initialized, and only the freeze_authority of the mint can thaw accounts (mint must have freeze_authority set). The account layout `CToken` is defined in program-libs/token-interface/src/state/ctoken/ctoken_struct.rs. **Instruction data:** No instruction data required beyond the discriminator byte. diff --git a/programs/compressed-token/program/docs/ctoken/TRANSFER.md b/programs/compressed-token/program/docs/ctoken/TRANSFER.md index be7e484bcd..d65ef76763 100644 --- a/programs/compressed-token/program/docs/ctoken/TRANSFER.md +++ b/programs/compressed-token/program/docs/ctoken/TRANSFER.md @@ -16,7 +16,7 @@ When accounts require rent top-up, lamports are transferred directly from the au **description:** 1. Transfers tokens between decompressed ctoken solana accounts, fully compatible with SPL Token semantics -2. Account layout `CToken` is defined in path: program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs +2. Account layout `CToken` is defined in path: program-libs/token-interface/src/state/ctoken/ctoken_struct.rs 3. Compression info for rent top-up is defined in: program-libs/compressible/src/compression_info.rs 4. Uses pinocchio-token-program to process the transfer (lightweight SPL-compatible implementation) 5. After the transfer, automatically tops up compressible accounts with additional lamports if needed: diff --git a/programs/compressed-token/program/docs/ctoken/TRANSFER_CHECKED.md b/programs/compressed-token/program/docs/ctoken/TRANSFER_CHECKED.md index 6c360b3e1b..2f1d110c4e 100644 --- a/programs/compressed-token/program/docs/ctoken/TRANSFER_CHECKED.md +++ b/programs/compressed-token/program/docs/ctoken/TRANSFER_CHECKED.md @@ -18,7 +18,7 @@ When accounts require rent top-up, lamports are transferred directly from the au When both source and destination accounts are exactly 165 bytes (no extensions), the instruction bypasses all extension processing and directly calls pinocchio process_transfer_checked for maximum performance. **description:** -Transfers tokens between decompressed ctoken solana accounts with mint decimals validation, fully compatible with SPL Token TransferChecked semantics. Account layout `CToken` is defined in program-libs/ctoken-interface/src/state/ctoken/ctoken_struct.rs. Compression info for rent top-up is defined in program-libs/compressible/src/compression_info.rs. Uses pinocchio-token-program to process the transfer (lightweight SPL-compatible implementation). After the transfer, automatically tops up compressible accounts with additional lamports if needed based on current slot and account balance. Top-up prevents accounts from becoming compressible during normal operations. Supports standard SPL Token transfer features including delegate authority and permanent delegate (multisig not supported). The transfer amount, authority validation, and decimals validation follow SPL Token TransferChecked rules exactly. Validates that mint decimals match the provided decimals parameter. Difference from CTokenTransfer: Requires mint account (4 accounts vs 3) for decimals validation and T22 extension validation. +Transfers tokens between decompressed ctoken solana accounts with mint decimals validation, fully compatible with SPL Token TransferChecked semantics. Account layout `CToken` is defined in program-libs/token-interface/src/state/ctoken/ctoken_struct.rs. Compression info for rent top-up is defined in program-libs/compressible/src/compression_info.rs. Uses pinocchio-token-program to process the transfer (lightweight SPL-compatible implementation). After the transfer, automatically tops up compressible accounts with additional lamports if needed based on current slot and account balance. Top-up prevents accounts from becoming compressible during normal operations. Supports standard SPL Token transfer features including delegate authority and permanent delegate (multisig not supported). The transfer amount, authority validation, and decimals validation follow SPL Token TransferChecked rules exactly. Validates that mint decimals match the provided decimals parameter. Difference from CTokenTransfer: Requires mint account (4 accounts vs 3) for decimals validation and T22 extension validation. **Instruction data:** - **9 bytes (legacy):** amount (u64) + decimals (u8) diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs b/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs index 94fa8322b5..7586153f4a 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs @@ -2,7 +2,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressible::config::CompressibleConfig; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{ZAction, ZMintActionCompressedInstructionData}, CMINT_ADDRESS_TREE, }; @@ -457,7 +457,7 @@ impl AccountsConfig { let has_mint_to_ctoken_actions = parsed_instruction_data .actions .iter() - .any(|action| matches!(action, ZAction::MintToCToken(_))); + .any(|action| matches!(action, ZAction::MintToToken(_))); if has_mint_to_ctoken_actions { msg!("Mint to ctokens not allowed when writing to cpi context"); return Err(ErrorCode::CpiContextSetNotUsable.into()); diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/compress_and_close_cmint.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/compress_and_close_cmint.rs index 9ec9ddf8b9..cc136a082c 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/compress_and_close_cmint.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/compress_and_close_cmint.rs @@ -1,6 +1,6 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::ZCompressAndCloseCMintAction, state::CompressedMint, }; use light_program_profiler::profile; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs index 561ee709c3..b0365e088f 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs @@ -1,7 +1,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_compressed_account::instruction_data::with_readonly::ZInstructionDataInvokeCpiWithReadOnlyMut; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::ZMintActionCompressedInstructionData, CMINT_ADDRESS_TREE, COMPRESSED_MINT_SEED, }; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs index 69303471f9..3f3eb30474 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs @@ -2,7 +2,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_array_map::pubkey_eq; use light_compressible::compression_info::CompressionInfo; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::ZDecompressMintAction, state::CompressedMint, COMPRESSED_MINT_SEED, }; use light_program_profiler::profile; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to.rs index 1f096e686c..287f6c5fe6 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to.rs @@ -1,7 +1,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_compressed_account::Pubkey; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::mint_action::ZMintToCompressedAction, state::CompressedMint, }; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs index 42c16fd356..f1f1bd2820 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs @@ -2,8 +2,8 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::Pubkey; -use light_ctoken_interface::{ - instructions::mint_action::ZMintToCTokenAction, state::CompressedMint, +use light_token_interface::{ + instructions::mint_action::ZMintToTokenAction, state::CompressedMint, }; use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; @@ -16,7 +16,7 @@ use crate::compressed_token::{ #[allow(clippy::too_many_arguments)] #[profile] pub fn process_mint_to_ctoken_action( - action: &ZMintToCTokenAction, + action: &ZMintToTokenAction, compressed_mint: &mut CompressedMint, validated_accounts: &MintActionAccounts, packed_accounts: &ProgramPackedAccounts<'_, AccountInfo>, diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs index 2527be3a99..255f6da876 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs @@ -3,11 +3,11 @@ use anchor_lang::prelude::ProgramError; use arrayvec::ArrayVec; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::instruction_data::data::ZOutputCompressedAccountWithPackedContextMut; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::mint_action::{ZAction, ZMintActionCompressedInstructionData}, state::CompressedMint, - CTokenError, + TokenError, }; use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; @@ -86,7 +86,7 @@ pub fn process_actions<'a>( compressed_mint.base.freeze_authority = update_action.new_authority.as_ref().map(|a| **a); } - ZAction::MintToCToken(mint_to_ctoken_action) => { + ZAction::MintToToken(mint_to_ctoken_action) => { let account_index = mint_to_ctoken_action.account_index as usize; if account_index >= MAX_PACKED_ACCOUNTS { msg!( @@ -180,7 +180,7 @@ pub fn process_actions<'a>( if !transfers.is_empty() { // Check budget wasn't exhausted (0 means exceeded max_top_up) if max_top_up != 0 && lamports_budget == 0 { - return Err(CTokenError::MaxTopUpExceeded.into()); + return Err(TokenError::MaxTopUpExceeded.into()); } let fee_payer = validated_accounts diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/update_metadata.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/update_metadata.rs index 7738b17be2..d9b43f764a 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/update_metadata.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/update_metadata.rs @@ -1,7 +1,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_compressed_account::Pubkey; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{ ZRemoveMetadataKeyAction, ZUpdateMetadataAuthorityAction, ZUpdateMetadataFieldAction, }, @@ -87,7 +87,7 @@ pub fn process_update_metadata_field_action( } else { // TODO: Enable adding new keys for SPL Token-2022 compatibility // metadata.additional_metadata.push( - // light_ctoken_interface::state::AdditionalMetadata { + // light_token_interface::state::AdditionalMetadata { // key: action.key.to_vec(), // value: action.value.to_vec(), // } diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/mint_input.rs b/programs/compressed-token/program/src/compressed_token/mint_action/mint_input.rs index bf88821327..0a69bee2ef 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/mint_input.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/mint_input.rs @@ -1,7 +1,7 @@ use anchor_lang::solana_program::program_error::ProgramError; use borsh::BorshSerialize; use light_compressed_account::instruction_data::with_readonly::ZInAccountMut; -use light_ctoken_interface::state::CompressedMint; +use light_token_interface::state::CompressedMint; use light_hasher::{sha256::Sha256BE, Hasher}; use light_program_profiler::profile; use light_sdk::instruction::PackedMerkleContext; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/mint_output.rs b/programs/compressed-token/program/src/compressed_token/mint_action/mint_output.rs index 490a50eae2..b4536898ef 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/mint_output.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/mint_output.rs @@ -3,7 +3,7 @@ use anchor_lang::prelude::ProgramError; use borsh::BorshSerialize; use light_compressed_account::instruction_data::data::ZOutputCompressedAccountWithPackedContextMut; use light_compressible::rent::get_rent_exemption_lamports; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::mint_action::ZMintActionCompressedInstructionData, state::CompressedMint, }; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/processor.rs b/programs/compressed-token/program/src/compressed_token/mint_action/processor.rs index a9ab508107..b8d6783c15 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/processor.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/processor.rs @@ -1,9 +1,9 @@ use anchor_compressed_token::{is_idempotent_early_exit, ErrorCode}; use anchor_lang::prelude::ProgramError; use light_compressed_account::instruction_data::with_readonly::InstructionDataInvokeCpiWithReadOnly; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::mint_action::MintActionCompressedInstructionData, - state::CompressedMint, CTokenError, + state::CompressedMint, TokenError, }; use light_sdk::instruction::PackedMerkleContext; use light_zero_copy::{traits::ZeroCopyAt, ZeroCopyNew}; @@ -108,7 +108,7 @@ pub fn process_mint_action( &parsed_instruction_data, validated_accounts .mint_signer - .ok_or(CTokenError::ExpectedMintSignerAccount) + .ok_or(TokenError::ExpectedMintSignerAccount) .map_err(|_| ErrorCode::MintActionMissingExecutingAccounts)? .key(), &mut cpi_instruction_struct, diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/queue_indices.rs b/programs/compressed-token/program/src/compressed_token/mint_action/queue_indices.rs index d60dc3fa33..d1b66aca7f 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/queue_indices.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/queue_indices.rs @@ -1,5 +1,5 @@ use anchor_compressed_token::ErrorCode; -use light_ctoken_interface::instructions::mint_action::ZCpiContext; +use light_token_interface::instructions::mint_action::ZCpiContext; use light_program_profiler::profile; #[derive(Debug, PartialEq)] diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/zero_copy_config.rs b/programs/compressed-token/program/src/compressed_token/mint_action/zero_copy_config.rs index 24f453d035..2c04319bcf 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/zero_copy_config.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/zero_copy_config.rs @@ -1,7 +1,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_compressed_account::instruction_data::with_readonly::InstructionDataInvokeCpiWithReadOnlyConfig; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{ZAction, ZMintActionCompressedInstructionData}, state::{CompressedMint, CompressedMintConfig}, }; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/change_account.rs b/programs/compressed-token/program/src/compressed_token/transfer2/change_account.rs index e65ea661bb..1a85f683a1 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/change_account.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/change_account.rs @@ -3,7 +3,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::instruction_data::with_readonly::ZInstructionDataInvokeCpiWithReadOnlyMut; -use light_ctoken_interface::instructions::transfer2::ZCompressedTokenInstructionDataTransfer2; +use light_token_interface::instructions::transfer2::ZCompressedTokenInstructionDataTransfer2; use pinocchio::account_info::AccountInfo; use crate::compressed_token::transfer2::config::Transfer2Config; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/check_extensions.rs b/programs/compressed-token/program/src/compressed_token/transfer2/check_extensions.rs index f3c67fd536..22068c42a9 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/check_extensions.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/check_extensions.rs @@ -2,7 +2,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_array_map::ArrayMap; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::ZExtensionInstructionData, transfer2::ZCompressedTokenInstructionDataTransfer2, }, diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_and_close.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_and_close.rs index 83449e92e4..ba8b8533a3 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_and_close.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_and_close.rs @@ -2,13 +2,13 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use bitvec::prelude::*; use light_account_checks::{checks::check_signer, packed_accounts::ProgramPackedAccounts}; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::ZExtensionInstructionData, transfer2::{ZCompression, ZCompressionMode, ZMultiTokenTransferOutputData}, }, - state::{TokenDataVersion, ZCTokenMut, ZExtensionStructMut}, - CTokenError, + state::{TokenDataVersion, ZTokenMut, ZExtensionStructMut}, + TokenError, }; use light_program_profiler::profile; use pinocchio::{ @@ -32,7 +32,7 @@ pub fn process_compress_and_close( compress_and_close_inputs: Option, amount: u64, token_account_info: &AccountInfo, - ctoken: &mut ZCTokenMut, + ctoken: &mut ZTokenMut, packed_accounts: &ProgramPackedAccounts<'_, AccountInfo>, ) -> Result<(), ProgramError> { let authority = authority.ok_or(ErrorCode::CompressAndCloseAuthorityMissing)?; @@ -92,13 +92,13 @@ fn validate_compressed_token_account( packed_accounts: &ProgramPackedAccounts<'_, AccountInfo>, compression_amount: u64, compressed_token_account: &ZMultiTokenTransferOutputData<'_>, - ctoken: &ZCTokenMut, + ctoken: &ZTokenMut, token_account_pubkey: &Pubkey, out_tlv: Option<&[ZExtensionInstructionData<'_>]>, ) -> Result<(), ProgramError> { let compression = ctoken .get_compressible_extension() - .ok_or::(CTokenError::MissingCompressibleExtension.into())?; + .ok_or::(TokenError::MissingCompressibleExtension.into())?; // 1. Owner validation // compress_to_pubkey is derived from the extension (already fetched above) @@ -170,9 +170,9 @@ fn validate_compressed_token_account( fn validate_compressed_only_ext( packed_accounts: &ProgramPackedAccounts<'_, AccountInfo>, compressed_token_account: &ZMultiTokenTransferOutputData<'_>, - ctoken: &ZCTokenMut, - ext: &light_ctoken_interface::instructions::extensions::compressed_only::ZCompressedOnlyExtensionInstructionData, - compression: &light_ctoken_interface::state::ZCompressibleExtensionMut<'_>, + ctoken: &ZTokenMut, + ext: &light_token_interface::instructions::extensions::compressed_only::ZCompressedOnlyExtensionInstructionData, + compression: &light_token_interface::state::ZCompressibleExtensionMut<'_>, ) -> Result<(), ProgramError> { // 7a. Delegated amount must match let ext_delegated: u64 = ext.delegated_amount.into(); @@ -291,7 +291,7 @@ fn validate_ctoken_account( token_account: &AccountInfo, authority: &AccountInfo, rent_sponsor: &AccountInfo, - ctoken: &ZCTokenMut<'_>, + ctoken: &ZTokenMut<'_>, ) -> Result<(), ProgramError> { // Check for Compressible extension let compressible = ctoken.get_compressible_extension(); diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_or_decompress_ctokens.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_or_decompress_ctokens.rs index e1179e41fe..0d5d11b992 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_or_decompress_ctokens.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_or_decompress_ctokens.rs @@ -1,10 +1,10 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::checks::check_owner; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::transfer2::ZCompressionMode, - state::{CToken, ZCTokenMut}, - CTokenError, + state::{Token, ZTokenMut}, + TokenError, }; use light_program_profiler::profile; use light_zero_copy::traits::ZeroCopyAtMut; @@ -46,7 +46,7 @@ pub fn compress_or_decompress_ctokens( .try_borrow_mut_data() .map_err(|_| ProgramError::AccountBorrowFailed)?; - let (mut ctoken, _) = CToken::zero_copy_at_mut(&mut token_account_data)?; + let (mut ctoken, _) = Token::zero_copy_at_mut(&mut token_account_data)?; validate_ctoken(&ctoken, &mint, &mode)?; // Get current balance @@ -59,7 +59,7 @@ pub fn compress_or_decompress_ctokens( let authority_account = authority.ok_or(ErrorCode::InvalidCompressAuthority)?; check_ctoken_owner(&mut ctoken, authority_account, mint_checks.as_ref())?; if !ctoken.is_initialized() { - return Err(CTokenError::InvalidAccountState.into()); + return Err(TokenError::InvalidAccountState.into()); } // Compress: subtract from solana account @@ -128,20 +128,20 @@ pub fn compress_or_decompress_ctokens( /// - Mint matches expected mint #[inline(always)] fn validate_ctoken( - ctoken: &ZCTokenMut, + ctoken: &ZTokenMut, mint: &[u8; 32], mode: &ZCompressionMode, ) -> Result<(), ProgramError> { // Account type check: must be CToken account (byte 165 == 2) - if !ctoken.is_ctoken_account() { + if !ctoken.is_token_account() { msg!("Invalid account type"); - return Err(CTokenError::InvalidAccountType.into()); + return Err(TokenError::InvalidAccountType.into()); } // Reject uninitialized accounts (state == 0) if ctoken.base.is_uninitialized() { msg!("Account is uninitialized"); - return Err(CTokenError::InvalidAccountState.into()); + return Err(TokenError::InvalidAccountState.into()); } // Frozen accounts can only be modified via CompressAndClose @@ -157,7 +157,7 @@ fn validate_ctoken( solana_pubkey::Pubkey::new_from_array(ctoken.mint.to_bytes()), solana_pubkey::Pubkey::new_from_array(*mint) ); - return Err(CTokenError::MintMismatch.into()); + return Err(TokenError::MintMismatch.into()); } Ok(()) diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/decompress.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/decompress.rs index 5cd6adbb28..c5be0be89b 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/decompress.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/decompress.rs @@ -1,10 +1,10 @@ use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::Pubkey; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::{find_compressed_only, ZCompressedOnlyExtensionInstructionData}, - state::{ZCTokenMut, ZExtensionStructMut}, - CTokenError, + state::{ZTokenMut, ZExtensionStructMut}, + TokenError, }; use pinocchio::{account_info::AccountInfo, pubkey::pubkey_eq}; use spl_pod::solana_msg::msg; @@ -15,7 +15,7 @@ use super::inputs::DecompressCompressOnlyInputs; #[inline(always)] pub fn validate_and_apply_compressed_only( destination_account: &AccountInfo, - ctoken: &mut ZCTokenMut, + ctoken: &mut ZTokenMut, decompress_inputs: Option, packed_accounts: &ProgramPackedAccounts<'_, AccountInfo>, compression_amount: u64, @@ -41,7 +41,7 @@ pub fn validate_and_apply_compressed_only( compression_amount, input_amount ); - return Err(CTokenError::DecompressAmountMismatch.into()); + return Err(TokenError::DecompressAmountMismatch.into()); } } @@ -75,7 +75,7 @@ pub fn validate_and_apply_compressed_only( /// For ATA: destination address == input_owner (ATA pubkey), and CToken owner == wallet_owner #[inline(always)] fn validate_destination( - ctoken: &ZCTokenMut, + ctoken: &ZTokenMut, destination: &AccountInfo, input_owner_key: &[u8; 32], ext_data: &ZCompressedOnlyExtensionInstructionData, @@ -85,7 +85,7 @@ fn validate_destination( if !ext_data.is_ata() { if !pubkey_eq(ctoken.base.owner.array_ref(), input_owner_key) { msg!("Decompress destination owner mismatch"); - return Err(CTokenError::DecompressDestinationMismatch.into()); + return Err(TokenError::DecompressDestinationMismatch.into()); } return Ok(()); } @@ -93,14 +93,14 @@ fn validate_destination( // ATA: destination address == input_owner (ATA pubkey) if !pubkey_eq(destination.key(), input_owner_key) { msg!("Decompress ATA: destination address mismatch"); - return Err(CTokenError::DecompressDestinationMismatch.into()); + return Err(TokenError::DecompressDestinationMismatch.into()); } // ATA: wallet owner == CToken owner field let wallet = packed_accounts.get_u8(ext_data.owner_index, "wallet owner")?; if !pubkey_eq(wallet.key(), ctoken.base.owner.array_ref()) { msg!("Decompress ATA: wallet owner mismatch"); - return Err(CTokenError::DecompressDestinationMismatch.into()); + return Err(TokenError::DecompressDestinationMismatch.into()); } Ok(()) } @@ -108,7 +108,7 @@ fn validate_destination( /// Apply delegate state. Resolves delegate only when needed (inside the check). #[inline(always)] fn apply_delegate( - ctoken: &mut ZCTokenMut, + ctoken: &mut ZTokenMut, ext_data: &ZCompressedOnlyExtensionInstructionData, inputs: &DecompressCompressOnlyInputs, packed_accounts: &ProgramPackedAccounts<'_, AccountInfo>, @@ -141,7 +141,7 @@ fn apply_delegate( } } else if delegated_amount > 0 { msg!("Decompress: delegated_amount > 0 but no delegate"); - return Err(CTokenError::DecompressDelegatedAmountWithoutDelegate.into()); + return Err(TokenError::DecompressDelegatedAmountWithoutDelegate.into()); } Ok(()) @@ -150,7 +150,7 @@ fn apply_delegate( /// Apply withheld transfer fee to TransferFeeAccount extension. #[inline(always)] fn apply_withheld_fee( - ctoken: &mut ZCTokenMut, + ctoken: &mut ZTokenMut, ext_data: &ZCompressedOnlyExtensionInstructionData, ) -> Result<(), ProgramError> { let fee: u64 = ext_data.withheld_transfer_fee.into(); @@ -169,7 +169,7 @@ fn apply_withheld_fee( Some(f) => Ok(f.add_withheld_amount(fee)?), None => { msg!("Decompress: withheld fee but no TransferFeeAccount extension"); - Err(CTokenError::DecompressWithheldFeeWithoutExtension.into()) + Err(TokenError::DecompressWithheldFeeWithoutExtension.into()) } } } diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/inputs.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/inputs.rs index db32dee1d0..ae8078cda5 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/inputs.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/inputs.rs @@ -1,6 +1,6 @@ use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; -use light_ctoken_interface::instructions::{ +use light_token_interface::instructions::{ extensions::ZExtensionInstructionData, transfer2::{ ZCompressedTokenInstructionDataTransfer2, ZCompression, ZCompressionMode, diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/mod.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/mod.rs index f268e7791e..c63366ed6d 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/mod.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/mod.rs @@ -1,5 +1,5 @@ use light_account_checks::packed_accounts::ProgramPackedAccounts; -use light_ctoken_interface::instructions::transfer2::{ +use light_token_interface::instructions::transfer2::{ ZCompressedTokenInstructionDataTransfer2, ZCompression, }; use light_program_profiler::profile; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/mod.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/mod.rs index 28cb5a6e8f..689ed028e0 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/mod.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/mod.rs @@ -3,11 +3,11 @@ use anchor_lang::prelude::ProgramError; use arrayvec::ArrayVec; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::pubkey::AsPubkey; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::transfer2::{ ZCompressedTokenInstructionDataTransfer2, ZCompression, ZCompressionMode, }, - CTokenError, + TokenError, }; use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; @@ -175,7 +175,7 @@ pub fn process_token_compression<'a>( if !transfers.is_empty() { // Check budget wasn't exhausted (0 means exceeded max_top_up) if max_top_up != 0 && lamports_budget == 0 { - return Err(CTokenError::MaxTopUpExceeded.into()); + return Err(TokenError::MaxTopUpExceeded.into()); } multi_transfer_lamports(fee_payer, &transfers).map_err(convert_program_error)? } diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/spl.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/spl.rs index 8e6b5c3d89..3e05be6988 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/spl.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/spl.rs @@ -1,7 +1,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::transfer2::{ZCompression, ZCompressionMode}, is_valid_spl_interface_pda, }; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/config.rs b/programs/compressed-token/program/src/compressed_token/transfer2/config.rs index 8dc242b060..3a05a0b528 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/config.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/config.rs @@ -1,5 +1,5 @@ use anchor_lang::prelude::ProgramError; -use light_ctoken_interface::instructions::transfer2::ZCompressedTokenInstructionDataTransfer2; +use light_token_interface::instructions::transfer2::ZCompressedTokenInstructionDataTransfer2; /// Configuration for Transfer2 account validation /// Replaces complex boolean parameters with clean single config object diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/cpi.rs b/programs/compressed-token/program/src/compressed_token/transfer2/cpi.rs index 98498171f0..4a0cc850fe 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/cpi.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/cpi.rs @@ -1,5 +1,5 @@ use light_compressed_account::instruction_data::with_readonly::InstructionDataInvokeCpiWithReadOnlyConfig; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::ZExtensionInstructionData, transfer2::ZCompressedTokenInstructionDataTransfer2, }, diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/processor.rs b/programs/compressed-token/program/src/compressed_token/transfer2/processor.rs index d33ee2dcdf..06a743c143 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/processor.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/processor.rs @@ -2,7 +2,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_array_map::ArrayMap; use light_compressed_account::instruction_data::with_readonly::InstructionDataInvokeCpiWithReadOnly; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::{ extensions::ZExtensionInstructionData, @@ -11,7 +11,7 @@ use light_ctoken_interface::{ ZCompressionMode, }, }, - CTokenError, + TokenError, }; use light_program_profiler::profile; use light_zero_copy::{traits::ZeroCopyAt, ZeroCopyNew}; @@ -79,7 +79,7 @@ pub fn process_transfer2( #[inline(always)] pub fn validate_instruction_data( inputs: &ZCompressedTokenInstructionDataTransfer2, -) -> Result<(), CTokenError> { +) -> Result<(), TokenError> { // Check maximum input accounts limit if inputs.in_token_data.len() > crate::shared::cpi_bytes_size::MAX_INPUT_ACCOUNTS { msg!( @@ -87,14 +87,14 @@ pub fn validate_instruction_data( inputs.in_token_data.len(), crate::shared::cpi_bytes_size::MAX_INPUT_ACCOUNTS ); - return Err(CTokenError::TooManyInputAccounts); + return Err(TokenError::TooManyInputAccounts); } if inputs.in_lamports.is_some() { - return Err(CTokenError::InLamportsUnimplemented); + return Err(TokenError::InLamportsUnimplemented); } if inputs.out_lamports.is_some() { - return Err(CTokenError::OutLamportsUnimplemented); + return Err(TokenError::OutLamportsUnimplemented); } // Validate in_tlv length matches in_token_data if provided if let Some(in_tlv) = inputs.in_tlv.as_ref() { @@ -104,7 +104,7 @@ pub fn validate_instruction_data( in_tlv.len(), inputs.in_token_data.len() ); - return Err(CTokenError::InvalidInstructionData); + return Err(TokenError::InvalidInstructionData); } // CompressedOnly inputs can only decompress - no compressed outputs allowed @@ -115,7 +115,7 @@ pub fn validate_instruction_data( }); if has_compressed_only && !inputs.out_token_data.is_empty() { msg!("CompressedOnly inputs cannot have compressed outputs"); - return Err(CTokenError::CompressedOnlyBlocksTransfer); + return Err(TokenError::CompressedOnlyBlocksTransfer); } } // out_tlv is only allowed for CompressAndClose when rent authority is signer @@ -128,7 +128,7 @@ pub fn validate_instruction_data( out_tlv.len(), inputs.out_token_data.len() ); - return Err(CTokenError::InvalidInstructionData); + return Err(TokenError::InvalidInstructionData); } // All compressions must be CompressAndClose @@ -138,12 +138,12 @@ pub fn validate_instruction_data( .all(|c| c.mode == ZCompressionMode::CompressAndClose) }); if !allowed { - return Err(CTokenError::CompressedTokenAccountTlvUnimplemented); + return Err(TokenError::CompressedTokenAccountTlvUnimplemented); } // All out_token_data must be version 3 (sha flat) if tlv is present. let allowed = inputs.out_token_data.iter().all(|c| c.version == 3); if !allowed { - return Err(CTokenError::CompressedTokenAccountTlvUnimplemented); + return Err(TokenError::CompressedTokenAccountTlvUnimplemented); } // Output count must match compressions count (no extra outputs) @@ -151,10 +151,10 @@ pub fn validate_instruction_data( .compressions .as_ref() .map(|c| c.len()) - .ok_or(CTokenError::OutTlvOutputCountMismatch)?; + .ok_or(TokenError::OutTlvOutputCountMismatch)?; if inputs.out_token_data.len() != compressions_len { msg!("out_tlv requires out_token_data.len() == compressions.len()"); - return Err(CTokenError::OutTlvOutputCountMismatch); + return Err(TokenError::OutTlvOutputCountMismatch); } } @@ -166,7 +166,7 @@ pub fn validate_instruction_data( && inputs.compressions.is_some() { msg!("Compressions not allowed when writing to CPI context"); - return Err(CTokenError::InvalidInstructionData); + return Err(TokenError::InvalidInstructionData); } } diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/sum_check.rs b/programs/compressed-token/program/src/compressed_token/transfer2/sum_check.rs index c7039597c1..5dc2795526 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/sum_check.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/sum_check.rs @@ -1,7 +1,7 @@ use anchor_compressed_token::ErrorCode; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_array_map::ArrayMap; -use light_ctoken_interface::instructions::transfer2::{ +use light_token_interface::instructions::transfer2::{ ZCompression, ZCompressionMode, ZMultiInputTokenDataWithContext, ZMultiTokenTransferOutputData, }; use light_program_profiler::profile; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/token_inputs.rs b/programs/compressed-token/program/src/compressed_token/transfer2/token_inputs.rs index 26df5b35d7..19aca6a0d2 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/token_inputs.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/token_inputs.rs @@ -1,12 +1,12 @@ use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::instruction_data::with_readonly::ZInstructionDataInvokeCpiWithReadOnlyMut; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::{ extensions::ZExtensionInstructionData, transfer2::ZCompressedTokenInstructionDataTransfer2, }, - CTokenError, + TokenError, }; use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; @@ -55,11 +55,11 @@ pub fn set_input_compressed_accounts<'a>( let idx = co.compression_index as usize; // Check bounds before array access if idx >= MAX_COMPRESSIONS { - return Err(CTokenError::CompressionIndexOutOfBounds.into()); + return Err(TokenError::CompressionIndexOutOfBounds.into()); } // Check uniqueness - error if compression_index already used if compression_to_input[idx].is_some() { - return Err(CTokenError::DuplicateCompressionIndex.into()); + return Err(TokenError::DuplicateCompressionIndex.into()); } compression_to_input[idx] = Some(i as u8); } diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/token_outputs.rs b/programs/compressed-token/program/src/compressed_token/transfer2/token_outputs.rs index ab6b2ec6d0..b9af4eca86 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/token_outputs.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/token_outputs.rs @@ -1,7 +1,7 @@ use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::instruction_data::with_readonly::ZInstructionDataInvokeCpiWithReadOnlyMut; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::{ extensions::ZExtensionInstructionData, transfer2::ZCompressedTokenInstructionDataTransfer2, diff --git a/programs/compressed-token/program/src/compressible/claim.rs b/programs/compressed-token/program/src/compressible/claim.rs index 5bfed2337b..b04d65f3a6 100644 --- a/programs/compressed-token/program/src/compressible/claim.rs +++ b/programs/compressed-token/program/src/compressible/claim.rs @@ -2,9 +2,9 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::{checks::check_owner, AccountInfoTrait, AccountIterator}; use light_compressible::{compression_info::ClaimAndUpdate, config::CompressibleConfig}; -use light_ctoken_interface::{ - state::{CToken, CompressedMint, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT}, - CTokenError, +use light_token_interface::{ + state::{Token, CompressedMint, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT}, + TokenError, }; use light_program_profiler::profile; use pinocchio::{account_info::AccountInfo, sysvars::Sysvar}; @@ -135,10 +135,10 @@ fn validate_and_claim( match account_type { ACCOUNT_TYPE_TOKEN_ACCOUNT => { // CToken account - let (mut ctoken, _) = CToken::zero_copy_at_mut_checked(&mut account_data)?; + let (mut ctoken, _) = Token::zero_copy_at_mut_checked(&mut account_data)?; let compressible = ctoken .get_compressible_extension_mut() - .ok_or::(CTokenError::MissingCompressibleExtension.into())?; + .ok_or::(TokenError::MissingCompressibleExtension.into())?; compressible .info .claim_and_update(claim_and_update) diff --git a/programs/compressed-token/program/src/ctoken/approve_revoke.rs b/programs/compressed-token/program/src/ctoken/approve_revoke.rs index 8ee40e3db1..c6296f3758 100644 --- a/programs/compressed-token/program/src/ctoken/approve_revoke.rs +++ b/programs/compressed-token/program/src/ctoken/approve_revoke.rs @@ -4,8 +4,8 @@ use pinocchio_token_program::processor::{approve::process_approve, revoke::proce #[cfg(target_os = "solana")] use { crate::shared::{convert_program_error, transfer_lamports_via_cpi}, - light_ctoken_interface::state::top_up_lamports_from_account_info_unchecked, - light_ctoken_interface::CTokenError, + light_token_interface::state::top_up_lamports_from_account_info_unchecked, + light_token_interface::TokenError, }; use crate::shared::convert_pinocchio_token_error; @@ -112,9 +112,9 @@ fn process_compressible_top_up( if transfer_amount > 0 { if max_top_up > 0 && transfer_amount > max_top_up as u64 { - return Err(CTokenError::MaxTopUpExceeded.into()); + return Err(TokenError::MaxTopUpExceeded.into()); } - let payer = payer.ok_or(CTokenError::MissingPayer)?; + let payer = payer.ok_or(TokenError::MissingPayer)?; transfer_lamports_via_cpi(transfer_amount, payer, account) .map_err(convert_program_error)?; } diff --git a/programs/compressed-token/program/src/ctoken/close/processor.rs b/programs/compressed-token/program/src/ctoken/close/processor.rs index 0c8684256d..5fb7285168 100644 --- a/programs/compressed-token/program/src/ctoken/close/processor.rs +++ b/programs/compressed-token/program/src/ctoken/close/processor.rs @@ -2,7 +2,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::{checks::check_signer, AccountInfoTrait}; use light_compressible::rent::AccountRentState; -use light_ctoken_interface::state::{AccountState, CToken, ZCTokenMut}; +use light_token_interface::state::{AccountState, Token, ZTokenMut}; use light_program_profiler::profile; #[cfg(target_os = "solana")] use pinocchio::sysvars::Sysvar; @@ -22,7 +22,7 @@ pub fn process_close_token_account( let accounts = CloseTokenAccountAccounts::validate_and_parse(account_infos)?; { // Try to parse as CToken using zero-copy deserialization - let ctoken = CToken::from_account_info_mut_checked(accounts.token_account)?; + let ctoken = Token::from_account_info_mut_checked(accounts.token_account)?; validate_token_account_close(&accounts, &ctoken)?; } close_token_account(&accounts)?; @@ -34,7 +34,7 @@ pub fn process_close_token_account( #[profile] fn validate_token_account_close( accounts: &CloseTokenAccountAccounts, - ctoken: &ZCTokenMut<'_>, + ctoken: &ZTokenMut<'_>, ) -> Result<(), ProgramError> { if accounts.token_account.key() == accounts.destination.key() { return Err(ProgramError::InvalidAccountData); @@ -114,7 +114,7 @@ pub fn distribute_lamports(accounts: &CloseTokenAccountAccounts<'_>) -> Result<( })?; // Check for compressible extension and handle lamport distribution - let ctoken = CToken::from_account_info_checked(accounts.token_account)?; + let ctoken = Token::from_account_info_checked(accounts.token_account)?; // Check for Compressible extension let compressible = ctoken.get_compressible_extension(); diff --git a/programs/compressed-token/program/src/ctoken/create.rs b/programs/compressed-token/program/src/ctoken/create.rs index cd36e95435..7d28d681e3 100644 --- a/programs/compressed-token/program/src/ctoken/create.rs +++ b/programs/compressed-token/program/src/ctoken/create.rs @@ -2,7 +2,7 @@ use anchor_lang::prelude::ProgramError; use borsh::BorshDeserialize; use light_account_checks::AccountIterator; use light_compressed_account::Pubkey; -use light_ctoken_interface::instructions::create_ctoken_account::CreateTokenAccountInstructionData; +use light_token_interface::instructions::create_token_account::CreateTokenAccountInstructionData; use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/ctoken/create_ata.rs b/programs/compressed-token/program/src/ctoken/create_ata.rs index c5ce1dc004..d5847c6f77 100644 --- a/programs/compressed-token/program/src/ctoken/create_ata.rs +++ b/programs/compressed-token/program/src/ctoken/create_ata.rs @@ -1,7 +1,7 @@ use anchor_lang::prelude::ProgramError; use borsh::BorshDeserialize; use light_account_checks::AccountIterator; -use light_ctoken_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; +use light_token_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; use light_program_profiler::profile; use pinocchio::{account_info::AccountInfo, instruction::Seed}; use spl_pod::solana_msg::msg; @@ -115,7 +115,7 @@ fn process_create_associated_token_account_with_mode( } else { // Non-compressible path: fee_payer pays for account creation directly // Non-compressible accounts have no extensions (base 165-byte SPL layout) - let account_size = light_ctoken_interface::BASE_TOKEN_ACCOUNT_SIZE as usize; + let account_size = light_token_interface::BASE_TOKEN_ACCOUNT_SIZE as usize; create_pda_account( fee_payer, diff --git a/programs/compressed-token/program/src/ctoken/transfer/shared.rs b/programs/compressed-token/program/src/ctoken/transfer/shared.rs index 1d63d8f524..b4e04d73f8 100644 --- a/programs/compressed-token/program/src/ctoken/transfer/shared.rs +++ b/programs/compressed-token/program/src/ctoken/transfer/shared.rs @@ -1,8 +1,8 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; -use light_ctoken_interface::{ - state::{CToken, ZExtensionStructMut}, - CTokenError, MintExtensionFlags, +use light_token_interface::{ + state::{Token, ZExtensionStructMut}, + TokenError, MintExtensionFlags, }; use light_program_profiler::profile; use pinocchio::{account_info::AccountInfo, pubkey::pubkey_eq}; @@ -129,7 +129,7 @@ fn transfer_top_up( // Check budget if max_top_up is set (non-zero) let total_top_up = sender_top_up.saturating_add(recipient_top_up); if max_top_up != 0 && total_top_up > max_top_up as u64 { - return Err(CTokenError::MaxTopUpExceeded.into()); + return Err(TokenError::MaxTopUpExceeded.into()); } let transfers = [ @@ -223,12 +223,12 @@ fn process_account_extensions( current_slot: &mut u64, mint: Option<&AccountInfo>, ) -> Result { - let token = CToken::from_account_info_mut_checked(account)?; + let token = Token::from_account_info_mut_checked(account)?; // Validate mint account matches token's mint field if let Some(mint_account) = mint { if !pubkey_eq(mint_account.key(), token.mint.array_ref()) { - return Err(CTokenError::InvalidAccountData.into()); + return Err(TokenError::InvalidAccountData.into()); } } @@ -240,14 +240,14 @@ fn process_account_extensions( use pinocchio::sysvars::{clock::Clock, Sysvar}; if *current_slot == 0 { *current_slot = Clock::get() - .map_err(|_| CTokenError::SysvarAccessError)? + .map_err(|_| TokenError::SysvarAccessError)? .slot; } info.top_up_amount = compression .info .calculate_top_up_lamports(account.data_len() as u64, *current_slot, account.lamports()) - .map_err(|_| CTokenError::InvalidAccountData)?; + .map_err(|_| TokenError::InvalidAccountData)?; // Extract cached decimals if set info.decimals = compression.decimals(); @@ -277,7 +277,7 @@ fn process_account_extensions( } // Placeholder and TokenMetadata variants are not valid for CToken accounts _ => { - return Err(CTokenError::InvalidAccountData.into()); + return Err(TokenError::InvalidAccountData.into()); } } } diff --git a/programs/compressed-token/program/src/extensions/check_mint_extensions.rs b/programs/compressed-token/program/src/extensions/check_mint_extensions.rs index 15c2e6cd24..7409a16a31 100644 --- a/programs/compressed-token/program/src/extensions/check_mint_extensions.rs +++ b/programs/compressed-token/program/src/extensions/check_mint_extensions.rs @@ -1,7 +1,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::AccountInfoTrait; -use light_ctoken_interface::{ +use light_token_interface::{ is_restricted_extension, MintExtensionFlags, ALLOWED_EXTENSION_TYPES, }; use pinocchio::{account_info::AccountInfo, msg, pubkey::Pubkey}; diff --git a/programs/compressed-token/program/src/extensions/mod.rs b/programs/compressed-token/program/src/extensions/mod.rs index c6cdcd6c3b..433d25c86f 100644 --- a/programs/compressed-token/program/src/extensions/mod.rs +++ b/programs/compressed-token/program/src/extensions/mod.rs @@ -7,16 +7,16 @@ pub use check_mint_extensions::{ check_mint_extensions, has_mint_extensions, parse_mint_extensions, MintExtensionChecks, }; // Import from ctoken-types instead of local modules -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::ZAction, state::{ AdditionalMetadata, AdditionalMetadataConfig, ExtensionStruct, ExtensionStructConfig, TokenMetadata, TokenMetadataConfig, }, - CTokenError, + TokenError, }; -// Re-export from ctoken-interface (consolidated types) -pub use light_ctoken_interface::{ +// Re-export from token-interface (consolidated types) +pub use light_token_interface::{ is_restricted_extension, MintExtensionFlags, ALLOWED_EXTENSION_TYPES, RESTRICTED_EXTENSION_TYPES, }; @@ -36,7 +36,7 @@ pub fn should_include_in_compressed_output(extension: &ExtensionStruct) -> bool pub fn process_extensions_config_with_actions( extensions: Option<&Vec>, actions: &[ZAction], -) -> Result<(bool, Vec, usize), CTokenError> { +) -> Result<(bool, Vec, usize), TokenError> { let mut additional_mint_data_len = 0; let mut config_vec = Vec::new(); @@ -58,7 +58,7 @@ pub fn process_extensions_config_with_actions( extension_index, )? } - _ => return Err(CTokenError::UnsupportedExtension), + _ => return Err(TokenError::UnsupportedExtension), } } } @@ -77,14 +77,14 @@ fn process_token_metadata_config_with_actions( token_metadata: &TokenMetadata, actions: &[ZAction], extension_index: usize, -) -> Result<(), CTokenError> { +) -> Result<(), TokenError> { // Early validation - no allocations needed if token_metadata.additional_metadata.len() > 20 { msg!( "Too many additional metadata elements: {} (max 20)", token_metadata.additional_metadata.len() ); - return Err(CTokenError::TooManyAdditionalMetadata); + return Err(TokenError::TooManyAdditionalMetadata); } // Check for duplicate keys (O(n^2) but acceptable for max 20 items) @@ -94,7 +94,7 @@ fn process_token_metadata_config_with_actions( == token_metadata.additional_metadata[j].key { msg!("Duplicate metadata key found at positions {} and {}", i, j); - return Err(CTokenError::DuplicateMetadataKey); + return Err(TokenError::DuplicateMetadataKey); } } } diff --git a/programs/compressed-token/program/src/extensions/processor.rs b/programs/compressed-token/program/src/extensions/processor.rs index 097c26e0d1..332b88bd4f 100644 --- a/programs/compressed-token/program/src/extensions/processor.rs +++ b/programs/compressed-token/program/src/extensions/processor.rs @@ -1,6 +1,6 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::ZExtensionInstructionData, state::ZExtensionStructMut, }; use light_program_profiler::profile; diff --git a/programs/compressed-token/program/src/extensions/token_metadata.rs b/programs/compressed-token/program/src/extensions/token_metadata.rs index cf368ad788..3b012c4af3 100644 --- a/programs/compressed-token/program/src/extensions/token_metadata.rs +++ b/programs/compressed-token/program/src/extensions/token_metadata.rs @@ -1,6 +1,6 @@ use anchor_lang::prelude::ProgramError; use light_compressed_account::Pubkey; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::token_metadata::ZTokenMetadataInstructionData, state::ZTokenMetadataMut, }; diff --git a/programs/compressed-token/program/src/lib.rs b/programs/compressed-token/program/src/lib.rs index 0e1dd0e5d2..4bd80af46e 100644 --- a/programs/compressed-token/program/src/lib.rs +++ b/programs/compressed-token/program/src/lib.rs @@ -1,7 +1,7 @@ use std::mem::ManuallyDrop; use anchor_lang::solana_program::program_error::ProgramError; -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_sdk::{cpi::CpiSigner, derive_light_cpi_signer}; use pinocchio::{account_info::AccountInfo, msg}; @@ -134,7 +134,7 @@ pub fn process_instruction( instruction_data: &[u8], ) -> Result<(), ProgramError> { let discriminator = InstructionType::from(instruction_data[0]); - if *program_id != CTOKEN_PROGRAM_ID { + if *program_id != LIGHT_TOKEN_PROGRAM_ID { return Err(ProgramError::IncorrectProgramId); } match discriminator { diff --git a/programs/compressed-token/program/src/shared/compressible_top_up.rs b/programs/compressed-token/program/src/shared/compressible_top_up.rs index 291a630908..d26fd275be 100644 --- a/programs/compressed-token/program/src/shared/compressible_top_up.rs +++ b/programs/compressed-token/program/src/shared/compressible_top_up.rs @@ -1,9 +1,9 @@ use anchor_lang::solana_program::program_error::ProgramError; #[cfg(target_os = "solana")] -use light_ctoken_interface::state::{ +use light_token_interface::state::{ cmint_top_up_lamports_from_account_info, top_up_lamports_from_account_info_unchecked, }; -use light_ctoken_interface::CTokenError; +use light_token_interface::TokenError; use light_program_profiler::profile; use pinocchio::{ account_info::AccountInfo, @@ -74,9 +74,9 @@ pub fn calculate_and_execute_compressible_top_ups<'a>( // Check budget wasn't exhausted (0 means exceeded max_top_up) if max_top_up != 0 && lamports_budget == 0 { - return Err(CTokenError::MaxTopUpExceeded.into()); + return Err(TokenError::MaxTopUpExceeded.into()); } - let payer = payer.ok_or(CTokenError::MissingPayer)?; + let payer = payer.ok_or(TokenError::MissingPayer)?; multi_transfer_lamports(payer, &transfers).map_err(convert_program_error)?; Ok(()) } @@ -97,7 +97,7 @@ pub fn process_compression_top_up( if *current_slot == 0 { *current_slot = Clock::get() - .map_err(|_| CTokenError::SysvarAccessError)? + .map_err(|_| TokenError::SysvarAccessError)? .slot; } @@ -107,7 +107,7 @@ pub fn process_compression_top_up( *current_slot, account_info.lamports(), ) - .map_err(|_| CTokenError::InvalidAccountData)?; + .map_err(|_| TokenError::InvalidAccountData)?; *lamports_budget = lamports_budget.saturating_sub(*transfer_amount); diff --git a/programs/compressed-token/program/src/shared/cpi_bytes_size.rs b/programs/compressed-token/program/src/shared/cpi_bytes_size.rs index 12ad3c8dca..52b52660e5 100644 --- a/programs/compressed-token/program/src/shared/cpi_bytes_size.rs +++ b/programs/compressed-token/program/src/shared/cpi_bytes_size.rs @@ -9,7 +9,7 @@ use light_compressed_account::{ }, }, }; -use light_ctoken_interface::state::CompressedMint; +use light_token_interface::state::CompressedMint; use light_program_profiler::profile; use light_zero_copy::ZeroCopyNew; use pinocchio::program_error::ProgramError; @@ -21,7 +21,7 @@ const MAX_OUTPUT_ACCOUNTS: usize = 35; /// Calculate data length for a compressed mint account #[profile] #[inline(always)] -pub fn mint_data_len(config: &light_ctoken_interface::state::CompressedMintConfig) -> u32 { +pub fn mint_data_len(config: &light_token_interface::state::CompressedMintConfig) -> u32 { CompressedMint::byte_len(config).unwrap() as u32 } @@ -49,7 +49,7 @@ impl CpiConfigInput { pub fn mint_to_compressed( num_recipients: usize, has_proof: bool, - output_mint_config: &light_ctoken_interface::state::CompressedMintConfig, + output_mint_config: &light_token_interface::state::CompressedMintConfig, ) -> Self { let mut outputs = ArrayVec::new(); @@ -73,7 +73,7 @@ impl CpiConfigInput { #[profile] pub fn update_mint( has_proof: bool, - output_mint_config: &light_ctoken_interface::state::CompressedMintConfig, + output_mint_config: &light_token_interface::state::CompressedMintConfig, ) -> Self { let mut inputs = ArrayVec::new(); inputs.push(true); // Input mint has address diff --git a/programs/compressed-token/program/src/shared/initialize_ctoken_account.rs b/programs/compressed-token/program/src/shared/initialize_ctoken_account.rs index 2f10f2f5e0..86bf845fcf 100644 --- a/programs/compressed-token/program/src/shared/initialize_ctoken_account.rs +++ b/programs/compressed-token/program/src/shared/initialize_ctoken_account.rs @@ -1,13 +1,13 @@ use anchor_lang::prelude::ProgramError; use light_account_checks::AccountInfoTrait; use light_compressible::config::CompressibleConfig; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::CompressibleExtensionInstructionData, state::{ - ctoken::CompressedTokenConfig, AccountState, CToken, CompressibleExtensionConfig, + token::TokenConfig, AccountState, Token, CompressibleExtensionConfig, CompressionInfoConfig, ExtensionStructConfig, ACCOUNT_TYPE_MINT, }, - CTokenError, CTOKEN_PROGRAM_ID, + TokenError, LIGHT_TOKEN_PROGRAM_ID, }; use light_program_profiler::profile; use light_zero_copy::traits::ZeroCopyNew; @@ -189,7 +189,7 @@ pub fn initialize_ctoken_account( return Err(anchor_compressed_token::ErrorCode::MissingCompressibleConfig.into()); } // Build the config for new_zero_copy - let zc_config = CompressedTokenConfig { + let zc_config = TokenConfig { mint: light_compressed_account::Pubkey::from(*mint_account.key()), owner: light_compressed_account::Pubkey::from(*owner), state: if mint_extensions.default_state_frozen { @@ -210,7 +210,7 @@ pub fn initialize_ctoken_account( // Use new_zero_copy to initialize the token account // This sets mint, owner, state, account_type, and extensions let (mut ctoken, _) = - CToken::new_zero_copy(&mut token_account_data, zc_config).map_err(|e| { + Token::new_zero_copy(&mut token_account_data, zc_config).map_err(|e| { msg!("Failed to initialize CToken: {:?}", e); ProgramError::InvalidAccountData })?; @@ -228,7 +228,7 @@ pub fn initialize_ctoken_account( #[profile] #[inline(always)] fn configure_compression_info( - ctoken: &mut light_ctoken_interface::state::ZCTokenMut<'_>, + ctoken: &mut light_token_interface::state::ZTokenMut<'_>, compressible: CompressibleInitData<'_>, mint_account: &AccountInfo, ) -> Result<(), ProgramError> { @@ -243,7 +243,7 @@ fn configure_compression_info( // Get the Compressible extension (must exist since we added it) let compressible_ext = ctoken .get_compressible_extension_mut() - .ok_or(CTokenError::MissingCompressibleExtension)?; + .ok_or(TokenError::MissingCompressibleExtension)?; // Set config_account_version compressible_ext.info.config_account_version = config_account.version.into(); @@ -287,7 +287,7 @@ fn configure_compression_info( ix_data.write_top_up, config_account.rent_config.max_top_up ); - return Err(CTokenError::WriteTopUpExceedsMaximum.into()); + return Err(TokenError::WriteTopUpExceedsMaximum.into()); } compressible_ext .info @@ -342,7 +342,7 @@ pub fn is_valid_mint(owner: &Pubkey, mint_data: &[u8]) -> Result T22_ACCOUNT_TYPE_OFFSET && mint_data[T22_ACCOUNT_TYPE_OFFSET] == ACCOUNT_TYPE_MINT)) - } else if *owner == CTOKEN_PROGRAM_ID { + } else if *owner == LIGHT_TOKEN_PROGRAM_ID { // CToken: Always has extensions, must be >165 bytes with AccountType=Mint Ok(mint_data.len() > T22_ACCOUNT_TYPE_OFFSET && mint_data[T22_ACCOUNT_TYPE_OFFSET] == ACCOUNT_TYPE_MINT) diff --git a/programs/compressed-token/program/src/shared/owner_validation.rs b/programs/compressed-token/program/src/shared/owner_validation.rs index 2903f8a9f1..aa73837aaa 100644 --- a/programs/compressed-token/program/src/shared/owner_validation.rs +++ b/programs/compressed-token/program/src/shared/owner_validation.rs @@ -1,7 +1,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_account_checks::checks::check_signer; -use light_ctoken_interface::{state::ZCTokenMut, CTOKEN_PROGRAM_ID}; +use light_token_interface::{state::ZTokenMut, LIGHT_TOKEN_PROGRAM_ID}; use light_program_profiler::profile; use pinocchio::{account_info::AccountInfo, pubkey::pubkey_eq}; @@ -16,7 +16,7 @@ pub fn check_token_program_owner(account: &AccountInfo) -> Result<(), ProgramErr let owner = account.owner(); if pubkey_eq(owner, &SPL_TOKEN_ID) || pubkey_eq(owner, &SPL_TOKEN_2022_ID) - || pubkey_eq(owner, &CTOKEN_PROGRAM_ID) + || pubkey_eq(owner, &LIGHT_TOKEN_PROGRAM_ID) { Ok(()) } else { @@ -81,7 +81,7 @@ pub fn verify_owner_or_delegate_signer<'a>( /// Allows owner, account delegate, or permanent delegate (from mint) to authorize compression operations. #[profile] pub fn check_ctoken_owner( - compressed_token: &mut ZCTokenMut, + compressed_token: &mut ZTokenMut, authority_account: &AccountInfo, mint_checks: Option<&MintExtensionChecks>, ) -> Result<(), ProgramError> { diff --git a/programs/compressed-token/program/src/shared/token_input.rs b/programs/compressed-token/program/src/shared/token_input.rs index 3b2607d485..274cd57eb7 100644 --- a/programs/compressed-token/program/src/shared/token_input.rs +++ b/programs/compressed-token/program/src/shared/token_input.rs @@ -4,7 +4,7 @@ use anchor_compressed_token::{ErrorCode, TokenData}; use anchor_lang::solana_program::program_error::ProgramError; use light_account_checks::AccountError; use light_compressed_account::instruction_data::with_readonly::ZInAccountMut; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::{ extensions::ZExtensionInstructionData, transfer2::ZMultiInputTokenDataWithContext, @@ -12,7 +12,7 @@ use light_ctoken_interface::{ state::{ CompressedOnlyExtension, CompressedTokenAccountState, ExtensionStruct, TokenDataVersion, }, - CTokenError, + TokenError, }; use pinocchio::account_info::AccountInfo; @@ -222,11 +222,11 @@ fn resolve_ata_signer<'a>( &ata_seeds, &crate::LIGHT_CPI_SIGNER.program_id, ) - .map_err(|_| CTokenError::InvalidAtaDerivation)?; + .map_err(|_| TokenError::InvalidAtaDerivation)?; // owner_account.key() IS the ATA - verify it matches derived if !pinocchio::pubkey::pubkey_eq(owner_account.key(), &derived_ata) { - return Err(CTokenError::InvalidAtaDerivation.into()); + return Err(TokenError::InvalidAtaDerivation.into()); } return Ok(wallet_owner); diff --git a/programs/compressed-token/program/src/shared/token_output.rs b/programs/compressed-token/program/src/shared/token_output.rs index 275431c760..ed59dee0cd 100644 --- a/programs/compressed-token/program/src/shared/token_output.rs +++ b/programs/compressed-token/program/src/shared/token_output.rs @@ -3,7 +3,7 @@ use anchor_lang::prelude::ProgramError; use light_compressed_account::{ instruction_data::data::ZOutputCompressedAccountWithPackedContextMut, Pubkey, }; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::extensions::ZExtensionInstructionData, state::{ diff --git a/programs/compressed-token/program/tests/allocation_test.rs b/programs/compressed-token/program/tests/allocation_test.rs index 1338638193..2128c9bdb3 100644 --- a/programs/compressed-token/program/tests/allocation_test.rs +++ b/programs/compressed-token/program/tests/allocation_test.rs @@ -3,7 +3,7 @@ use light_compressed_account::instruction_data::with_readonly::InstructionDataIn use light_compressed_token::shared::cpi_bytes_size::{ allocate_invoke_with_read_only_cpi_bytes, cpi_bytes_config, CpiConfigInput, }; -use light_ctoken_interface::state::{ +use light_token_interface::state::{ extensions::TokenMetadataConfig, CompressedMint, CompressedMintConfig, ExtensionStructConfig, }; use light_zero_copy::{traits::ZeroCopyAt, ZeroCopyNew}; diff --git a/programs/compressed-token/program/tests/check_extensions.rs b/programs/compressed-token/program/tests/check_extensions.rs index 70a17314e2..c81be9a925 100644 --- a/programs/compressed-token/program/tests/check_extensions.rs +++ b/programs/compressed-token/program/tests/check_extensions.rs @@ -17,7 +17,7 @@ use light_compressed_token::{ compressed_token::transfer2::check_extensions::build_mint_extension_cache, extensions::check_mint_extensions, }; -use light_ctoken_interface::instructions::{ +use light_token_interface::instructions::{ extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, transfer2::{ CompressedTokenInstructionDataTransfer2, Compression, CompressionMode, diff --git a/programs/compressed-token/program/tests/compress_and_close.rs b/programs/compressed-token/program/tests/compress_and_close.rs index 80e2202973..aadb5c9160 100644 --- a/programs/compressed-token/program/tests/compress_and_close.rs +++ b/programs/compressed-token/program/tests/compress_and_close.rs @@ -7,11 +7,11 @@ use light_account_checks::{ use light_compressed_token::compressed_token::transfer2::{ accounts::Transfer2Accounts, compression::ctoken::close_for_compress_and_close, }; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::transfer2::{Compression, CompressionMode}, state::{ - CToken, CompressedTokenConfig, CompressibleExtensionConfig, CompressionInfoConfig, - ExtensionStructConfig, + CompressibleExtensionConfig, CompressionInfoConfig, ExtensionStructConfig, Token, + TokenConfig, }, }; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyNew}; @@ -26,7 +26,7 @@ fn create_compressible_ctoken_data( rent_sponsor_pubkey: &[u8; 32], ) -> Vec { // Create config for compressible CToken with Compressible extension - let config = CompressedTokenConfig { + let config = TokenConfig { mint: light_compressed_account::Pubkey::from([0u8; 32]), owner: light_compressed_account::Pubkey::from(*owner_pubkey), state: 1, // AccountState::Initialized @@ -38,11 +38,11 @@ fn create_compressible_ctoken_data( }; // Calculate required size - let size = CToken::byte_len(&config).unwrap(); + let size = Token::byte_len(&config).unwrap(); let mut data = vec![0u8; size]; // Initialize using zero-copy new - let (mut ctoken, _) = CToken::new_zero_copy(&mut data, config).unwrap(); + let (mut ctoken, _) = Token::new_zero_copy(&mut data, config).unwrap(); // Set compression info fields via the Compressible extension let compressible = ctoken.get_compressible_extension_mut().unwrap(); diff --git a/programs/compressed-token/program/tests/exact_allocation_test.rs b/programs/compressed-token/program/tests/exact_allocation_test.rs index 294c1cec99..bd60eab799 100644 --- a/programs/compressed-token/program/tests/exact_allocation_test.rs +++ b/programs/compressed-token/program/tests/exact_allocation_test.rs @@ -3,7 +3,7 @@ use light_compressed_account::instruction_data::with_readonly::InstructionDataIn use light_compressed_token::shared::cpi_bytes_size::{ allocate_invoke_with_read_only_cpi_bytes, cpi_bytes_config, CpiConfigInput, }; -use light_ctoken_interface::state::{ +use light_token_interface::state::{ extensions::{AdditionalMetadataConfig, TokenMetadataConfig}, CompressedMint, CompressedMintConfig, ExtensionStructConfig, }; diff --git a/programs/compressed-token/program/tests/mint.rs b/programs/compressed-token/program/tests/mint.rs index 6b5f865ee6..5563cf67d0 100644 --- a/programs/compressed-token/program/tests/mint.rs +++ b/programs/compressed-token/program/tests/mint.rs @@ -10,7 +10,7 @@ use light_compressed_token::{ }, constants::COMPRESSED_MINT_DISCRIMINATOR, }; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::{ExtensionInstructionData, TokenMetadataInstructionData}, mint_action::{CompressedMintInstructionData, MintActionCompressedInstructionData}, @@ -240,7 +240,7 @@ fn test_rnd_create_compressed_mint_account() { for (zc_ext, orig_ext) in zc_extensions.iter().zip(orig_extensions.iter()) { match (zc_ext, orig_ext) { ( - light_ctoken_interface::instructions::extensions::ZExtensionInstructionData::TokenMetadata(zc_metadata), + light_token_interface::instructions::extensions::ZExtensionInstructionData::TokenMetadata(zc_metadata), ExtensionInstructionData::TokenMetadata(orig_metadata), ) => { assert_eq!(zc_metadata.name, orig_metadata.name.as_slice()); diff --git a/programs/compressed-token/program/tests/mint_action.rs b/programs/compressed-token/program/tests/mint_action.rs index f9ea682006..4d38f45686 100644 --- a/programs/compressed-token/program/tests/mint_action.rs +++ b/programs/compressed-token/program/tests/mint_action.rs @@ -5,12 +5,12 @@ use borsh::BorshSerialize; use light_compressed_account::{instruction_data::compressed_proof::CompressedProof, Pubkey}; use light_compressed_token::compressed_token::mint_action::accounts::AccountsConfig; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::{token_metadata::TokenMetadataInstructionData, ExtensionInstructionData}, mint_action::{ Action, CompressedMintInstructionData, CpiContext, CreateMint, - MintActionCompressedInstructionData, MintToCTokenAction, MintToCompressedAction, + MintActionCompressedInstructionData, MintToTokenAction, MintToCompressedAction, Recipient, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }, @@ -71,8 +71,8 @@ fn random_mint_to_action(rng: &mut StdRng) -> MintToCompressedAction { } } -fn random_mint_to_decompressed_action(rng: &mut StdRng) -> MintToCTokenAction { - MintToCTokenAction { +fn random_mint_to_decompressed_action(rng: &mut StdRng) -> MintToTokenAction { + MintToTokenAction { amount: rng.gen_range(1..=1_000_000), account_index: rng.gen_range(1..=255), } @@ -113,7 +113,7 @@ fn random_action(rng: &mut StdRng) -> Action { 0 => Action::MintToCompressed(random_mint_to_action(rng)), 1 => Action::UpdateMintAuthority(random_update_authority_action(rng)), 2 => Action::UpdateFreezeAuthority(random_update_authority_action(rng)), - 3 => Action::MintToCToken(random_mint_to_decompressed_action(rng)), + 3 => Action::MintToToken(random_mint_to_decompressed_action(rng)), 4 => Action::UpdateMetadataField(random_update_metadata_field_action(rng)), 5 => Action::UpdateMetadataAuthority(random_update_metadata_authority_action(rng)), 6 => Action::RemoveMetadataKey(random_remove_metadata_key_action(rng)), @@ -328,7 +328,7 @@ fn check_if_config_should_error(instruction_data: &MintActionCompressedInstructi let has_mint_to_ctoken = instruction_data .actions .iter() - .any(|action| matches!(action, Action::MintToCToken(_))); + .any(|action| matches!(action, Action::MintToToken(_))); // Check for MintToCompressed actions let require_token_output_queue = instruction_data diff --git a/programs/compressed-token/program/tests/mint_action_accounts_validation.rs b/programs/compressed-token/program/tests/mint_action_accounts_validation.rs index dcc95eddfd..6f25615056 100644 --- a/programs/compressed-token/program/tests/mint_action_accounts_validation.rs +++ b/programs/compressed-token/program/tests/mint_action_accounts_validation.rs @@ -4,7 +4,7 @@ // }; // use light_compressed_token::mint_action::accounts::{AccountsConfig, MintActionAccounts}; // use light_compressed_token::ErrorCode; -// use light_ctoken_interface::CMINT_ADDRESS_TREE; +// use light_token_interface::CMINT_ADDRESS_TREE; // use pinocchio::account_info::AccountInfo; // use pinocchio::pubkey::Pubkey; diff --git a/programs/compressed-token/program/tests/mint_validation.rs b/programs/compressed-token/program/tests/mint_validation.rs index 28bb2c5f62..15ab5b01bd 100644 --- a/programs/compressed-token/program/tests/mint_validation.rs +++ b/programs/compressed-token/program/tests/mint_validation.rs @@ -4,7 +4,7 @@ use pinocchio::pubkey::Pubkey; const SPL_TOKEN_ID: Pubkey = spl_token::ID.to_bytes(); const SPL_TOKEN_2022_ID: Pubkey = spl_token_2022::ID.to_bytes(); -const CTOKEN_PROGRAM_ID: Pubkey = light_ctoken_interface::CTOKEN_PROGRAM_ID; +const CTOKEN_PROGRAM_ID: Pubkey = light_token_interface::LIGHT_TOKEN_PROGRAM_ID; const SYSTEM_PROGRAM_ID: Pubkey = [0u8; 32]; const RANDOM_PROGRAM_ID: Pubkey = [42u8; 32]; diff --git a/programs/compressed-token/program/tests/multi_sum_check.rs b/programs/compressed-token/program/tests/multi_sum_check.rs index 96d4ded630..8809e4ebf7 100644 --- a/programs/compressed-token/program/tests/multi_sum_check.rs +++ b/programs/compressed-token/program/tests/multi_sum_check.rs @@ -9,7 +9,7 @@ use light_account_checks::{ use light_compressed_token::compressed_token::transfer2::sum_check::{ sum_check_multi_mint, validate_mint_uniqueness, }; -use light_ctoken_interface::instructions::transfer2::{ +use light_token_interface::instructions::transfer2::{ Compression, CompressionMode, MultiInputTokenDataWithContext, MultiTokenTransferOutputData, }; use light_zero_copy::traits::ZeroCopyAt; diff --git a/programs/compressed-token/program/tests/queue_indices.rs b/programs/compressed-token/program/tests/queue_indices.rs index 13bfa8731d..6f6dbf32f4 100644 --- a/programs/compressed-token/program/tests/queue_indices.rs +++ b/programs/compressed-token/program/tests/queue_indices.rs @@ -1,7 +1,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::AnchorSerialize; use light_compressed_token::compressed_token::mint_action::queue_indices::QueueIndices; -use light_ctoken_interface::instructions::mint_action::CpiContext; +use light_token_interface::instructions::mint_action::CpiContext; use light_zero_copy::traits::ZeroCopyAt; #[derive(Debug)] diff --git a/programs/compressed-token/program/tests/token_input.rs b/programs/compressed-token/program/tests/token_input.rs index fc14065fee..191d635725 100644 --- a/programs/compressed-token/program/tests/token_input.rs +++ b/programs/compressed-token/program/tests/token_input.rs @@ -19,7 +19,7 @@ use light_compressed_token::{ token_input::set_input_compressed_account, }, }; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::transfer2::MultiInputTokenDataWithContext, state::CompressedTokenAccountState, }; diff --git a/programs/compressed-token/program/tests/token_output.rs b/programs/compressed-token/program/tests/token_output.rs index d56aa406e6..aa88a32472 100644 --- a/programs/compressed-token/program/tests/token_output.rs +++ b/programs/compressed-token/program/tests/token_output.rs @@ -19,7 +19,7 @@ use light_compressed_token::{ token_output::set_output_compressed_account, }, }; -use light_ctoken_interface::{ +use light_token_interface::{ hash_cache::HashCache, instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, state::{ diff --git a/programs/registry/Cargo.toml b/programs/registry/Cargo.toml index 52cd664c4b..0423906a08 100644 --- a/programs/registry/Cargo.toml +++ b/programs/registry/Cargo.toml @@ -25,7 +25,7 @@ aligned-sized = { workspace = true } anchor-lang = { workspace = true, features = ["init-if-needed"] } account-compression = { workspace = true } light-compressible = { workspace = true, features = ["anchor"] } -light-ctoken-interface = { workspace = true, features = ["anchor"] } +light-token-interface = { workspace = true, features = ["anchor"] } light-zero-copy = { workspace = true } light-system-program-anchor = { workspace = true, features = ["cpi"] } light-account-checks = { workspace = true, features = ["solana", "std", "msg"] } diff --git a/programs/registry/src/compressible/compressed_token/accounts.rs b/programs/registry/src/compressible/compressed_token/accounts.rs index d41dd3dd8b..2b6808cf8b 100644 --- a/programs/registry/src/compressible/compressed_token/accounts.rs +++ b/programs/registry/src/compressible/compressed_token/accounts.rs @@ -4,8 +4,8 @@ use light_account_checks::{ use light_program_profiler::profile; use super::{ - ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, CTOKEN_PROGRAM_ID, - LIGHT_SYSTEM_PROGRAM_ID, + ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, LIGHT_SYSTEM_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, }; /// Parsed Transfer2 CPI accounts for structured access @@ -33,7 +33,7 @@ impl<'a, A: AccountInfoTrait + Clone> Transfer2CpiAccounts<'a, A> { pub fn try_from_account_infos(fee_payer: A, accounts: &'a [A]) -> Result { let mut iter = AccountIterator::new(accounts); let compressed_token_program = - iter.next_checked_pubkey("compressed_token_program", CTOKEN_PROGRAM_ID.to_bytes())?; + iter.next_checked_pubkey("compressed_token_program", LIGHT_TOKEN_PROGRAM_ID.to_bytes())?; let compressed_token_cpi_authority = iter.next_account("compressed_token_cpi_authority")?; diff --git a/programs/registry/src/compressible/compressed_token/compress_and_close.rs b/programs/registry/src/compressible/compressed_token/compress_and_close.rs index 41a0047c28..cd89facd4a 100644 --- a/programs/registry/src/compressible/compressed_token/compress_and_close.rs +++ b/programs/registry/src/compressible/compressed_token/compress_and_close.rs @@ -1,6 +1,6 @@ use anchor_lang::{prelude::ProgramError, pubkey, AnchorDeserialize, AnchorSerialize, Result}; use light_account_checks::packed_accounts::ProgramPackedAccounts; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, transfer2::{ @@ -8,7 +8,7 @@ use light_ctoken_interface::{ MultiTokenTransferOutputData, }, }, - state::{CToken, ZExtensionStruct}, + state::{Token, ZExtensionStruct}, }; use light_program_profiler::profile; use light_zero_copy::traits::ZeroCopyAt; @@ -21,8 +21,8 @@ use crate::errors::RegistryError; const TRANSFER2_DISCRIMINATOR: u8 = 101; use super::{ - ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, CTOKEN_PROGRAM_ID, - LIGHT_SYSTEM_PROGRAM_ID, REGISTERED_PROGRAM_PDA, + ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, LIGHT_SYSTEM_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, REGISTERED_PROGRAM_PDA, }; pub const CPI_AUTHORITY_PDA: Pubkey = pubkey!("GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy"); @@ -92,14 +92,14 @@ pub fn compress_and_close_ctoken_accounts_with_indices<'info>( .try_borrow_data() .map_err(|_| RegistryError::BorrowAccountDataFailed)?; - let amount = CToken::amount_from_slice(&account_data).map_err(|e| { - anchor_lang::prelude::msg!("Failed to read amount from CToken: {:?}", e); + let amount = Token::amount_from_slice(&account_data).map_err(|e| { + anchor_lang::prelude::msg!("Failed to read amount from Token: {:?}", e); RegistryError::InvalidTokenAccountData })?; - // Parse the full CToken to check for marker extensions - let (ctoken, _) = CToken::zero_copy_at(&account_data).map_err(|e| { - anchor_lang::prelude::msg!("Failed to parse CToken: {:?}", e); + // Parse the full Token to check for marker extensions + let (ctoken, _) = Token::zero_copy_at(&account_data).map_err(|e| { + anchor_lang::prelude::msg!("Failed to parse Token: {:?}", e); RegistryError::InvalidSigner })?; @@ -107,7 +107,7 @@ pub fn compress_and_close_ctoken_accounts_with_indices<'info>( let mut has_marker_extensions = false; let mut withheld_transfer_fee: u64 = 0; let delegated_amount: u64 = ctoken.delegated_amount.get(); - // AccountState::Frozen = 2 in CToken + // AccountState::Frozen = 2 in Token let is_frozen = ctoken.state == 2; // Frozen accounts require CompressedOnly extension to preserve frozen state @@ -263,7 +263,7 @@ pub fn compress_and_close_ctoken_accounts_with_indices<'info>( account_metas.extend(packed_account_metas); Ok(Instruction { - program_id: CTOKEN_PROGRAM_ID, + program_id: LIGHT_TOKEN_PROGRAM_ID, accounts: account_metas, data, }) diff --git a/programs/registry/src/compressible/compressed_token/mod.rs b/programs/registry/src/compressible/compressed_token/mod.rs index 3c0a4e4150..4d727c9bed 100644 --- a/programs/registry/src/compressible/compressed_token/mod.rs +++ b/programs/registry/src/compressible/compressed_token/mod.rs @@ -9,7 +9,7 @@ pub use compress_and_close::{ use solana_pubkey::Pubkey; // Program ID for light-compressed-token -pub const CTOKEN_PROGRAM_ID: Pubkey = pubkey!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m"); +pub const LIGHT_TOKEN_PROGRAM_ID: Pubkey = pubkey!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m"); // Light System Program ID pub const LIGHT_SYSTEM_PROGRAM_ID: Pubkey = pubkey!("SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7"); diff --git a/scripts/lint.sh b/scripts/lint.sh index b1d2049fbf..6b2cde79ca 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -18,7 +18,7 @@ NO_DEFAULT_CRATES=( "light-compressed-account" "light-compressible" "light-concurrent-merkle-tree" - "light-ctoken-interface" + "light-token-interface" "light-hash-set" "light-hasher" "light-indexed-merkle-tree" @@ -76,7 +76,7 @@ SOLANA_CRATES=( "light-compressed-account" "light-hash-set" "light-merkle-tree-metadata" - "light-ctoken-interface" + "light-token-interface" "light-macros" "light-batched-merkle-tree" "light-concurrent-merkle-tree" @@ -95,7 +95,7 @@ ANCHOR_CRATES=( "light-indexed-merkle-tree" "light-compressed-account" "light-merkle-tree-metadata" - "light-ctoken-interface" + "light-token-interface" "light-verifier" "light-compressible" "light-sdk-types" diff --git a/sdk-libs/client/Cargo.toml b/sdk-libs/client/Cargo.toml index b5e929a6c3..fda0193281 100644 --- a/sdk-libs/client/Cargo.toml +++ b/sdk-libs/client/Cargo.toml @@ -44,7 +44,7 @@ light-sdk = { workspace = true } light-hasher = { workspace = true, features = ["poseidon"] } light-compressed-account = { workspace = true, features = ["solana", "poseidon"] } light-ctoken-sdk = { workspace = true } -light-ctoken-interface = { workspace = true } +light-token-interface = { workspace = true } light-event = { workspace = true } photon-api = { workspace = true } diff --git a/sdk-libs/client/src/indexer/types.rs b/sdk-libs/client/src/indexer/types.rs index ea275d47b1..3af89cc4e4 100644 --- a/sdk-libs/client/src/indexer/types.rs +++ b/sdk-libs/client/src/indexer/types.rs @@ -7,7 +7,7 @@ use light_compressed_account::{ instruction_data::compressed_proof::CompressedProof, TreeType, }; -use light_ctoken_interface::state::ExtensionStruct; +use light_token_interface::state::ExtensionStruct; use light_ctoken_sdk::compat::{AccountState, TokenData}; use light_indexed_merkle_tree::array::IndexedElement; use light_sdk::instruction::{ diff --git a/sdk-libs/ctoken-sdk/Cargo.toml b/sdk-libs/ctoken-sdk/Cargo.toml index b73e3e1ea4..64625e38c1 100644 --- a/sdk-libs/ctoken-sdk/Cargo.toml +++ b/sdk-libs/ctoken-sdk/Cargo.toml @@ -11,17 +11,17 @@ default = [] v1 = [] compressible = [] -anchor = ["anchor-lang", "light-ctoken-types/anchor", "light-ctoken-interface/anchor"] +anchor = ["anchor-lang", "light-ctoken-types/anchor", "light-token-interface/anchor"] cpi-context = ["light-sdk/cpi-context"] profile-program = [ "light-program-profiler/profile-program", "light-compressed-account/profile-program", - "light-ctoken-interface/profile-program", + "light-token-interface/profile-program", ] profile-heap = [ "light-program-profiler/profile-heap", "light-compressed-account/profile-heap", - "light-ctoken-interface/profile-heap", + "light-token-interface/profile-heap", ] [dependencies] @@ -29,7 +29,7 @@ profile-heap = [ light-ctoken-types = { workspace = true } light-compressed-account = { workspace = true, features = ["std"] } light-compressible = { workspace = true } -light-ctoken-interface = { workspace = true } +light-token-interface = { workspace = true } light-sdk = { workspace = true, features = ["v2"] } light-macros = { workspace = true } thiserror = { workspace = true } diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs index 2168288783..6b5c585ee3 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs @@ -1,5 +1,5 @@ use borsh::BorshSerialize; -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_ctoken_types::{ instruction::delegation::CompressedTokenInstructionDataApprove, ValidityProof, }; @@ -76,7 +76,7 @@ pub fn create_approve_instruction(inputs: ApproveInputs) -> Result let account_metas = get_approve_instruction_account_metas(meta_config); Ok(Instruction { - program_id: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data: serialized_data, }) diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs index 312aec28b5..16fa1ffaf6 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface; +use light_token_interface; use light_ctoken_types::{ instruction::batch_compress::BatchCompressInstructionData, BATCH_COMPRESS, }; @@ -78,7 +78,7 @@ pub fn create_batch_compress_instruction(inputs: BatchCompressInputs) -> Result< let account_metas = get_batch_compress_instruction_account_metas(meta_config); Ok(Instruction { - program_id: Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data, }) diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs index 640594408f..e3567750d0 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_ctoken_types::{ constants::TRANSFER, instruction::transfer::CompressedTokenInstructionDataTransfer, CompressedCpiContext, ValidityProof, @@ -132,7 +132,7 @@ pub fn create_transfer_instruction_raw( account_metas.push(AccountMeta::new(tree_pubkey, false)); } Ok(Instruction { - program_id: Pubkey::from(CTOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data, }) diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/account2.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/account2.rs index 0b7b71be7a..0d5df86b75 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/account2.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/account2.rs @@ -1,6 +1,6 @@ use std::ops::Deref; -use light_ctoken_interface::instructions::transfer2::{ +use light_token_interface::instructions::transfer2::{ Compression, CompressionMode, MultiInputTokenDataWithContext, MultiTokenTransferOutputData, }; use light_program_profiler::profile; @@ -166,7 +166,7 @@ impl CTokenAccount2 { // TODO: consider this might be confusing because it must not be used in combination with fn compress() #[profile] - pub fn compress_ctoken( + pub fn compress_token( &mut self, amount: u64, source_or_recipient_index: u8, @@ -178,7 +178,7 @@ impl CTokenAccount2 { } self.output.amount += amount; - self.compression = Some(Compression::compress_ctoken( + self.compression = Some(Compression::compress_token( amount, self.output.mint, source_or_recipient_index, @@ -224,7 +224,7 @@ impl CTokenAccount2 { // TODO: consider this might be confusing because it must not be used in combination with fn decompress() #[profile] - pub fn decompress_ctoken( + pub fn decompress_token( &mut self, amount: u64, source_index: u8, @@ -239,7 +239,7 @@ impl CTokenAccount2 { } self.output.amount -= amount; - self.compression = Some(Compression::decompress_ctoken( + self.compression = Some(Compression::decompress_token( amount, self.output.mint, source_index, @@ -337,7 +337,7 @@ impl CTokenAccount2 { self.output.amount += amount; // Use the compress_and_close method from Compression - self.compression = Some(Compression::compress_and_close_ctoken( + self.compression = Some(Compression::compress_and_close_token( amount, self.output.mint, source_or_recipient_index, diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/compress_and_close.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/compress_and_close.rs index 8072739610..f38991080f 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/compress_and_close.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/compress_and_close.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::{instructions::transfer2::CompressedCpiContext, state::CToken}; +use light_token_interface::{instructions::transfer2::CompressedCpiContext, state::Token}; use light_program_profiler::profile; use light_sdk::{ error::LightSdkError, @@ -41,7 +41,7 @@ pub fn pack_for_compress_and_close( ctoken_account_data: &[u8], packed_accounts: &mut PackedAccounts, ) -> Result { - let (ctoken_account, _) = CToken::zero_copy_at(ctoken_account_data)?; + let (ctoken_account, _) = Token::zero_copy_at(ctoken_account_data)?; let source_index = packed_accounts.insert_or_get(ctoken_account_pubkey); let mint_index = packed_accounts.insert_or_get(Pubkey::from(ctoken_account.mint.to_bytes())); let owner_index = packed_accounts.insert_or_get(Pubkey::from(ctoken_account.owner.to_bytes())); @@ -165,7 +165,7 @@ pub fn compress_and_close_ctoken_accounts_with_indices<'info>( .try_borrow_data() .map_err(|_| CTokenSdkError::AccountBorrowFailed)?; - let amount = light_ctoken_interface::state::CToken::amount_from_slice(&account_data)?; + let amount = light_token_interface::state::Token::amount_from_slice(&account_data)?; // Create CTokenAccount2 for CompressAndClose operation let mut token_account = CTokenAccount2::new_empty(idx.owner_index, idx.mint_index); @@ -264,9 +264,9 @@ pub fn compress_and_close_ctoken_accounts<'info>( .try_borrow_data() .map_err(|_| CTokenSdkError::AccountBorrowFailed)?; - // Deserialize the full CToken including extensions + // Deserialize the full Token including extensions let (compressed_token, _) = - light_ctoken_interface::state::CToken::zero_copy_at(&account_data) + light_token_interface::state::Token::zero_copy_at(&account_data) .map_err(|_| CTokenSdkError::InvalidAccountData)?; // Extract pubkeys from the deserialized account diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs index cc05d04ab0..3239f769b5 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs @@ -1,7 +1,7 @@ use light_compressed_account::instruction_data::{ compressed_proof::CompressedProof, traits::LightInstructionData, }; -use light_ctoken_interface::{ +use light_token_interface::{ self, instructions::{ extensions::ExtensionInstructionData, @@ -48,7 +48,7 @@ pub fn create_compressed_mint_cpi( let compressed_mint_instruction_data = CompressedMintInstructionData { supply: 0, decimals: input.decimals, - metadata: light_ctoken_interface::state::CompressedMintMetadata { + metadata: light_token_interface::state::CompressedMintMetadata { version: input.version, mint: find_cmint_address(&input.mint_signer).0.to_bytes().into(), cmint_decompressed: false, @@ -59,7 +59,7 @@ pub fn create_compressed_mint_cpi( extensions: input.extensions, }; - let mut instruction_data = light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint( + let mut instruction_data = light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint( input.address_merkle_tree_root_index, input.proof, compressed_mint_instruction_data, @@ -94,7 +94,7 @@ pub fn create_compressed_mint_cpi( Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( - light_ctoken_interface::CTOKEN_PROGRAM_ID, + light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ), accounts: account_metas, data, @@ -130,7 +130,7 @@ pub fn create_compressed_mint_cpi_write( let compressed_mint_instruction_data = CompressedMintInstructionData { supply: 0, decimals: input.decimals, - metadata: light_ctoken_interface::state::CompressedMintMetadata { + metadata: light_token_interface::state::CompressedMintMetadata { version: input.version, mint: find_cmint_address(&input.mint_signer).0.to_bytes().into(), cmint_decompressed: false, @@ -141,7 +141,7 @@ pub fn create_compressed_mint_cpi_write( extensions: input.extensions, }; - let instruction_data = light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint_write_to_cpi_context( + let instruction_data = light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint_write_to_cpi_context( input.address_merkle_tree_root_index, compressed_mint_instruction_data, input.cpi_context, @@ -162,7 +162,7 @@ pub fn create_compressed_mint_cpi_write( Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( - light_ctoken_interface::CTOKEN_PROGRAM_ID, + light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ), accounts: account_metas, data, @@ -184,7 +184,7 @@ pub fn derive_cmint_compressed_address( light_compressed_account::address::derive_address( &find_cmint_address(mint_seed).0.to_bytes(), &address_tree_pubkey.to_bytes(), - &light_ctoken_interface::CTOKEN_PROGRAM_ID, + &light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ) } @@ -192,13 +192,13 @@ pub fn derive_cmint_from_spl_mint(mint: &Pubkey, address_tree_pubkey: &Pubkey) - light_compressed_account::address::derive_address( &mint.to_bytes(), &address_tree_pubkey.to_bytes(), - &light_ctoken_interface::CTOKEN_PROGRAM_ID, + &light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ) } pub fn find_cmint_address(mint_seed: &Pubkey) -> (Pubkey, u8) { Pubkey::find_program_address( &[COMPRESSED_MINT_SEED, mint_seed.as_ref()], - &Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + &Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), ) } diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/decompress_full.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/decompress_full.rs index 0e81258afd..f2e88458c8 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/decompress_full.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/decompress_full.rs @@ -1,5 +1,5 @@ use light_compressed_account::compressed_account::PackedMerkleContext; -use light_ctoken_interface::instructions::{ +use light_token_interface::instructions::{ extensions::ExtensionInstructionData, transfer2::{CompressedCpiContext, MultiInputTokenDataWithContext}, }; @@ -75,7 +75,7 @@ pub fn decompress_full_ctoken_accounts_with_indices<'info>( let mut token_account = CTokenAccount2::new(vec![idx.source])?; // Set up decompress_full - decompress entire balance to destination ctoken account - token_account.decompress_ctoken(idx.source.amount, idx.destination_index)?; + token_account.decompress_token(idx.source.amount, idx.destination_index)?; token_accounts.push(token_account); // Collect TLV data for this input diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/account_metas.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/account_metas.rs index 79d85b983a..3bdf907999 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/account_metas.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/account_metas.rs @@ -74,7 +74,7 @@ impl MintActionMetaConfig { /// Create a new MintActionMetaConfig for CPI context operations. pub fn new_cpi_context( - instruction_data: &light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData, + instruction_data: &light_token_interface::instructions::mint_action::MintActionCompressedInstructionData, fee_payer: Pubkey, authority: Pubkey, cpi_context_pubkey: Pubkey, diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs index 22413b4e87..3fed476b03 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs @@ -1,5 +1,5 @@ use light_account_checks::{AccountError, AccountInfoTrait, AccountIterator}; -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_ctoken_types::CPI_AUTHORITY_PDA; use light_program_profiler::profile; use light_sdk_types::{ @@ -73,7 +73,7 @@ impl<'a, A: AccountInfoTrait + Clone> MintActionCpiAccounts<'a, A> { let mut iter = AccountIterator::new(accounts); let compressed_token_program = - iter.next_checked_pubkey("compressed_token_program", CTOKEN_PROGRAM_ID)?; + iter.next_checked_pubkey("compressed_token_program", LIGHT_TOKEN_PROGRAM_ID)?; let light_system_program = iter.next_checked_pubkey("light_system_program", LIGHT_SYSTEM_PROGRAM_ID)?; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/instruction.rs index 4bb546fc18..30d4646c1d 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/instruction.rs @@ -1,6 +1,6 @@ use light_compressed_account::instruction_data::traits::LightInstructionData; -use light_ctoken_interface::{ - instructions::mint_action::MintActionCompressedInstructionData, CTOKEN_PROGRAM_ID, +use light_token_interface::{ + instructions::mint_action::MintActionCompressedInstructionData, LIGHT_TOKEN_PROGRAM_ID, }; use solana_instruction::Instruction; use solana_msg::msg; @@ -31,7 +31,7 @@ impl CTokenInstruction for MintActionCompressedInstructionData { let data = self.data().map_err(ProgramError::from)?; Ok(Instruction { - program_id: CTOKEN_PROGRAM_ID.into(), + program_id: LIGHT_TOKEN_PROGRAM_ID.into(), accounts: accounts.to_account_metas(), data, }) @@ -47,7 +47,7 @@ impl CTokenInstruction for MintActionCompressedInstructionData { cpi_ctx.set_context = false; } else { instruction_data.cpi_context = Some( - light_ctoken_interface::instructions::mint_action::CpiContext { + light_token_interface::instructions::mint_action::CpiContext { first_set_context: true, ..Default::default() }, @@ -67,7 +67,7 @@ impl CTokenInstruction for MintActionCompressedInstructionData { cpi_ctx.first_set_context = false; } else { instruction_data.cpi_context = Some( - light_ctoken_interface::instructions::mint_action::CpiContext { + light_token_interface::instructions::mint_action::CpiContext { set_context: true, ..Default::default() }, @@ -86,7 +86,7 @@ fn build_cpi_write_instruction Result { let data = instruction_data.data().map_err(ProgramError::from)?; Ok(Instruction { - program_id: CTOKEN_PROGRAM_ID.into(), + program_id: LIGHT_TOKEN_PROGRAM_ID.into(), accounts: { let mut account_metas = Vec::with_capacity( 6 + accounts.recipient_token_accounts.len() diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs index 9ee9ee8c65..cbc30f3a90 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs @@ -1,5 +1,5 @@ use light_compressed_account::instruction_data::traits::LightInstructionData; -use light_ctoken_interface::instructions::mint_action::{ +use light_token_interface::instructions::mint_action::{ CompressedMintWithContext, CpiContext, Recipient, }; pub use light_ctoken_types::account_infos::mint_to_compressed::DecompressedMintConfig; @@ -57,13 +57,13 @@ pub fn create_mint_to_compressed_instruction( } = inputs; let mint_to_action = - light_ctoken_interface::instructions::mint_action::MintToCompressedAction { + light_token_interface::instructions::mint_action::MintToCompressedAction { token_account_version, recipients, }; let mut instruction_data = - light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new( + light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new( compressed_mint_inputs.clone(), proof, ) @@ -99,7 +99,7 @@ pub fn create_mint_to_compressed_instruction( Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( - light_ctoken_interface::CTOKEN_PROGRAM_ID, + light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ), accounts: account_metas, data, diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs index caa4b84c1c..326656c163 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs @@ -1,5 +1,5 @@ use light_account_checks::{AccountError, AccountInfoTrait, AccountIterator}; -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_ctoken_types::CPI_AUTHORITY_PDA; use light_program_profiler::profile; use light_sdk_types::{ @@ -55,7 +55,7 @@ impl<'a, A: AccountInfoTrait + Clone> Transfer2CpiAccounts<'a, A> { let mut iter = AccountIterator::new(accounts); let compressed_token_program = - iter.next_checked_pubkey("compressed_token_program", CTOKEN_PROGRAM_ID)?; + iter.next_checked_pubkey("compressed_token_program", LIGHT_TOKEN_PROGRAM_ID)?; let invoking_program_cpi_authority = iter.next_option("CPI_SIGNER.cpi_authority", light_system_cpi_authority)?; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/instruction.rs index ebaed42366..39d5f2c8d0 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/instruction.rs @@ -1,10 +1,10 @@ use light_compressed_account::instruction_data::compressed_proof::ValidityProof; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::ExtensionInstructionData, transfer2::{CompressedCpiContext, CompressedTokenInstructionDataTransfer2}, }, - CTOKEN_PROGRAM_ID, TRANSFER2, + LIGHT_TOKEN_PROGRAM_ID, TRANSFER2, }; use light_program_profiler::profile; use solana_instruction::Instruction; @@ -147,7 +147,7 @@ pub fn create_transfer2_instruction(inputs: Transfer2Inputs) -> Result, ) -> Result { let mut instruction_data = - light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new( + light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new( input.compressed_mint_inputs.clone(), input.proof, ); - let update_authority = light_ctoken_interface::instructions::mint_action::UpdateAuthority { + let update_authority = light_token_interface::instructions::mint_action::UpdateAuthority { new_authority: input.new_authority.map(|auth| auth.to_bytes().into()), }; @@ -79,7 +79,7 @@ pub fn update_compressed_mint_cpi( Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( - light_ctoken_interface::CTOKEN_PROGRAM_ID, + light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ), accounts: account_metas, data, @@ -112,12 +112,12 @@ pub fn create_update_compressed_mint_cpi_write( } let mut instruction_data = - light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new( + light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new( inputs.compressed_mint_inputs.clone(), None, // No proof for CPI write ); - let update_authority = light_ctoken_interface::instructions::mint_action::UpdateAuthority { + let update_authority = light_token_interface::instructions::mint_action::UpdateAuthority { new_authority: inputs.new_authority.map(|auth| auth.to_bytes().into()), }; @@ -147,7 +147,7 @@ pub fn create_update_compressed_mint_cpi_write( Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( - light_ctoken_interface::CTOKEN_PROGRAM_ID, + light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ), accounts: account_metas, data, diff --git a/sdk-libs/ctoken-sdk/src/compressible/decompress_runtime.rs b/sdk-libs/ctoken-sdk/src/compressible/decompress_runtime.rs index ef0038b69e..f088057e01 100644 --- a/sdk-libs/ctoken-sdk/src/compressible/decompress_runtime.rs +++ b/sdk-libs/ctoken-sdk/src/compressible/decompress_runtime.rs @@ -1,5 +1,5 @@ //! Runtime helpers for token decompression. -use light_ctoken_interface::instructions::{ +use light_token_interface::instructions::{ extensions::CompressToPubkey, transfer2::MultiInputTokenDataWithContext, }; use light_sdk::{cpi::v2::CpiAccounts, instruction::ValidityProof}; @@ -155,7 +155,7 @@ where pre_pay_num_epochs: 2, lamports_per_write: None, compress_to_account_pubkey: compress_to_pubkey, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }, } diff --git a/sdk-libs/ctoken-sdk/src/ctoken/compressible.rs b/sdk-libs/ctoken-sdk/src/ctoken/compressible.rs index 53aa636ec9..956c30a7c5 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/compressible.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/compressible.rs @@ -1,4 +1,4 @@ -use light_ctoken_interface::{instructions::extensions::CompressToPubkey, state::TokenDataVersion}; +use light_token_interface::{instructions::extensions::CompressToPubkey, state::TokenDataVersion}; use solana_account_info::AccountInfo; use solana_pubkey::Pubkey; diff --git a/sdk-libs/ctoken-sdk/src/ctoken/create.rs b/sdk-libs/ctoken-sdk/src/ctoken/create.rs index 50e865f348..e0195c8127 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/create.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/create.rs @@ -1,6 +1,6 @@ use borsh::BorshSerialize; -use light_ctoken_interface::instructions::{ - create_ctoken_account::CreateTokenAccountInstructionData, +use light_token_interface::instructions::{ + create_token_account::CreateTokenAccountInstructionData, extensions::CompressibleExtensionInstructionData, }; use solana_account_info::AccountInfo; @@ -77,7 +77,7 @@ impl CreateCTokenAccount { ]; Ok(Instruction { - program_id: Pubkey::from(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::from(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts, data, }) diff --git a/sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs b/sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs index 6cfe48d040..6aefc081e6 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs @@ -1,5 +1,5 @@ use borsh::BorshSerialize; -use light_ctoken_interface::instructions::{ +use light_token_interface::instructions::{ create_associated_token_account::CreateAssociatedTokenAccountInstructionData, extensions::CompressibleExtensionInstructionData, }; @@ -18,10 +18,10 @@ pub fn derive_ctoken_ata(owner: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) { Pubkey::find_program_address( &[ owner.as_ref(), - light_ctoken_interface::CTOKEN_PROGRAM_ID.as_ref(), + light_token_interface::LIGHT_TOKEN_PROGRAM_ID.as_ref(), mint.as_ref(), ], - &Pubkey::from(light_ctoken_interface::CTOKEN_PROGRAM_ID), + &Pubkey::from(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), ) } @@ -125,7 +125,7 @@ impl CreateAssociatedCTokenAccount { ]; Ok(Instruction { - program_id: Pubkey::from(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::from(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts, data, }) diff --git a/sdk-libs/ctoken-sdk/src/ctoken/create_cmint.rs b/sdk-libs/ctoken-sdk/src/ctoken/create_cmint.rs index 8ff01ce917..83b8b0f2f9 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/create_cmint.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/create_cmint.rs @@ -1,7 +1,7 @@ use light_compressed_account::instruction_data::{ compressed_proof::CompressedProof, traits::LightInstructionData, }; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::ExtensionInstructionData, mint_action::{CompressedMintInstructionData, CpiContext}, @@ -117,7 +117,7 @@ impl CreateCMint { let compressed_mint_instruction_data = CompressedMintInstructionData { supply: 0, decimals: self.params.decimals, - metadata: light_ctoken_interface::state::CompressedMintMetadata { + metadata: light_token_interface::state::CompressedMintMetadata { version: 3, mint: self.params.mint.to_bytes().into(), cmint_decompressed: false, @@ -132,7 +132,7 @@ impl CreateCMint { }; let mut instruction_data = - light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint( + light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint( self.params.address_merkle_tree_root_index, self.params.proof, compressed_mint_instruction_data, @@ -160,7 +160,7 @@ impl CreateCMint { .map_err(|e| ProgramError::BorshIoError(e.to_string()))?; Ok(Instruction { - program_id: Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data, }) @@ -258,7 +258,7 @@ impl CreateCompressedMintCpiWrite { let compressed_mint_instruction_data = CompressedMintInstructionData { supply: 0, decimals: self.params.decimals, - metadata: light_ctoken_interface::state::CompressedMintMetadata { + metadata: light_token_interface::state::CompressedMintMetadata { version: self.params.version, mint: self.params.mint.to_bytes().into(), cmint_decompressed: false, @@ -273,7 +273,7 @@ impl CreateCompressedMintCpiWrite { }; let instruction_data = - light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint_write_to_cpi_context( + light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint_write_to_cpi_context( self.params.address_merkle_tree_root_index, compressed_mint_instruction_data, self.params.cpi_context, @@ -293,7 +293,7 @@ impl CreateCompressedMintCpiWrite { .map_err(|e| ProgramError::BorshIoError(e.to_string()))?; Ok(Instruction { - program_id: Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data, }) @@ -518,7 +518,7 @@ pub fn derive_cmint_compressed_address( light_compressed_account::address::derive_address( &find_cmint_address(mint_seed).0.to_bytes(), &address_tree_pubkey.to_bytes(), - &light_ctoken_interface::CTOKEN_PROGRAM_ID, + &light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ) } @@ -527,7 +527,7 @@ pub fn derive_cmint_from_spl_mint(mint: &Pubkey, address_tree_pubkey: &Pubkey) - light_compressed_account::address::derive_address( &mint.to_bytes(), &address_tree_pubkey.to_bytes(), - &light_ctoken_interface::CTOKEN_PROGRAM_ID, + &light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ) } @@ -535,6 +535,6 @@ pub fn derive_cmint_from_spl_mint(mint: &Pubkey, address_tree_pubkey: &Pubkey) - pub fn find_cmint_address(mint_seed: &Pubkey) -> (Pubkey, u8) { Pubkey::find_program_address( &[COMPRESSED_MINT_SEED, mint_seed.as_ref()], - &Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + &Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), ) } diff --git a/sdk-libs/ctoken-sdk/src/ctoken/decompress.rs b/sdk-libs/ctoken-sdk/src/ctoken/decompress.rs index 18763f880f..1e675ff5f7 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/decompress.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/decompress.rs @@ -1,5 +1,5 @@ use light_compressed_account::instruction_data::compressed_proof::ValidityProof; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, state::{ExtensionStruct, TokenDataVersion}, }; @@ -156,7 +156,7 @@ impl DecompressToCtoken { let mut token_account = CTokenAccount2::new(vec![indices.source]) .map_err(|_| ProgramError::InvalidAccountData)?; token_account - .decompress_ctoken(self.token_data.amount, indices.destination_index) + .decompress_token(self.token_data.amount, indices.destination_index) .map_err(|_| ProgramError::InvalidAccountData)?; // Build instruction inputs diff --git a/sdk-libs/ctoken-sdk/src/ctoken/decompress_cmint.rs b/sdk-libs/ctoken-sdk/src/ctoken/decompress_cmint.rs index 3c2952e5b8..9d2f6c09ed 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/decompress_cmint.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/decompress_cmint.rs @@ -1,7 +1,7 @@ use light_compressed_account::instruction_data::{ compressed_proof::ValidityProof, traits::LightInstructionData, }; -use light_ctoken_interface::instructions::mint_action::{ +use light_token_interface::instructions::mint_action::{ CompressedMintWithContext, DecompressMintAction, MintActionCompressedInstructionData, }; use solana_account_info::AccountInfo; @@ -95,7 +95,7 @@ impl DecompressCMint { .map_err(|e| ProgramError::BorshIoError(e.to_string()))?; Ok(Instruction { - program_id: Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data, }) diff --git a/sdk-libs/ctoken-sdk/src/ctoken/mint_to.rs b/sdk-libs/ctoken-sdk/src/ctoken/mint_to.rs index 6dbea67f7d..59fefde37a 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/mint_to.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/mint_to.rs @@ -1,8 +1,8 @@ use light_compressed_account::instruction_data::{ compressed_proof::ValidityProof, traits::LightInstructionData, }; -use light_ctoken_interface::instructions::mint_action::{ - CompressedMintWithContext, CpiContext, MintToCTokenAction, +use light_token_interface::instructions::mint_action::{ + CompressedMintWithContext, CpiContext, MintToTokenAction, }; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; @@ -19,7 +19,7 @@ use crate::compressed_token::mint_action::{ #[derive(Debug, Clone)] pub struct MintToCTokenParams { pub compressed_mint_inputs: CompressedMintWithContext, - pub mint_to_actions: Vec, + pub mint_to_actions: Vec, pub mint_authority: Pubkey, pub proof: ValidityProof, } @@ -33,7 +33,7 @@ impl MintToCTokenParams { ) -> Self { Self { compressed_mint_inputs, - mint_to_actions: vec![MintToCTokenAction { + mint_to_actions: vec![MintToTokenAction { account_index: 0, // TODO: make dynamic amount, }], @@ -43,7 +43,7 @@ impl MintToCTokenParams { } pub fn add_mint_to_action(mut self, account_index: u8, amount: u64) -> Self { - self.mint_to_actions.push(MintToCTokenAction { + self.mint_to_actions.push(MintToTokenAction { account_index, amount, }); @@ -123,14 +123,14 @@ impl MintToCToken { pub fn instruction(self) -> Result { // Build instruction data with mint_to_ctoken actions let mut instruction_data = - light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new( + light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new( self.params.compressed_mint_inputs.clone(), self.params.proof.0, ); // Add all mint_to_ctoken actions for action in self.params.mint_to_actions { - instruction_data = instruction_data.with_mint_to_ctoken(action); + instruction_data = instruction_data.with_mint_to_token(action); } if let Some(ctx) = self.cpi_context { @@ -162,7 +162,7 @@ impl MintToCToken { .map_err(|e| ProgramError::BorshIoError(e.to_string()))?; Ok(Instruction { - program_id: Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data, }) @@ -176,7 +176,7 @@ impl MintToCToken { #[derive(Debug, Clone)] pub struct MintToCTokenCpiWriteParams { pub compressed_mint_inputs: CompressedMintWithContext, - pub mint_to_actions: Vec, + pub mint_to_actions: Vec, pub mint_authority: Pubkey, pub cpi_context: CpiContext, } @@ -190,7 +190,7 @@ impl MintToCTokenCpiWriteParams { ) -> Self { Self { compressed_mint_inputs, - mint_to_actions: vec![MintToCTokenAction { + mint_to_actions: vec![MintToTokenAction { account_index: 0, // TODO: make dynamic amount, }], @@ -200,7 +200,7 @@ impl MintToCTokenCpiWriteParams { } pub fn add_mint_to_action(mut self, account_index: u8, amount: u64) -> Self { - self.mint_to_actions.push(MintToCTokenAction { + self.mint_to_actions.push(MintToTokenAction { account_index, amount, }); @@ -246,14 +246,14 @@ impl MintToCTokenCpiWrite { // Build instruction data with mint_to_ctoken actions let mut instruction_data = - light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new( + light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new( self.params.compressed_mint_inputs.clone(), None, // No proof for CPI write ); // Add all mint_to_ctoken actions for action in self.params.mint_to_actions { - instruction_data = instruction_data.with_mint_to_ctoken(action); + instruction_data = instruction_data.with_mint_to_token(action); } instruction_data = instruction_data.with_cpi_context(self.params.cpi_context); @@ -272,7 +272,7 @@ impl MintToCTokenCpiWrite { .map_err(|e| ProgramError::BorshIoError(e.to_string()))?; Ok(Instruction { - program_id: Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data, }) diff --git a/sdk-libs/ctoken-sdk/src/ctoken/mod.rs b/sdk-libs/ctoken-sdk/src/ctoken/mod.rs index f728289d1e..f6fa869271 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/mod.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/mod.rs @@ -103,12 +103,12 @@ pub use decompress::DecompressToCtoken; pub use decompress_cmint::*; pub use freeze::*; use light_compressible::config::CompressibleConfig; -pub use light_ctoken_interface::{ +pub use light_token_interface::{ instructions::{ extensions::{CompressToPubkey, ExtensionInstructionData}, mint_action::CompressedMintWithContext, }, - state::{CToken, TokenDataVersion}, + state::{Token, TokenDataVersion}, }; use light_ctoken_types::POOL_SEED; pub use mint_to::*; diff --git a/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_spl.rs b/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_spl.rs index 1587f7c1d2..ba1215d39e 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_spl.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_spl.rs @@ -1,5 +1,5 @@ use light_compressed_account::instruction_data::compressed_proof::ValidityProof; -use light_ctoken_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; +use light_token_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; use light_program_profiler::profile; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; @@ -171,7 +171,7 @@ impl TransferCTokenToSpl { let compress_to_pool = CTokenAccount2 { inputs: vec![], output: MultiTokenTransferOutputData::default(), - compression: Some(Compression::compress_ctoken( + compression: Some(Compression::compress_token( self.amount, 0, // mint index 1, // source ctoken account index diff --git a/sdk-libs/ctoken-sdk/src/ctoken/transfer_spl_ctoken.rs b/sdk-libs/ctoken-sdk/src/ctoken/transfer_spl_ctoken.rs index 65d50e42da..d04a1f6a7b 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/transfer_spl_ctoken.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/transfer_spl_ctoken.rs @@ -1,5 +1,5 @@ use light_compressed_account::instruction_data::compressed_proof::ValidityProof; -use light_ctoken_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; +use light_token_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -195,7 +195,7 @@ impl TransferSplToCtoken { let ctoken_account = CTokenAccount2 { inputs: vec![], output: MultiTokenTransferOutputData::default(), - compression: Some(Compression::decompress_ctoken(self.amount, 0, 1)), + compression: Some(Compression::decompress_token(self.amount, 0, 1)), delegate_is_set: false, method_used: true, }; diff --git a/sdk-libs/ctoken-sdk/src/error.rs b/sdk-libs/ctoken-sdk/src/error.rs index 219f259190..b016e001ad 100644 --- a/sdk-libs/ctoken-sdk/src/error.rs +++ b/sdk-libs/ctoken-sdk/src/error.rs @@ -1,5 +1,5 @@ use light_account_checks::AccountError; -use light_ctoken_interface::CTokenError; +use light_token_interface::TokenError; use light_ctoken_types::error::LightTokenSdkTypeError; use light_sdk::error::LightSdkError; use light_sdk_types::error::LightSdkTypesError; @@ -78,7 +78,7 @@ pub enum CTokenSdkError { #[error(transparent)] CompressedTokenTypes(#[from] LightTokenSdkTypeError), #[error(transparent)] - CTokenError(#[from] CTokenError), + TokenError(#[from] TokenError), #[error(transparent)] LightSdkError(#[from] LightSdkError), #[error(transparent)] @@ -137,7 +137,7 @@ impl From for u32 { CTokenSdkError::MissingCompressibleExtension => 17031, CTokenSdkError::InvalidCTokenAccount => 17032, CTokenSdkError::CompressedTokenTypes(e) => e.into(), - CTokenSdkError::CTokenError(e) => e.into(), + CTokenSdkError::TokenError(e) => e.into(), CTokenSdkError::LightSdkTypesError(e) => e.into(), CTokenSdkError::LightSdkError(e) => e.into(), CTokenSdkError::ZeroCopyError(e) => e.into(), diff --git a/sdk-libs/ctoken-sdk/src/pack.rs b/sdk-libs/ctoken-sdk/src/pack.rs index b62c5581f7..cc2ad008e0 100644 --- a/sdk-libs/ctoken-sdk/src/pack.rs +++ b/sdk-libs/ctoken-sdk/src/pack.rs @@ -1,7 +1,7 @@ //! Pack implementation for TokenData types for c-tokens. use light_compressed_account::compressed_account::CompressedAccountWithMerkleContext; -pub use light_ctoken_interface::state::TokenData; -use light_ctoken_interface::state::TokenDataVersion; +pub use light_token_interface::state::TokenData; +use light_token_interface::state::TokenDataVersion; use light_sdk::{ instruction::PackedAccounts, light_hasher::{sha256::Sha256BE, HasherError}, @@ -25,7 +25,7 @@ pub trait Unpack { } impl Pack for TokenData { - type Packed = light_ctoken_interface::instructions::transfer2::MultiTokenTransferOutputData; + type Packed = light_token_interface::instructions::transfer2::MultiTokenTransferOutputData; fn pack(&self, remaining_accounts: &mut PackedAccounts) -> Self::Packed { Self::Packed { @@ -68,14 +68,14 @@ pub mod compat { Frozen = 1, } - impl From for light_ctoken_interface::state::CompressedTokenAccountState { + impl From for light_token_interface::state::CompressedTokenAccountState { fn from(state: AccountState) -> Self { match state { AccountState::Initialized => { - light_ctoken_interface::state::CompressedTokenAccountState::Initialized + light_token_interface::state::CompressedTokenAccountState::Initialized } AccountState::Frozen => { - light_ctoken_interface::state::CompressedTokenAccountState::Frozen + light_token_interface::state::CompressedTokenAccountState::Frozen } } } @@ -109,7 +109,7 @@ pub mod compat { /// The account's state pub state: AccountState, /// TLV extensions for compressed token accounts - pub tlv: Option>, + pub tlv: Option>, } impl TokenData { @@ -146,7 +146,7 @@ pub mod compat { impl From for crate::pack::TokenData { fn from(data: TokenData) -> Self { - use light_ctoken_interface::state::CompressedTokenAccountState; + use light_token_interface::state::CompressedTokenAccountState; Self { mint: data.mint.to_bytes().into(), @@ -321,7 +321,7 @@ pub mod compat { // TODO: remove aliases in separate PR pub type InputTokenDataCompressible = - light_ctoken_interface::instructions::transfer2::MultiTokenTransferOutputData; + light_token_interface::instructions::transfer2::MultiTokenTransferOutputData; pub type CompressibleTokenDataWithVariant = CTokenDataWithVariant; pub type PackedCompressibleTokenDataWithVariant = PackedCTokenDataWithVariant; pub type CTokenData = CTokenDataWithVariant; diff --git a/sdk-libs/ctoken-sdk/src/spl_interface.rs b/sdk-libs/ctoken-sdk/src/spl_interface.rs index fdba7dab2d..32b9a8d46e 100644 --- a/sdk-libs/ctoken-sdk/src/spl_interface.rs +++ b/sdk-libs/ctoken-sdk/src/spl_interface.rs @@ -1,13 +1,13 @@ //! SPL interface PDA derivation utilities. //! -//! Re-exports from `light_ctoken_interface` with convenience wrappers. +//! Re-exports from `light_token_interface` with convenience wrappers. -use light_ctoken_interface::{ +use light_token_interface::{ discriminator::{ADD_TOKEN_POOL, CREATE_TOKEN_POOL}, - CPI_AUTHORITY, CTOKEN_PROGRAM_ID, + CPI_AUTHORITY, LIGHT_TOKEN_PROGRAM_ID, }; -// Re-export derivation functions from ctoken-interface -pub use light_ctoken_interface::{ +// Re-export derivation functions from token-interface +pub use light_token_interface::{ find_spl_interface_pda, find_spl_interface_pda_with_index, get_spl_interface_pda, has_restricted_extensions, is_valid_spl_interface_pda, NUM_MAX_POOL_ACCOUNTS, }; @@ -100,7 +100,7 @@ impl CreateSplInterfacePda { if self.index == 0 { // CreateTokenPool instruction Instruction { - program_id: Pubkey::from(CTOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.fee_payer, true), AccountMeta::new(self.spl_interface_pda, false), @@ -116,7 +116,7 @@ impl CreateSplInterfacePda { let mut data = ADD_TOKEN_POOL.to_vec(); data.push(self.index); Instruction { - program_id: Pubkey::from(CTOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.fee_payer, true), AccountMeta::new(self.spl_interface_pda, false), diff --git a/sdk-libs/ctoken-sdk/src/utils.rs b/sdk-libs/ctoken-sdk/src/utils.rs index d85cb0fb08..91f256d210 100644 --- a/sdk-libs/ctoken-sdk/src/utils.rs +++ b/sdk-libs/ctoken-sdk/src/utils.rs @@ -1,7 +1,7 @@ //! Utility functions and default account configurations. -use light_ctoken_interface::{ - instructions::transfer2::MultiInputTokenDataWithContext, state::CToken, +use light_token_interface::{ + instructions::transfer2::MultiInputTokenDataWithContext, state::Token, }; use light_sdk_types::C_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; @@ -14,7 +14,7 @@ pub fn get_token_account_balance(token_account_info: &AccountInfo) -> Result Result { diff --git a/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs b/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs index 4f48f81fbe..c645dfa68d 100644 --- a/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs +++ b/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs @@ -1,7 +1,7 @@ #![cfg(test)] use light_account_checks::account_info::test_account_info::pinocchio::get_account_info; -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_ctoken_sdk::compressed_token::mint_action::{ cpi_accounts::MintActionCpiAccountsConfig, MintActionCpiAccounts, }; @@ -57,7 +57,7 @@ fn test_successful_parsing_minimal() { // Create minimal set of accounts required for parsing let accounts = vec![ // Programs - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -129,7 +129,7 @@ fn test_successful_parsing_minimal() { assert!(result.is_ok()); let parsed = result.unwrap(); - assert_eq!(*parsed.compressed_token_program.key(), CTOKEN_PROGRAM_ID); + assert_eq!(*parsed.compressed_token_program.key(), LIGHT_TOKEN_PROGRAM_ID); assert_eq!(*parsed.light_system_program.key(), LIGHT_SYSTEM_PROGRAM_ID); assert!(parsed.mint_signer.is_none()); assert!(parsed.authority.is_signer()); @@ -145,7 +145,7 @@ fn test_successful_parsing_with_all_options() { let accounts = vec![ // Programs - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -249,7 +249,7 @@ fn test_successful_create_mint() { let accounts = vec![ // Programs - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -325,7 +325,7 @@ fn test_successful_create_mint() { fn test_successful_update_mint() { let accounts = vec![ // Programs - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -479,7 +479,7 @@ fn test_invalid_light_system_program_id() { let wrong_program_id = pubkey_unique(); let accounts = vec![ - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), // Wrong light system program ID create_test_account(wrong_program_id, [0u8; 32], false, false, true, vec![]), // Rest of minimal accounts... @@ -537,7 +537,7 @@ fn test_invalid_light_system_program_id() { #[test] fn test_authority_not_signer() { let accounts = vec![ - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -602,7 +602,7 @@ fn test_authority_not_signer() { #[test] fn test_fee_payer_not_signer() { let accounts = vec![ - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -669,7 +669,7 @@ fn test_invalid_tree_ownership() { let wrong_owner = pubkey_unique(); let accounts = vec![ - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -728,7 +728,7 @@ fn test_invalid_queue_ownership() { let wrong_owner = pubkey_unique(); let accounts = vec![ - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -801,7 +801,7 @@ fn test_invalid_queue_ownership() { fn test_helper_methods() { // Create accounts for testing helper methods let accounts = vec![ - create_test_account(CTOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], diff --git a/sdk-libs/macros/src/compressible/GUIDE.md b/sdk-libs/macros/src/compressible/GUIDE.md index d12b356eca..04d37494b5 100644 --- a/sdk-libs/macros/src/compressible/GUIDE.md +++ b/sdk-libs/macros/src/compressible/GUIDE.md @@ -150,7 +150,7 @@ let ix = create_compressible_associated_token_account(CreateCompressibleAssociat rent_sponsor, pre_pay_num_epochs: 2, lamports_per_write: Some(1_000), - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, })?; ``` @@ -161,7 +161,7 @@ use light_ctoken_sdk::instructions::{ create_compressed_mint, CreateCompressedMintInputs, create_mint_to_compressed_instruction, MintToCompressedInputs }; -use light_ctoken_interface::instructions::mint_action::Recipient; +use light_token_interface::instructions::mint_action::Recipient; let create_cmint_ix = create_compressed_mint(CreateCompressedMintInputs { /* fill from RPC + keys */ })?; let mint_ix = create_mint_to_compressed_instruction(MintToCompressedInputs { @@ -177,10 +177,10 @@ use light_token_client::actions::{create_compressible_token_account, CreateCompr let token_acc = create_compressible_token_account(&mut rpc, CreateCompressibleTokenAccountInputs { owner, mint, num_prepaid_epochs: 2, payer: &payer, token_account_keypair: None, - lamports_per_write: None, token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat + lamports_per_write: None, token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat }).await?; -let sig = mint_to_compressed(&mut rpc, spl_mint_pda, vec![Recipient{ recipient: token_acc, amount: 1000 }], light_ctoken_interface::state::TokenDataVersion::ShaFlat, &mint_authority, &payer).await?; +let sig = mint_to_compressed(&mut rpc, spl_mint_pda, vec![Recipient{ recipient: token_acc, amount: 1000 }], light_token_interface::state::TokenDataVersion::ShaFlat, &mint_authority, &payer).await?; ``` ### TL;DR checklists diff --git a/sdk-libs/program-test/Cargo.toml b/sdk-libs/program-test/Cargo.toml index f7f331b0a8..c53e8becfa 100644 --- a/sdk-libs/program-test/Cargo.toml +++ b/sdk-libs/program-test/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [features] default = [] -devenv = ["v2","light-client/devenv", "light-prover-client/devenv", "dep:account-compression", "dep:light-compressed-token", "dep:light-ctoken-interface", "dep:light-compressible", "dep:light-registry", "dep:light-batched-merkle-tree", "dep:light-concurrent-merkle-tree"] +devenv = ["v2","light-client/devenv", "light-prover-client/devenv", "dep:account-compression", "dep:light-compressed-token", "dep:light-token-interface", "dep:light-compressible", "dep:light-registry", "dep:light-batched-merkle-tree", "dep:light-concurrent-merkle-tree"] v2 = ["light-client/v2"] [dependencies] @@ -18,7 +18,7 @@ light-merkle-tree-reference = { workspace = true } light-merkle-tree-metadata = { workspace = true, features = ["anchor"] } light-concurrent-merkle-tree = { workspace = true, optional = true } light-hasher = { workspace = true, features = ["poseidon", "sha256", "keccak", "std"] } -light-ctoken-interface = { workspace = true, optional = true } +light-token-interface = { workspace = true, optional = true } light-compressible = { workspace = true, optional = true } light-ctoken-sdk = { workspace = true } light-compressed-account = { workspace = true, features = ["anchor", "poseidon"] } diff --git a/sdk-libs/program-test/src/compressible.rs b/sdk-libs/program-test/src/compressible.rs index 0dad532349..e6da5ac183 100644 --- a/sdk-libs/program-test/src/compressible.rs +++ b/sdk-libs/program-test/src/compressible.rs @@ -16,8 +16,8 @@ use light_compressible::rent::RentConfig; #[cfg(feature = "devenv")] use light_compressible::rent::SLOTS_PER_EPOCH; #[cfg(feature = "devenv")] -use light_ctoken_interface::state::{ - CToken, CompressedMint, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, +use light_token_interface::state::{ + Token, CompressedMint, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; #[cfg(feature = "devenv")] use light_sdk::compressible::CompressibleConfig as CpdaCompressibleConfig; @@ -28,7 +28,7 @@ use solana_pubkey::Pubkey; use crate::{litesvm_extensions::LiteSvmExtensions, LightProgramTest}; /// Determines account type from account data. -/// - If account is exactly 165 bytes: CToken (legacy size without extensions) +/// - If account is exactly 165 bytes: Token (legacy size without extensions) /// - If account is > 165 bytes: read byte 165 for discriminator /// - If account is < 165 bytes: invalid (returns None) #[cfg(feature = "devenv")] @@ -37,22 +37,22 @@ fn determine_account_type(data: &[u8]) -> Option { match data.len().cmp(&ACCOUNT_TYPE_OFFSET) { std::cmp::Ordering::Less => None, - std::cmp::Ordering::Equal => Some(ACCOUNT_TYPE_TOKEN_ACCOUNT), // 165 bytes = CToken + std::cmp::Ordering::Equal => Some(ACCOUNT_TYPE_TOKEN_ACCOUNT), // 165 bytes = Token std::cmp::Ordering::Greater => Some(data[ACCOUNT_TYPE_OFFSET]), } } -/// Extracts CompressionInfo and account type from account data, handling both CToken and CMint. +/// Extracts CompressionInfo and account type from account data, handling both Token and CMint. /// Returns (CompressionInfo, account_type) or None if parsing fails. #[cfg(feature = "devenv")] fn extract_compression_info(data: &[u8]) -> Option<(CompressionInfo, u8)> { - use light_ctoken_interface::state::extensions::ExtensionStruct; + use light_token_interface::state::extensions::ExtensionStruct; let account_type = determine_account_type(data)?; match account_type { ACCOUNT_TYPE_TOKEN_ACCOUNT => { - let ctoken = CToken::deserialize(&mut &data[..]).ok()?; + let ctoken = Token::deserialize(&mut &data[..]).ok()?; // Get CompressionInfo from Compressible extension let compression_info = ctoken @@ -136,7 +136,7 @@ pub async fn claim_and_compress( let forester_keypair = rpc.test_accounts.protocol.forester.insecure_clone(); let payer = rpc.get_payer().insecure_clone(); - // Get all compressible token/mint accounts (both CToken and CMint) + // Get all compressible token/mint accounts (both Token and CMint) let compressible_ctoken_accounts = rpc .context .get_program_accounts(&light_compressed_token::ID); @@ -145,7 +145,7 @@ pub async fn claim_and_compress( .iter() .filter(|e| e.1.data.len() > 200 && e.1.lamports > 0) { - // Extract compression info and account type, handling both CToken and CMint + // Extract compression info and account type, handling both Token and CMint let Some((compression, account_type)) = extract_compression_info(&account.1.data) else { continue; }; @@ -201,7 +201,7 @@ pub async fn claim_and_compress( match state.calculate_claimable_rent(&compression.rent_config, rent_exemption) { None => { // Account is compressible (has rent deficit) - // Only CToken accounts can be compressed via compress_and_close_forester + // Only Token accounts can be compressed via compress_and_close_forester // CMint accounts have a different compression flow if stored_account.account_type == ACCOUNT_TYPE_TOKEN_ACCOUNT { compress_accounts.push(*pubkey); @@ -209,7 +209,7 @@ pub async fn claim_and_compress( } Some(claimable_amount) if claimable_amount > 0 => { // Has rent to claim from completed epochs - // Both CToken and CMint can be claimed + // Both Token and CMint can be claimed claim_accounts.push(*pubkey); } Some(_) => { diff --git a/sdk-libs/program-test/src/forester/compress_and_close_forester.rs b/sdk-libs/program-test/src/forester/compress_and_close_forester.rs index 7869262bf1..97ad43ec98 100644 --- a/sdk-libs/program-test/src/forester/compress_and_close_forester.rs +++ b/sdk-libs/program-test/src/forester/compress_and_close_forester.rs @@ -83,7 +83,7 @@ pub async fn compress_and_close_forester( packed_accounts.insert_or_get(output_queue); // Parse the ctoken account to get required pubkeys - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; let mut indices_vec = Vec::with_capacity(solana_ctoken_accounts.len()); @@ -108,7 +108,7 @@ pub async fn compress_and_close_forester( )) })?; - let (ctoken_account, _) = CToken::zero_copy_at(ctoken_solana_account.data.as_slice()) + let (ctoken_account, _) = Token::zero_copy_at(ctoken_solana_account.data.as_slice()) .map_err(|e| { RpcError::CustomError(format!( "Failed to parse ctoken account {}: {:?}", diff --git a/sdk-libs/token-client/Cargo.toml b/sdk-libs/token-client/Cargo.toml index 126ec238cf..373c9302b6 100644 --- a/sdk-libs/token-client/Cargo.toml +++ b/sdk-libs/token-client/Cargo.toml @@ -10,7 +10,7 @@ edition = { workspace = true } light-ctoken-types = { workspace = true } light-compressed-account = { workspace = true, features = ["std"] } light-compressible = { workspace = true, features = ["anchor"] } -light-ctoken-interface = { workspace = true } +light-token-interface = { workspace = true } light-sdk = { workspace = true } light-client = { workspace = true, features = ["v2"] } light-ctoken-sdk = { workspace = true } diff --git a/sdk-libs/token-client/src/actions/create_compressible_token_account.rs b/sdk-libs/token-client/src/actions/create_compressible_token_account.rs index 083ad68789..470f664d9c 100644 --- a/sdk-libs/token-client/src/actions/create_compressible_token_account.rs +++ b/sdk-libs/token-client/src/actions/create_compressible_token_account.rs @@ -1,5 +1,5 @@ use light_client::rpc::{Rpc, RpcError}; -use light_ctoken_interface::{has_restricted_extensions, state::TokenDataVersion}; +use light_token_interface::{has_restricted_extensions, state::TokenDataVersion}; use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; use solana_keypair::Keypair; use solana_pubkey::Pubkey; diff --git a/sdk-libs/token-client/src/actions/create_mint.rs b/sdk-libs/token-client/src/actions/create_mint.rs index 97eb3dec40..25940c6013 100644 --- a/sdk-libs/token-client/src/actions/create_mint.rs +++ b/sdk-libs/token-client/src/actions/create_mint.rs @@ -2,7 +2,7 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_interface::instructions::extensions::TokenMetadataInstructionData; +use light_token_interface::instructions::extensions::TokenMetadataInstructionData; use solana_keypair::Keypair; use solana_pubkey::Pubkey; use solana_signature::Signature; diff --git a/sdk-libs/token-client/src/actions/ctoken_transfer.rs b/sdk-libs/token-client/src/actions/ctoken_transfer.rs index 381b08da4d..9781d62e91 100644 --- a/sdk-libs/token-client/src/actions/ctoken_transfer.rs +++ b/sdk-libs/token-client/src/actions/ctoken_transfer.rs @@ -58,7 +58,7 @@ pub fn create_transfer_ctoken_instruction( authority: Pubkey, ) -> Result { let transfer_instruction = Instruction { - program_id: Pubkey::from(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::from(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(source, false), // Source token account AccountMeta::new(destination, false), // Destination token account diff --git a/sdk-libs/token-client/src/actions/mint_action.rs b/sdk-libs/token-client/src/actions/mint_action.rs index e08329d0ef..115d819bf4 100644 --- a/sdk-libs/token-client/src/actions/mint_action.rs +++ b/sdk-libs/token-client/src/actions/mint_action.rs @@ -2,7 +2,7 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_interface::instructions::mint_action::Recipient; +use light_token_interface::instructions::mint_action::Recipient; use light_ctoken_sdk::compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }; diff --git a/sdk-libs/token-client/src/actions/mint_to_compressed.rs b/sdk-libs/token-client/src/actions/mint_to_compressed.rs index eccea7e0d5..b4533ae4bf 100644 --- a/sdk-libs/token-client/src/actions/mint_to_compressed.rs +++ b/sdk-libs/token-client/src/actions/mint_to_compressed.rs @@ -2,7 +2,7 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_interface::{instructions::mint_action::Recipient, state::TokenDataVersion}; +use light_token_interface::{instructions::mint_action::Recipient, state::TokenDataVersion}; use solana_keypair::Keypair; use solana_pubkey::Pubkey; use solana_signature::Signature; diff --git a/sdk-libs/token-client/src/actions/spl_interface.rs b/sdk-libs/token-client/src/actions/spl_interface.rs index a24ec1b7cf..d5b2dcc89e 100644 --- a/sdk-libs/token-client/src/actions/spl_interface.rs +++ b/sdk-libs/token-client/src/actions/spl_interface.rs @@ -3,7 +3,7 @@ //! This module provides actions for working with SPL interface PDAs (token pools). use light_client::rpc::{Rpc, RpcError}; -use light_ctoken_interface::has_restricted_extensions; +use light_token_interface::has_restricted_extensions; use light_ctoken_sdk::spl_interface::{find_spl_interface_pda, CreateSplInterfacePda}; use solana_keypair::Keypair; use solana_pubkey::Pubkey; diff --git a/sdk-libs/token-client/src/actions/transfer2/compress.rs b/sdk-libs/token-client/src/actions/transfer2/compress.rs index 870c6466c8..d7bebc1929 100644 --- a/sdk-libs/token-client/src/actions/transfer2/compress.rs +++ b/sdk-libs/token-client/src/actions/transfer2/compress.rs @@ -2,7 +2,7 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_interface::state::TokenDataVersion; +use light_token_interface::state::TokenDataVersion; use solana_keypair::Keypair; use solana_pubkey::Pubkey; use solana_signature::Signature; diff --git a/sdk-libs/token-client/src/instructions/create_mint.rs b/sdk-libs/token-client/src/instructions/create_mint.rs index a7396eda8c..5a9ef8bb6a 100644 --- a/sdk-libs/token-client/src/instructions/create_mint.rs +++ b/sdk-libs/token-client/src/instructions/create_mint.rs @@ -2,7 +2,7 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_interface::instructions::extensions::{ +use light_token_interface::instructions::extensions::{ token_metadata::TokenMetadataInstructionData, ExtensionInstructionData, }; use light_ctoken_sdk::ctoken::{ diff --git a/sdk-libs/token-client/src/instructions/mint_action.rs b/sdk-libs/token-client/src/instructions/mint_action.rs index 50c5fcb15f..2363e34755 100644 --- a/sdk-libs/token-client/src/instructions/mint_action.rs +++ b/sdk-libs/token-client/src/instructions/mint_action.rs @@ -5,18 +5,18 @@ use light_client::{ }; use light_compressed_account::instruction_data::traits::LightInstructionData; use light_compressible::config::CompressibleConfig; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::{token_metadata::TokenMetadataInstructionData, ExtensionInstructionData}, mint_action::{ CompressAndCloseCMintAction, CompressedMintWithContext, DecompressMintAction, - MintActionCompressedInstructionData, MintToCTokenAction, MintToCompressedAction, + MintActionCompressedInstructionData, MintToTokenAction, MintToCompressedAction, Recipient, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }, }, state::CompressedMint, - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, }; use light_ctoken_sdk::compressed_token::{ create_compressed_mint::{derive_cmint_compressed_address, find_cmint_address}, @@ -150,10 +150,10 @@ pub async fn create_mint_action_instruction( })?; let mint_data = - light_ctoken_interface::instructions::mint_action::CompressedMintInstructionData { + light_token_interface::instructions::mint_action::CompressedMintInstructionData { supply: new_mint.supply, decimals: new_mint.decimals, - metadata: light_ctoken_interface::state::CompressedMintMetadata { + metadata: light_token_interface::state::CompressedMintMetadata { version: new_mint.version, mint: find_cmint_address(¶ms.mint_seed).0.to_bytes().into(), // false for new mint - on-chain sets to true after DecompressMint @@ -263,7 +263,7 @@ pub async fn create_mint_action_instruction( let current_index = ctoken_account_index; ctoken_account_index += 1; - instruction_data.with_mint_to_ctoken(MintToCTokenAction { + instruction_data.with_mint_to_token(MintToTokenAction { account_index: current_index, amount, }) @@ -385,7 +385,7 @@ pub async fn create_mint_action_instruction( // Build final instruction Ok(Instruction { - program_id: CTOKEN_PROGRAM_ID.into(), + program_id: LIGHT_TOKEN_PROGRAM_ID.into(), accounts: account_metas, data, }) diff --git a/sdk-libs/token-client/src/instructions/mint_to_compressed.rs b/sdk-libs/token-client/src/instructions/mint_to_compressed.rs index 4e05dcc7de..fda3fc5e34 100644 --- a/sdk-libs/token-client/src/instructions/mint_to_compressed.rs +++ b/sdk-libs/token-client/src/instructions/mint_to_compressed.rs @@ -3,7 +3,7 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{CompressedMintWithContext, Recipient}, state::{CompressedMint, TokenDataVersion}, }; diff --git a/sdk-libs/token-client/src/instructions/transfer2.rs b/sdk-libs/token-client/src/instructions/transfer2.rs index 306f3eebe9..abb6c58ad9 100644 --- a/sdk-libs/token-client/src/instructions/transfer2.rs +++ b/sdk-libs/token-client/src/instructions/transfer2.rs @@ -2,13 +2,13 @@ use light_client::{ indexer::{CompressedTokenAccount, Indexer}, rpc::Rpc, }; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::ExtensionInstructionData, transfer2::{MultiInputTokenDataWithContext, MultiTokenTransferOutputData}, }, state::TokenDataVersion, - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, }; use light_ctoken_sdk::{ compressed_token::{ @@ -303,7 +303,7 @@ pub async fn create_generic_transfer2_instruction( .unwrap() .owner; - if source_account_owner.to_bytes() != CTOKEN_PROGRAM_ID { + if source_account_owner.to_bytes() != LIGHT_TOKEN_PROGRAM_ID { // For SPL compression, get mint first let mint = input.mint; @@ -329,7 +329,7 @@ pub async fn create_generic_transfer2_instruction( )?; } else { // Regular compression for compressed token accounts - token_account.compress_ctoken(input.amount, source_index, authority_index)?; + token_account.compress_token(input.amount, source_index, authority_index)?; } token_accounts.push(token_account); } @@ -366,11 +366,11 @@ pub async fn create_generic_transfer2_instruction( // For is_ata, the compressed account owner is the ATA pubkey (stored during compress_and_close) // We keep that for hash calculation. The wallet owner signs instead of ATA pubkey. // Get the wallet owner from the destination CToken account and add as signer. - if is_ata && recipient_account_owner.to_bytes() == CTOKEN_PROGRAM_ID { - // Deserialize CToken to get wallet owner + if is_ata && recipient_account_owner.to_bytes() == LIGHT_TOKEN_PROGRAM_ID { + // Deserialize Token to get wallet owner use borsh::BorshDeserialize; - use light_ctoken_interface::state::CToken; - if let Ok(ctoken) = CToken::deserialize(&mut &recipient_account.data[..]) { + use light_token_interface::state::Token; + if let Ok(ctoken) = Token::deserialize(&mut &recipient_account.data[..]) { let wallet_owner = Pubkey::from(ctoken.owner.to_bytes()); // Add wallet owner as signer and get its index let wallet_owner_index = @@ -418,7 +418,7 @@ pub async fn create_generic_transfer2_instruction( inputs_offset += token_data.len(); let mut token_account = CTokenAccount2::new(token_data)?; - if recipient_account_owner.to_bytes() != CTOKEN_PROGRAM_ID { + if recipient_account_owner.to_bytes() != LIGHT_TOKEN_PROGRAM_ID { // For SPL decompression, get mint first let mint = input.compressed_token_account[0].token.mint; @@ -443,7 +443,7 @@ pub async fn create_generic_transfer2_instruction( )?; } else { // Use the new SPL-specific decompress method - token_account.decompress_ctoken(input.decompress_amount, recipient_index)?; + token_account.decompress_token(input.decompress_amount, recipient_index)?; } out_lamports.push( @@ -593,9 +593,9 @@ pub async fn create_generic_transfer2_instruction( .ok_or(CTokenSdkError::InvalidAccountData)?; // Parse the compressed token account using zero-copy deserialization - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; - let (compressed_token, _) = CToken::zero_copy_at(&token_account_info.data) + let (compressed_token, _) = Token::zero_copy_at(&token_account_info.data) .map_err(|_| CTokenSdkError::InvalidAccountData)?; let mint = compressed_token.mint; let balance: u64 = compressed_token.amount.into(); diff --git a/sdk-libs/token-client/src/instructions/update_compressed_mint.rs b/sdk-libs/token-client/src/instructions/update_compressed_mint.rs index b7b868b583..9665bf0693 100644 --- a/sdk-libs/token-client/src/instructions/update_compressed_mint.rs +++ b/sdk-libs/token-client/src/instructions/update_compressed_mint.rs @@ -3,7 +3,7 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, state::CompressedMint, }; @@ -45,7 +45,7 @@ pub async fn update_compressed_mint_instruction( // Get compressed account from indexer let compressed_accounts = rpc .get_compressed_accounts_by_owner( - &Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + &Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), None, None, ) diff --git a/sdk-tests/csdk-anchor-derived-test/Cargo.toml b/sdk-tests/csdk-anchor-derived-test/Cargo.toml index 1afce0cc75..e6c0438462 100644 --- a/sdk-tests/csdk-anchor-derived-test/Cargo.toml +++ b/sdk-tests/csdk-anchor-derived-test/Cargo.toml @@ -29,7 +29,7 @@ borsh = { workspace = true } light-compressed-account = { workspace = true, features = ["solana"] } anchor-lang = { workspace = true, features = ["idl-build"] } anchor-spl = { version = "=0.31.1", git = "https://github.com/lightprotocol/anchor", rev = "d8a2b3d9", features = ["memo", "metadata", "idl-build"] } -light-ctoken-interface = { workspace = true, features = ["anchor"] } +light-token-interface = { workspace = true, features = ["anchor"] } light-ctoken-sdk = { workspace = true, features = ["anchor", "compressible"] } light-ctoken-types = { workspace = true, features = ["anchor"] } light-compressible = { workspace = true, features = ["anchor"] } diff --git a/sdk-tests/csdk-anchor-derived-test/src/lib.rs b/sdk-tests/csdk-anchor-derived-test/src/lib.rs index b49ea8307f..804c3b7ef2 100644 --- a/sdk-tests/csdk-anchor-derived-test/src/lib.rs +++ b/sdk-tests/csdk-anchor-derived-test/src/lib.rs @@ -25,7 +25,7 @@ pub const LIGHT_CPI_SIGNER: CpiSigner = pub mod csdk_anchor_derived_test { use anchor_lang::solana_program::{program::invoke, sysvar::clock::Clock}; use light_compressed_account::instruction_data::traits::LightInstructionData; - use light_ctoken_interface::instructions::mint_action::{ + use light_token_interface::instructions::mint_action::{ MintActionCompressedInstructionData, MintToCompressedAction, Recipient, }; use light_ctoken_sdk::compressed_token::{ @@ -154,7 +154,7 @@ pub mod csdk_anchor_derived_test { recipients: vec![Recipient::new(token_account_address, 1000)], }) .with_cpi_context( - light_ctoken_interface::instructions::mint_action::CpiContext { + light_token_interface::instructions::mint_action::CpiContext { address_tree_pubkey: address_tree_pubkey.to_bytes(), set_context: false, first_set_context: false, @@ -186,7 +186,7 @@ pub mod csdk_anchor_derived_test { // Build mint action instruction let mint_action_instruction = solana_program::instruction::Instruction { - program_id: light_ctoken_interface::CTOKEN_PROGRAM_ID.into(), + program_id: light_token_interface::LIGHT_TOKEN_PROGRAM_ID.into(), accounts: account_metas, data, }; diff --git a/sdk-tests/csdk-anchor-derived-test/src/state.rs b/sdk-tests/csdk-anchor-derived-test/src/state.rs index 4ae5ce9f8f..55bd424236 100644 --- a/sdk-tests/csdk-anchor-derived-test/src/state.rs +++ b/sdk-tests/csdk-anchor-derived-test/src/state.rs @@ -1,5 +1,5 @@ use anchor_lang::prelude::*; -use light_ctoken_interface::instructions::mint_action::CompressedMintWithContext; +use light_token_interface::instructions::mint_action::CompressedMintWithContext; use light_sdk::{ compressible::CompressionInfo, instruction::{PackedAddressTreeInfo, ValidityProof}, diff --git a/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs b/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs index b5e40fbf03..4d96328f7a 100644 --- a/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs +++ b/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs @@ -1,7 +1,7 @@ use anchor_lang::{AccountDeserialize, AnchorDeserialize, InstructionData, ToAccountMetas}; use csdk_anchor_derived_test::{AccountCreationData, CompressionParams, GameSession, UserRecord}; use light_compressed_account::address::derive_address; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, state::CompressedMintMetadata, }; diff --git a/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml b/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml index 21b78a54d2..2d588b9546 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml +++ b/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml @@ -31,7 +31,7 @@ borsh = { workspace = true } light-compressed-account = { workspace = true, features = ["solana"] } anchor-lang = { workspace = true, features = ["idl-build"] } anchor-spl = { version = "=0.31.1", git = "https://github.com/lightprotocol/anchor", rev = "d8a2b3d9", features = ["memo", "metadata", "idl-build"] } -light-ctoken-interface = { workspace = true, features = ["anchor"] } +light-token-interface = { workspace = true, features = ["anchor"] } light-ctoken-sdk = { workspace = true, features = ["anchor", "compressible"] } light-ctoken-types = { workspace = true, features = ["anchor"] } light-compressible = { workspace = true, features = ["anchor"] } diff --git a/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs b/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs index 6f75ef39eb..5a71217af0 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs @@ -62,7 +62,7 @@ pub mod csdk_anchor_full_derived_test { #![allow(clippy::too_many_arguments)] use anchor_lang::solana_program::{program::invoke, sysvar::clock::Clock}; use light_compressed_account::instruction_data::traits::LightInstructionData; - use light_ctoken_interface::instructions::mint_action::{ + use light_token_interface::instructions::mint_action::{ MintActionCompressedInstructionData, MintToCompressedAction, Recipient, }; use light_ctoken_sdk::compressed_token::{ @@ -195,7 +195,7 @@ pub mod csdk_anchor_full_derived_test { recipients: vec![Recipient::new(token_account_address, 1000)], }) .with_cpi_context( - light_ctoken_interface::instructions::mint_action::CpiContext { + light_token_interface::instructions::mint_action::CpiContext { address_tree_pubkey: address_tree_pubkey.to_bytes(), set_context: false, first_set_context: false, @@ -227,7 +227,7 @@ pub mod csdk_anchor_full_derived_test { // Build mint action instruction let mint_action_instruction = solana_program::instruction::Instruction { - program_id: light_ctoken_interface::CTOKEN_PROGRAM_ID.into(), + program_id: light_token_interface::LIGHT_TOKEN_PROGRAM_ID.into(), accounts: account_metas, data, }; diff --git a/sdk-tests/csdk-anchor-full-derived-test/src/state.rs b/sdk-tests/csdk-anchor-full-derived-test/src/state.rs index 1e9a13ea9c..208f94e014 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/src/state.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/src/state.rs @@ -1,5 +1,5 @@ use anchor_lang::prelude::*; -use light_ctoken_interface::instructions::mint_action::CompressedMintWithContext; +use light_token_interface::instructions::mint_action::CompressedMintWithContext; use light_sdk::{ compressible::CompressionInfo, instruction::{PackedAddressTreeInfo, ValidityProof}, diff --git a/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs b/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs index ad7527679e..e71d9a006e 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs @@ -3,7 +3,7 @@ use csdk_anchor_full_derived_test::{ AccountCreationData, CompressionParams, GameSession, UserRecord, }; use light_compressed_account::address::derive_address; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, state::CompressedMintMetadata, }; diff --git a/sdk-tests/sdk-compressible-test/Cargo.toml b/sdk-tests/sdk-compressible-test/Cargo.toml index 5387cd75e8..4c0b1e179b 100644 --- a/sdk-tests/sdk-compressible-test/Cargo.toml +++ b/sdk-tests/sdk-compressible-test/Cargo.toml @@ -28,7 +28,7 @@ borsh = { workspace = true } light-compressed-account = { workspace = true, features = ["solana"] } anchor-lang = { workspace = true, features = ["idl-build"] } anchor-spl = { version = "=0.31.1", git = "https://github.com/lightprotocol/anchor", rev = "d8a2b3d9", features = ["memo", "metadata", "idl-build"] } -light-ctoken-interface = { workspace = true, features = ["anchor"] } +light-token-interface = { workspace = true, features = ["anchor"] } light-ctoken-sdk = { workspace = true, features = ["anchor", "compressible"] } light-ctoken-types = { workspace = true, features = ["anchor"] } light-compressible = { workspace = true, features = ["anchor"] } diff --git a/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs b/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs index a475baf412..c182369f35 100644 --- a/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs +++ b/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs @@ -3,7 +3,7 @@ use anchor_lang::{ solana_program::{instruction::Instruction, program::invoke, sysvar::clock::Clock}, }; use light_compressed_account::instruction_data::traits::LightInstructionData; -use light_ctoken_interface::instructions::mint_action::{MintToCompressedAction, Recipient}; +use light_token_interface::instructions::mint_action::{MintToCompressedAction, Recipient}; use light_ctoken_sdk::compressed_token::{ create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, }; @@ -123,7 +123,7 @@ pub fn create_user_record_and_game_session<'info>( let proof = compression_params.proof.0.unwrap_or_default(); let mut instruction_data = - light_ctoken_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint( + light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new_mint( 0, // root_index proof, compression_params.mint_with_context.mint.clone().unwrap(), @@ -156,7 +156,7 @@ pub fn create_user_record_and_game_session<'info>( ])); instruction_data = instruction_data.with_cpi_context( - light_ctoken_interface::instructions::mint_action::CpiContext { + light_token_interface::instructions::mint_action::CpiContext { address_tree_pubkey: address_tree_pubkey.to_bytes(), set_context: false, first_set_context: false, @@ -190,7 +190,7 @@ pub fn create_user_record_and_game_session<'info>( // Build instruction let mint_action_instruction = Instruction { - program_id: Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID), + program_id: Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), accounts: account_metas, data, }; diff --git a/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs b/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs index b8e0b272e2..33106f6ccb 100644 --- a/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs +++ b/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs @@ -217,7 +217,7 @@ pub fn decompress_accounts_idempotent<'info>( .cloned() .collect(); let compress_to_pubkey = - light_ctoken_interface::instructions::extensions::CompressToPubkey { + light_token_interface::instructions::extensions::CompressToPubkey { bump, program_id: crate::ID.to_bytes(), seeds: seeds_without_bump, @@ -236,7 +236,7 @@ pub fn decompress_accounts_idempotent<'info>( lamports_per_write: None, compress_to_account_pubkey: Some(compress_to_pubkey), token_account_version: - light_ctoken_interface::state::TokenDataVersion::ShaFlat, + light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }, } @@ -245,7 +245,7 @@ pub fn decompress_accounts_idempotent<'info>( // Construct MultiInputTokenDataWithContext from token data and meta let source = - light_ctoken_interface::instructions::transfer2::MultiInputTokenDataWithContext { + light_token_interface::instructions::transfer2::MultiInputTokenDataWithContext { owner: token_data.token_data.owner, amount: token_data.token_data.amount, has_delegate: token_data.token_data.has_delegate, diff --git a/sdk-tests/sdk-compressible-test/src/state.rs b/sdk-tests/sdk-compressible-test/src/state.rs index d8ad3de163..18907a0f0e 100644 --- a/sdk-tests/sdk-compressible-test/src/state.rs +++ b/sdk-tests/sdk-compressible-test/src/state.rs @@ -3,7 +3,7 @@ // hasCompressionInfo implementions. use anchor_lang::prelude::*; -use light_ctoken_interface::instructions::mint_action::CompressedMintWithContext; +use light_token_interface::instructions::mint_action::CompressedMintWithContext; use light_ctoken_sdk::pack::Pack as _TokenPack; use light_sdk::{ account::Size, diff --git a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs index 16f17de744..9d153da457 100644 --- a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs +++ b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs @@ -4,7 +4,7 @@ use anchor_lang::{ use light_client::indexer::CompressedAccount; use light_compressed_account::address::derive_address; use light_compressible_client::compressible_instruction; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, state::CompressedMintMetadata, }; diff --git a/sdk-tests/sdk-ctoken-test/Cargo.toml b/sdk-tests/sdk-ctoken-test/Cargo.toml index 401a60b0f2..9a03831843 100644 --- a/sdk-tests/sdk-ctoken-test/Cargo.toml +++ b/sdk-tests/sdk-ctoken-test/Cargo.toml @@ -19,7 +19,7 @@ default = [] # Light Protocol SDK dependencies (workspace-based) light-ctoken-sdk = { workspace = true } light-ctoken-types = { workspace = true } -light-ctoken-interface = { workspace = true } +light-token-interface = { workspace = true } light-sdk = { workspace = true, features = ["v2"] } light-sdk-types = { workspace = true } light-client = { workspace = true, optional = true } diff --git a/sdk-tests/sdk-ctoken-test/src/mint_to_ctoken.rs b/sdk-tests/sdk-ctoken-test/src/mint_to_ctoken.rs index e3b10c89ef..770f7f1c1a 100644 --- a/sdk-tests/sdk-ctoken-test/src/mint_to_ctoken.rs +++ b/sdk-tests/sdk-ctoken-test/src/mint_to_ctoken.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_interface::instructions::mint_action::CompressedMintWithContext; +use light_token_interface::instructions::mint_action::CompressedMintWithContext; use light_ctoken_sdk::ctoken::{MintToCTokenCpi, MintToCTokenParams, SystemAccountInfos}; use light_sdk::instruction::ValidityProof; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; diff --git a/sdk-tests/sdk-ctoken-test/tests/scenario_cmint.rs b/sdk-tests/sdk-ctoken-test/tests/scenario_cmint.rs index 66ddacf941..e1b1a8ef8f 100644 --- a/sdk-tests/sdk-ctoken-test/tests/scenario_cmint.rs +++ b/sdk-tests/sdk-ctoken-test/tests/scenario_cmint.rs @@ -16,7 +16,7 @@ mod shared; use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; use light_ctoken_sdk::ctoken::{ - CToken, CreateAssociatedCTokenAccount, DecompressToCtoken, TransferCToken, + CreateAssociatedCTokenAccount, DecompressToCtoken, Token, TransferCToken, }; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -66,12 +66,12 @@ async fn test_cmint_to_ctoken_scenario() { // 4. Verify initial balances let ctoken_account_data = rpc.get_account(ctoken_ata1).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let balance1 = ctoken_account.amount; assert_eq!(balance1, mint_amount1, "cToken account 1 initial balance"); let ctoken_account_data = rpc.get_account(ctoken_ata2).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let balance2 = ctoken_account.amount; assert_eq!(balance2, mint_amount2, "cToken account 2 initial balance"); @@ -103,7 +103,7 @@ async fn test_cmint_to_ctoken_scenario() { // 6. Verify balances after transfer let ctoken_account_data = rpc.get_account(ctoken_ata1).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let balance1_after = ctoken_account.amount; assert_eq!( balance1_after, @@ -112,7 +112,7 @@ async fn test_cmint_to_ctoken_scenario() { ); let ctoken_account_data = rpc.get_account(ctoken_ata2).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let balance2_after = ctoken_account.amount; assert_eq!( balance2_after, @@ -206,7 +206,7 @@ async fn test_cmint_to_ctoken_scenario() { "cToken ATA should exist after recreation" ); println!(" - cToken ATA recreated: {}", ctoken_ata2); - let deserialized_ata = CToken::try_from_slice(ctoken_account_data.data.as_slice()).unwrap(); + let deserialized_ata = Token::try_from_slice(ctoken_account_data.data.as_slice()).unwrap(); println!("deserialized ata {:?}", deserialized_ata); // 10. Get validity proof for the compressed account @@ -278,7 +278,7 @@ async fn test_cmint_to_ctoken_scenario() { // 13. Verify cToken account has tokens again let ctoken_account_data = rpc.get_account(ctoken_ata2).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let decompressed_balance = ctoken_account.amount; assert_eq!( decompressed_balance, diff --git a/sdk-tests/sdk-ctoken-test/tests/scenario_cmint_compression_only.rs b/sdk-tests/sdk-ctoken-test/tests/scenario_cmint_compression_only.rs index dc7c837ff3..99970f5a4f 100644 --- a/sdk-tests/sdk-ctoken-test/tests/scenario_cmint_compression_only.rs +++ b/sdk-tests/sdk-ctoken-test/tests/scenario_cmint_compression_only.rs @@ -16,7 +16,7 @@ mod shared; use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; use light_ctoken_sdk::ctoken::{ - CToken, CompressibleParams, CreateAssociatedCTokenAccount, DecompressToCtoken, TransferCToken, + CompressibleParams, CreateAssociatedCTokenAccount, DecompressToCtoken, Token, TransferCToken, }; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -68,12 +68,12 @@ async fn test_cmint_to_ctoken_scenario_compression_only() { // 4. Verify initial balances let ctoken_account_data = rpc.get_account(ctoken_ata1).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let balance1 = ctoken_account.amount; assert_eq!(balance1, mint_amount1, "cToken account 1 initial balance"); let ctoken_account_data = rpc.get_account(ctoken_ata2).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let balance2 = ctoken_account.amount; assert_eq!(balance2, mint_amount2, "cToken account 2 initial balance"); @@ -105,7 +105,7 @@ async fn test_cmint_to_ctoken_scenario_compression_only() { // 6. Verify balances after transfer let ctoken_account_data = rpc.get_account(ctoken_ata1).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let balance1_after = ctoken_account.amount; assert_eq!( balance1_after, @@ -114,7 +114,7 @@ async fn test_cmint_to_ctoken_scenario_compression_only() { ); let ctoken_account_data = rpc.get_account(ctoken_ata2).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let balance2_after = ctoken_account.amount; assert_eq!( balance2_after, @@ -212,7 +212,7 @@ async fn test_cmint_to_ctoken_scenario_compression_only() { "cToken ATA should exist after recreation" ); println!(" - cToken ATA recreated: {}", ctoken_ata2); - let deserialized_ata = CToken::try_from_slice(ctoken_account_data.data.as_slice()).unwrap(); + let deserialized_ata = Token::try_from_slice(ctoken_account_data.data.as_slice()).unwrap(); println!("deserialized ata {:?}", deserialized_ata); // 10. Get validity proof for the compressed account @@ -283,7 +283,7 @@ async fn test_cmint_to_ctoken_scenario_compression_only() { // 13. Verify cToken account has tokens again let ctoken_account_data = rpc.get_account(ctoken_ata2).await.unwrap().unwrap(); - let ctoken_account = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + let ctoken_account = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); let decompressed_balance = ctoken_account.amount; assert_eq!( decompressed_balance, diff --git a/sdk-tests/sdk-ctoken-test/tests/shared.rs b/sdk-tests/sdk-ctoken-test/tests/shared.rs index 6b5f6c7c22..01a49a177d 100644 --- a/sdk-tests/sdk-ctoken-test/tests/shared.rs +++ b/sdk-tests/sdk-ctoken-test/tests/shared.rs @@ -123,7 +123,7 @@ pub async fn setup_create_compressed_mint( .value .expect("Compressed mint should exist"); - use light_ctoken_interface::state::CompressedMint; + use light_token_interface::state::CompressedMint; let compressed_mint = CompressedMint::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) .unwrap(); @@ -136,7 +136,7 @@ pub async fn setup_create_compressed_mint( .value; // Build CompressedMintWithContext - use light_ctoken_interface::instructions::mint_action::CompressedMintWithContext; + use light_token_interface::instructions::mint_action::CompressedMintWithContext; let compressed_mint_with_context = CompressedMintWithContext { address: compression_address, leaf_index: compressed_mint_account.leaf_index, @@ -263,7 +263,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( // Decompress the mint to create an on-chain CMint account // This is required for freeze/thaw operations which need to read the mint { - use light_ctoken_interface::{ + use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; use light_ctoken_sdk::ctoken::DecompressCMint; @@ -494,7 +494,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( .value .expect("Compressed mint should exist"); - use light_ctoken_interface::state::CompressedMint; + use light_token_interface::state::CompressedMint; let compressed_mint = CompressedMint::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) .unwrap(); @@ -507,7 +507,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( .value; // Build CompressedMintWithContext - use light_ctoken_interface::instructions::mint_action::CompressedMintWithContext; + use light_token_interface::instructions::mint_action::CompressedMintWithContext; let compressed_mint_with_context = CompressedMintWithContext { address: compression_address, leaf_index: compressed_mint_account.leaf_index, diff --git a/sdk-tests/sdk-ctoken-test/tests/test_approve_revoke.rs b/sdk-tests/sdk-ctoken-test/tests/test_approve_revoke.rs index 1abca1dcc6..b63418825b 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_approve_revoke.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_approve_revoke.rs @@ -4,7 +4,7 @@ mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_ctoken_interface::state::CToken; +use light_token_interface::state::Token; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_sdk_types::C_TOKEN_PROGRAM_ID; use native_ctoken_examples::{ApproveData, InstructionType, ID, TOKEN_ACCOUNT_SEED}; @@ -64,7 +64,7 @@ async fn test_approve_invoke() { // Verify the delegate was set let ata_account = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken = CToken::deserialize(&mut &ata_account.data[..]).unwrap(); + let ctoken = Token::deserialize(&mut &ata_account.data[..]).unwrap(); assert_eq!( ctoken.delegate, @@ -123,7 +123,7 @@ async fn test_approve_invoke_signed() { // Verify the delegate was set let ata_account = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken = CToken::deserialize(&mut &ata_account.data[..]).unwrap(); + let ctoken = Token::deserialize(&mut &ata_account.data[..]).unwrap(); assert_eq!( ctoken.delegate, @@ -186,7 +186,7 @@ async fn test_revoke_invoke() { // Verify delegate was set let ata_account_after_approve = rpc.get_account(ata).await.unwrap().unwrap(); let ctoken_after_approve = - CToken::deserialize(&mut &ata_account_after_approve.data[..]).unwrap(); + Token::deserialize(&mut &ata_account_after_approve.data[..]).unwrap(); assert!( ctoken_after_approve.delegate.is_some(), "Delegate should be set" @@ -212,7 +212,7 @@ async fn test_revoke_invoke() { // Verify the delegate was cleared let ata_account_after_revoke = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after_revoke = CToken::deserialize(&mut &ata_account_after_revoke.data[..]).unwrap(); + let ctoken_after_revoke = Token::deserialize(&mut &ata_account_after_revoke.data[..]).unwrap(); assert_eq!( ctoken_after_revoke.delegate, None, @@ -272,7 +272,7 @@ async fn test_revoke_invoke_signed() { // Verify delegate was set let ata_account_after_approve = rpc.get_account(ata).await.unwrap().unwrap(); let ctoken_after_approve = - CToken::deserialize(&mut &ata_account_after_approve.data[..]).unwrap(); + Token::deserialize(&mut &ata_account_after_approve.data[..]).unwrap(); assert!( ctoken_after_approve.delegate.is_some(), "Delegate should be set" @@ -298,7 +298,7 @@ async fn test_revoke_invoke_signed() { // Verify the delegate was cleared let ata_account_after_revoke = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after_revoke = CToken::deserialize(&mut &ata_account_after_revoke.data[..]).unwrap(); + let ctoken_after_revoke = Token::deserialize(&mut &ata_account_after_revoke.data[..]).unwrap(); assert_eq!( ctoken_after_revoke.delegate, None, diff --git a/sdk-tests/sdk-ctoken-test/tests/test_burn.rs b/sdk-tests/sdk-ctoken-test/tests/test_burn.rs index 9f1b8e3478..63a6a6a367 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_burn.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_burn.rs @@ -4,7 +4,7 @@ mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_ctoken_interface::state::CToken; +use light_token_interface::state::Token; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_sdk_types::C_TOKEN_PROGRAM_ID; use native_ctoken_examples::{BurnData, InstructionType, ID, TOKEN_ACCOUNT_SEED}; @@ -39,7 +39,7 @@ async fn test_burn_invoke() { // Get initial state let ata_account_before = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_before = CToken::deserialize(&mut &ata_account_before.data[..]).unwrap(); + let ctoken_before = Token::deserialize(&mut &ata_account_before.data[..]).unwrap(); // Build burn instruction via wrapper program let mut instruction_data = vec![InstructionType::BurnInvoke as u8]; @@ -67,7 +67,7 @@ async fn test_burn_invoke() { // Verify with single assert_eq let ata_account_after = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after = CToken::deserialize(&mut &ata_account_after.data[..]).unwrap(); + let ctoken_after = Token::deserialize(&mut &ata_account_after.data[..]).unwrap(); let mut expected_ctoken = ctoken_before; expected_ctoken.amount = 700; // 1000 - 300 @@ -105,7 +105,7 @@ async fn test_burn_invoke_signed() { // Get initial state let ata_account_before = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_before = CToken::deserialize(&mut &ata_account_before.data[..]).unwrap(); + let ctoken_before = Token::deserialize(&mut &ata_account_before.data[..]).unwrap(); // Build burn instruction via wrapper program using invoke_signed let mut instruction_data = vec![InstructionType::BurnInvokeSigned as u8]; @@ -133,7 +133,7 @@ async fn test_burn_invoke_signed() { // Verify with single assert_eq let ata_account_after = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after = CToken::deserialize(&mut &ata_account_after.data[..]).unwrap(); + let ctoken_after = Token::deserialize(&mut &ata_account_after.data[..]).unwrap(); let mut expected_ctoken = ctoken_before; expected_ctoken.amount = 500; // 1000 - 500 diff --git a/sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs b/sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs index 9e4a264deb..5080cc4cce 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs @@ -73,8 +73,8 @@ async fn test_create_ata_invoke() { let ata_account_data = rpc.get_account(ata_address).await.unwrap().unwrap(); // Parse and verify account data - use light_ctoken_interface::state::CToken; - let account_state = CToken::deserialize(&mut &ata_account_data.data[..]).unwrap(); + use light_token_interface::state::Token; + let account_state = Token::deserialize(&mut &ata_account_data.data[..]).unwrap(); assert_eq!( account_state.mint.to_bytes(), mint_pda.to_bytes(), @@ -159,8 +159,8 @@ async fn test_create_ata_invoke_signed() { let ata_account_data = rpc.get_account(ata_address).await.unwrap().unwrap(); // Parse and verify account data - use light_ctoken_interface::state::CToken; - let account_state = CToken::deserialize(&mut &ata_account_data.data[..]).unwrap(); + use light_token_interface::state::Token; + let account_state = Token::deserialize(&mut &ata_account_data.data[..]).unwrap(); assert_eq!( account_state.mint.to_bytes(), mint_pda.to_bytes(), diff --git a/sdk-tests/sdk-ctoken-test/tests/test_create_cmint.rs b/sdk-tests/sdk-ctoken-test/tests/test_create_cmint.rs index 4a659d916a..a74ec335bd 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_create_cmint.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_create_cmint.rs @@ -4,7 +4,7 @@ mod shared; use borsh::BorshSerialize; use light_client::{indexer::Indexer, rpc::Rpc}; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::extensions::{ token_metadata::TokenMetadataInstructionData, ExtensionInstructionData, }, @@ -39,7 +39,7 @@ async fn test_create_compressed_mint() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); // Use SDK helper to derive the compression address correctly let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( @@ -147,7 +147,7 @@ async fn test_create_compressed_mint_invoke_signed() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); // Use SDK helper to derive the compression address correctly let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( diff --git a/sdk-tests/sdk-ctoken-test/tests/test_create_token_account.rs b/sdk-tests/sdk-ctoken-test/tests/test_create_token_account.rs index 51cc49fdb3..31b51f5768 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_create_token_account.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_create_token_account.rs @@ -73,8 +73,8 @@ async fn test_create_token_account_invoke() { .unwrap(); // Parse and verify account data - use light_ctoken_interface::state::CToken; - let account_state = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + use light_token_interface::state::Token; + let account_state = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); assert_eq!( account_state.mint.to_bytes(), mint_pda.to_bytes(), @@ -146,8 +146,8 @@ async fn test_create_token_account_invoke_signed() { let ctoken_account_data = rpc.get_account(ctoken_account_pda).await.unwrap().unwrap(); // Parse and verify account data - use light_ctoken_interface::state::CToken; - let account_state = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + use light_token_interface::state::Token; + let account_state = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); assert_eq!( account_state.mint.to_bytes(), mint_pda.to_bytes(), diff --git a/sdk-tests/sdk-ctoken-test/tests/test_ctoken_mint_to.rs b/sdk-tests/sdk-ctoken-test/tests/test_ctoken_mint_to.rs index c9ae154990..b31b4f357e 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_ctoken_mint_to.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_ctoken_mint_to.rs @@ -4,7 +4,7 @@ mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_ctoken_interface::state::CToken; +use light_token_interface::state::Token; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_sdk_types::C_TOKEN_PROGRAM_ID; use native_ctoken_examples::{InstructionType, MintToData, ID, MINT_AUTHORITY_SEED}; @@ -39,7 +39,7 @@ async fn test_ctoken_mint_to_invoke() { // Get initial state let ata_account_before = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_before = CToken::deserialize(&mut &ata_account_before.data[..]).unwrap(); + let ctoken_before = Token::deserialize(&mut &ata_account_before.data[..]).unwrap(); // Build mint instruction via wrapper program let mut instruction_data = vec![InstructionType::CTokenMintToInvoke as u8]; @@ -69,7 +69,7 @@ async fn test_ctoken_mint_to_invoke() { // Verify with single assert_eq let ata_account_after = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after = CToken::deserialize(&mut &ata_account_after.data[..]).unwrap(); + let ctoken_after = Token::deserialize(&mut &ata_account_after.data[..]).unwrap(); let mut expected_ctoken = ctoken_before; expected_ctoken.amount = 500; // 0 + 500 @@ -90,7 +90,7 @@ async fn test_ctoken_mint_to_invoke() { #[tokio::test] async fn test_ctoken_mint_to_invoke_signed() { use light_client::indexer::Indexer; - use light_ctoken_interface::{ + use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; use light_ctoken_sdk::ctoken::CreateAssociatedCTokenAccount; @@ -135,7 +135,7 @@ async fn test_ctoken_mint_to_invoke_signed() { .value; let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); let create_cmint_data = CreateCmintData { @@ -249,7 +249,7 @@ async fn test_ctoken_mint_to_invoke_signed() { // 13: account_compression_program (readonly) // 14: system_program (readonly) // 15: ctoken_program (readonly) - required for CPI - let ctoken_program_id = Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + let ctoken_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let wrapper_accounts = vec![ AccountMeta::new_readonly(mint_signer_pda, false), AccountMeta::new_readonly(pda_mint_authority, false), @@ -299,7 +299,7 @@ async fn test_ctoken_mint_to_invoke_signed() { // Get initial state let ata_account_before = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_before = CToken::deserialize(&mut &ata_account_before.data[..]).unwrap(); + let ctoken_before = Token::deserialize(&mut &ata_account_before.data[..]).unwrap(); // Step 4: Mint tokens using PDA authority via invoke_signed let mut instruction_data = vec![InstructionType::CTokenMintToInvokeSigned as u8]; @@ -328,7 +328,7 @@ async fn test_ctoken_mint_to_invoke_signed() { // Verify with single assert_eq let ata_account_after = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after = CToken::deserialize(&mut &ata_account_after.data[..]).unwrap(); + let ctoken_after = Token::deserialize(&mut &ata_account_after.data[..]).unwrap(); let mut expected_ctoken = ctoken_before; expected_ctoken.amount = 1000; // 0 + 1000 diff --git a/sdk-tests/sdk-ctoken-test/tests/test_decompress_cmint.rs b/sdk-tests/sdk-ctoken-test/tests/test_decompress_cmint.rs index 7dcae53446..a964a0f771 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_decompress_cmint.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_decompress_cmint.rs @@ -5,7 +5,7 @@ mod shared; use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; use light_compressible::compression_info::CompressionInfo; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; use light_ctoken_sdk::ctoken::{find_cmint_address, DecompressCMint}; @@ -301,7 +301,7 @@ async fn setup_create_compressed_mint_with_freeze_authority_only( /// Test decompressing a compressed mint with TokenMetadata extension #[tokio::test] async fn test_decompress_cmint_with_token_metadata() { - use light_ctoken_interface::instructions::extensions::{ + use light_token_interface::instructions::extensions::{ ExtensionInstructionData, TokenMetadataInstructionData, }; @@ -433,7 +433,7 @@ async fn setup_create_compressed_mint_with_extensions( mint_authority: Pubkey, freeze_authority: Option, decimals: u8, - extensions: Vec, + extensions: Vec, ) -> (Pubkey, [u8; 32], Keypair) { use light_ctoken_sdk::ctoken::{CreateCMint, CreateCMintParams}; @@ -551,7 +551,7 @@ async fn test_decompress_cmint_cpi_invoke_signed() { .value; let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); let create_cmint_data = CreateCmintData { @@ -655,7 +655,7 @@ async fn test_decompress_cmint_cpi_invoke_signed() { ] .concat(); - let ctoken_program_id = Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + let ctoken_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let wrapper_accounts = vec![ AccountMeta::new_readonly(mint_signer_pda, false), AccountMeta::new_readonly(pda_mint_authority, false), diff --git a/sdk-tests/sdk-ctoken-test/tests/test_freeze_thaw.rs b/sdk-tests/sdk-ctoken-test/tests/test_freeze_thaw.rs index ebf07236e7..dc0d2d4734 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_freeze_thaw.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_freeze_thaw.rs @@ -4,7 +4,7 @@ mod shared; use borsh::BorshDeserialize; use light_client::rpc::Rpc; -use light_ctoken_interface::state::{AccountState, CToken}; +use light_token_interface::state::{AccountState, Token}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_sdk_types::C_TOKEN_PROGRAM_ID; use native_ctoken_examples::{InstructionType, FREEZE_AUTHORITY_SEED, ID}; @@ -41,7 +41,7 @@ async fn test_freeze_invoke() { // Verify account is initially unfrozen let ata_account_before = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_before = CToken::deserialize(&mut &ata_account_before.data[..]).unwrap(); + let ctoken_before = Token::deserialize(&mut &ata_account_before.data[..]).unwrap(); assert_eq!( ctoken_before.state, AccountState::Initialized, @@ -74,7 +74,7 @@ async fn test_freeze_invoke() { // Verify the account is now frozen let ata_account_after = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after = CToken::deserialize(&mut &ata_account_after.data[..]).unwrap(); + let ctoken_after = Token::deserialize(&mut &ata_account_after.data[..]).unwrap(); assert_eq!( ctoken_after.state, @@ -129,7 +129,7 @@ async fn test_freeze_invoke_signed() { // Verify the account is now frozen let ata_account_after = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after = CToken::deserialize(&mut &ata_account_after.data[..]).unwrap(); + let ctoken_after = Token::deserialize(&mut &ata_account_after.data[..]).unwrap(); assert_eq!( ctoken_after.state, @@ -185,7 +185,7 @@ async fn test_thaw_invoke() { // Verify account is frozen let ata_account_after_freeze = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after_freeze = CToken::deserialize(&mut &ata_account_after_freeze.data[..]).unwrap(); + let ctoken_after_freeze = Token::deserialize(&mut &ata_account_after_freeze.data[..]).unwrap(); assert_eq!( ctoken_after_freeze.state, AccountState::Frozen, @@ -215,7 +215,7 @@ async fn test_thaw_invoke() { // Verify the account is now thawed (initialized) let ata_account_after_thaw = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after_thaw = CToken::deserialize(&mut &ata_account_after_thaw.data[..]).unwrap(); + let ctoken_after_thaw = Token::deserialize(&mut &ata_account_after_thaw.data[..]).unwrap(); assert_eq!( ctoken_after_thaw.state, @@ -268,7 +268,7 @@ async fn test_thaw_invoke_signed() { // Verify account is frozen let ata_account_after_freeze = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after_freeze = CToken::deserialize(&mut &ata_account_after_freeze.data[..]).unwrap(); + let ctoken_after_freeze = Token::deserialize(&mut &ata_account_after_freeze.data[..]).unwrap(); assert_eq!( ctoken_after_freeze.state, AccountState::Frozen, @@ -294,7 +294,7 @@ async fn test_thaw_invoke_signed() { // Verify the account is now thawed (initialized) let ata_account_after_thaw = rpc.get_account(ata).await.unwrap().unwrap(); - let ctoken_after_thaw = CToken::deserialize(&mut &ata_account_after_thaw.data[..]).unwrap(); + let ctoken_after_thaw = Token::deserialize(&mut &ata_account_after_thaw.data[..]).unwrap(); assert_eq!( ctoken_after_thaw.state, diff --git a/sdk-tests/sdk-ctoken-test/tests/test_mint_to_ctoken.rs b/sdk-tests/sdk-ctoken-test/tests/test_mint_to_ctoken.rs index 59260973eb..310e31f95d 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_mint_to_ctoken.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_mint_to_ctoken.rs @@ -85,7 +85,7 @@ async fn test_mint_to_ctoken() { .expect("Compressed mint should exist"); // Deserialize the compressed mint data - use light_ctoken_interface::state::CompressedMint; + use light_token_interface::state::CompressedMint; let compressed_mint = CompressedMint::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) .unwrap(); @@ -103,7 +103,7 @@ async fn test_mint_to_ctoken() { // Build CompressedMintWithContext from the compressed account let compressed_mint_with_context = - light_ctoken_interface::instructions::mint_action::CompressedMintWithContext { + light_token_interface::instructions::mint_action::CompressedMintWithContext { address: compression_address, leaf_index: compressed_mint_account.leaf_index, prove_by_index: true, @@ -124,7 +124,7 @@ async fn test_mint_to_ctoken() { // Build wrapper instruction with compressed token program as first account let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let mut wrapper_accounts = vec![AccountMeta::new_readonly( compressed_token_program_id, @@ -160,8 +160,8 @@ async fn test_mint_to_ctoken() { .unwrap(); // Parse the account data to verify balance - use light_ctoken_interface::state::CToken; - let account_state = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + use light_token_interface::state::Token; + let account_state = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); assert_eq!(account_state.amount, amount, "Token amount should match"); assert_eq!( account_state.mint.to_bytes(), @@ -221,7 +221,7 @@ async fn test_mint_to_ctoken_invoke_signed() { .value; let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); // Step 1: Create compressed mint with PDA authority using wrapper program (discriminator 14) @@ -320,7 +320,7 @@ async fn test_mint_to_ctoken_invoke_signed() { .expect("Compressed mint should exist"); // Deserialize the compressed mint data - use light_ctoken_interface::state::CompressedMint; + use light_token_interface::state::CompressedMint; let compressed_mint = CompressedMint::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) .unwrap(); @@ -338,7 +338,7 @@ async fn test_mint_to_ctoken_invoke_signed() { // Build CompressedMintWithContext from the compressed account let compressed_mint_with_context = - light_ctoken_interface::instructions::mint_action::CompressedMintWithContext { + light_token_interface::instructions::mint_action::CompressedMintWithContext { address: compression_address, leaf_index: compressed_mint_account.leaf_index, prove_by_index: true, @@ -362,7 +362,7 @@ async fn test_mint_to_ctoken_invoke_signed() { // Build accounts manually since SDK marks authority as signer, but we need it as non-signer // for invoke_signed (the wrapper program signs via CPI) let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); let wrapper_accounts = vec![ @@ -401,8 +401,8 @@ async fn test_mint_to_ctoken_invoke_signed() { .unwrap(); // Parse the account data to verify balance - use light_ctoken_interface::state::CToken; - let account_state = CToken::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); + use light_token_interface::state::Token; + let account_state = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); assert_eq!(account_state.amount, amount, "Token amount should match"); assert_eq!( account_state.mint.to_bytes(), diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer.rs b/sdk-tests/sdk-ctoken-test/tests/test_transfer.rs index 738f5ac425..3068975a15 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_transfer.rs @@ -60,13 +60,13 @@ async fn test_ctoken_transfer_invoke() { .unwrap(); // Verify final balances - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let source_data_after = rpc.get_account(source_ata).await.unwrap().unwrap(); - let source_state_after = CToken::deserialize(&mut &source_data_after.data[..]).unwrap(); + let source_state_after = Token::deserialize(&mut &source_data_after.data[..]).unwrap(); assert_eq!(source_state_after.amount, 500); let dest_data_after = rpc.get_account(dest_ata).await.unwrap().unwrap(); - let dest_state_after = CToken::deserialize(&mut &dest_data_after.data[..]).unwrap(); + let dest_state_after = Token::deserialize(&mut &dest_data_after.data[..]).unwrap(); assert_eq!(dest_state_after.amount, 500); } @@ -117,12 +117,12 @@ async fn test_ctoken_transfer_invoke_signed() { .unwrap(); // Verify final balances - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; let source_data_after = rpc.get_account(source_ata).await.unwrap().unwrap(); - let source_state_after = CToken::deserialize(&mut &source_data_after.data[..]).unwrap(); + let source_state_after = Token::deserialize(&mut &source_data_after.data[..]).unwrap(); assert_eq!(source_state_after.amount, 700); let dest_data_after = rpc.get_account(dest_ata).await.unwrap().unwrap(); - let dest_state_after = CToken::deserialize(&mut &dest_data_after.data[..]).unwrap(); + let dest_state_after = Token::deserialize(&mut &dest_data_after.data[..]).unwrap(); assert_eq!(dest_state_after.amount, 300); } diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer_checked.rs b/sdk-tests/sdk-ctoken-test/tests/test_transfer_checked.rs index 6b379c0fa0..c2baa8cb8a 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer_checked.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_transfer_checked.rs @@ -4,7 +4,7 @@ mod shared; use anchor_spl::token::{spl_token, Mint}; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_ctoken_interface::state::CToken; +use light_token_interface::state::Token; use light_ctoken_sdk::{ ctoken::{derive_ctoken_ata, CreateAssociatedCTokenAccount, TransferSplToCtoken}, spl_interface::{find_spl_interface_pda_with_index, CreateSplInterfacePda}, @@ -163,11 +163,11 @@ async fn test_ctoken_transfer_checked_spl_mint() { // Verify balances let source_data = rpc.get_account(source_ata).await.unwrap().unwrap(); - let source_state = CToken::deserialize(&mut &source_data.data[..]).unwrap(); + let source_state = Token::deserialize(&mut &source_data.data[..]).unwrap(); assert_eq!(source_state.amount, 500); let dest_data = rpc.get_account(dest_ata).await.unwrap().unwrap(); - let dest_state = CToken::deserialize(&mut &dest_data.data[..]).unwrap(); + let dest_state = Token::deserialize(&mut &dest_data.data[..]).unwrap(); assert_eq!(dest_state.amount, 500); } @@ -268,11 +268,11 @@ async fn test_ctoken_transfer_checked_t22_mint() { // Verify balances let source_data = rpc.get_account(source_ata).await.unwrap().unwrap(); - let source_state = CToken::deserialize(&mut &source_data.data[..]).unwrap(); + let source_state = Token::deserialize(&mut &source_data.data[..]).unwrap(); assert_eq!(source_state.amount, 500); let dest_data = rpc.get_account(dest_ata).await.unwrap().unwrap(); - let dest_state = CToken::deserialize(&mut &dest_data.data[..]).unwrap(); + let dest_state = Token::deserialize(&mut &dest_data.data[..]).unwrap(); assert_eq!(dest_state.amount, 500); } @@ -329,10 +329,10 @@ async fn test_ctoken_transfer_checked_cmint() { // Verify balances let source_data = rpc.get_account(source_ata).await.unwrap().unwrap(); - let source_state = CToken::deserialize(&mut &source_data.data[..]).unwrap(); + let source_state = Token::deserialize(&mut &source_data.data[..]).unwrap(); assert_eq!(source_state.amount, 500); let dest_data = rpc.get_account(dest_ata).await.unwrap().unwrap(); - let dest_state = CToken::deserialize(&mut &dest_data.data[..]).unwrap(); + let dest_state = Token::deserialize(&mut &dest_data.data[..]).unwrap(); assert_eq!(dest_state.amount, 500); } diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs b/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs index 201834df14..d79769cbfc 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs @@ -80,7 +80,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Build wrapper instruction @@ -189,7 +189,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Transfer SPL to CToken to fund it @@ -334,7 +334,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Fund sender CToken @@ -482,7 +482,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke_signed() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); let data = TransferInterfaceData { @@ -608,7 +608,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Fund PDA's CToken @@ -766,7 +766,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Fund source CToken diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs b/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs index 8a7597a6fd..15a5e803c5 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs @@ -91,7 +91,7 @@ async fn test_spl_to_ctoken_invoke() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Build wrapper instruction for SPL to CToken transfer @@ -218,7 +218,7 @@ async fn test_ctoken_to_spl_invoke() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); { @@ -391,7 +391,7 @@ async fn test_spl_to_ctoken_invoke_signed() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Build wrapper instruction for SPL to CToken transfer with PDA authority @@ -531,7 +531,7 @@ async fn test_ctoken_to_spl_invoke_signed() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); { diff --git a/sdk-tests/sdk-token-test/CLAUDE.md b/sdk-tests/sdk-token-test/CLAUDE.md index cd9e40ae8d..8aa1311507 100644 --- a/sdk-tests/sdk-token-test/CLAUDE.md +++ b/sdk-tests/sdk-token-test/CLAUDE.md @@ -1,7 +1,7 @@ ## TLDR - this is a test program that tests ctoken instructions with light-ctoken-sdk functions in integration tests - light-ctoken-sdk: sdk-libs/compressed-token-sdk -- light-ctoken-interface: program-libs/ctoken-types +- light-token-interface: program-libs/ctoken-types - light-compressed-token-program: programs/compressed-token/program/ diff --git a/sdk-tests/sdk-token-test/Cargo.toml b/sdk-tests/sdk-token-test/Cargo.toml index 8c7dd728e3..1608862a58 100644 --- a/sdk-tests/sdk-token-test/Cargo.toml +++ b/sdk-tests/sdk-token-test/Cargo.toml @@ -21,13 +21,13 @@ profile-program = [ "light-ctoken-sdk/profile-program", "light-program-profiler/profile-program", "light-compressed-account/profile-program", - "light-ctoken-interface/profile-program", + "light-token-interface/profile-program", ] profile-heap = [ "light-ctoken-sdk/profile-heap", "light-program-profiler/profile-heap", "light-compressed-account/profile-heap", - "light-ctoken-interface/profile-heap", + "light-token-interface/profile-heap", ] [dependencies] @@ -40,7 +40,7 @@ light-sdk-types = { workspace = true, features = ["cpi-context"] } light-compressed-account = { workspace = true, features = ["std"] } arrayvec = { workspace = true } light-batched-merkle-tree = { workspace = true } -light-ctoken-interface = { workspace = true, features = ["anchor"] } +light-token-interface = { workspace = true, features = ["anchor"] } light-zero-copy = { workspace = true } light-program-profiler = { workspace = true } diff --git a/sdk-tests/sdk-token-test/src/ctoken_pda/mint.rs b/sdk-tests/sdk-token-test/src/ctoken_pda/mint.rs index 9ae8a1460e..18314a1e2a 100644 --- a/sdk-tests/sdk-token-test/src/ctoken_pda/mint.rs +++ b/sdk-tests/sdk-token-test/src/ctoken_pda/mint.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_interface::instructions::mint_action::{ +use light_token_interface::instructions::mint_action::{ MintActionCompressedInstructionData, MintToCompressedAction, UpdateAuthority, }; use light_ctoken_sdk::compressed_token::{ @@ -36,7 +36,7 @@ pub fn process_mint_action<'a, 'info>( }); instruction_data = instruction_data.with_cpi_context( - light_ctoken_interface::instructions::mint_action::CpiContext { + light_token_interface::instructions::mint_action::CpiContext { set_context: false, first_set_context: true, in_tree_index: 0, diff --git a/sdk-tests/sdk-token-test/src/mint_compressed_tokens_cpi_write.rs b/sdk-tests/sdk-token-test/src/mint_compressed_tokens_cpi_write.rs index 6fe81d113f..d891b6258f 100644 --- a/sdk-tests/sdk-token-test/src/mint_compressed_tokens_cpi_write.rs +++ b/sdk-tests/sdk-token-test/src/mint_compressed_tokens_cpi_write.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_interface::instructions::mint_action::{ +use light_token_interface::instructions::mint_action::{ CompressedMintWithContext, MintActionCompressedInstructionData, MintToCompressedAction, Recipient, }; @@ -14,7 +14,7 @@ use crate::Generic; pub struct MintCompressedTokensCpiWriteParams { pub compressed_mint_with_context: CompressedMintWithContext, pub recipients: Vec, - pub cpi_context: light_ctoken_interface::instructions::mint_action::CpiContext, + pub cpi_context: light_token_interface::instructions::mint_action::CpiContext, pub cpi_context_pubkey: Pubkey, } diff --git a/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs b/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs index 86f16caab8..bf34987195 100644 --- a/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs +++ b/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs @@ -1,6 +1,6 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_interface::instructions::mint_action::{ - MintActionCompressedInstructionData, MintToCTokenAction, MintToCompressedAction, +use light_token_interface::instructions::mint_action::{ + MintActionCompressedInstructionData, MintToTokenAction, MintToCompressedAction, UpdateAuthority, }; use light_ctoken_sdk::compressed_token::{ @@ -27,7 +27,7 @@ pub fn process_mint_action<'a, 'info>( token_account_version: 2, recipients: input.token_recipients.clone(), }) - .with_mint_to_ctoken(MintToCTokenAction { + .with_mint_to_token(MintToTokenAction { account_index: 0, // Index in remaining accounts amount: input.token_recipients[0].amount, }) @@ -37,7 +37,7 @@ pub fn process_mint_action<'a, 'info>( .map(|auth| auth.to_bytes().into()), }) .with_cpi_context( - light_ctoken_interface::instructions::mint_action::CpiContext { + light_token_interface::instructions::mint_action::CpiContext { set_context: false, first_set_context: false, in_tree_index: 1, diff --git a/sdk-tests/sdk-token-test/src/pda_ctoken/processor.rs b/sdk-tests/sdk-token-test/src/pda_ctoken/processor.rs index 09588fb15e..100bbc1c5d 100644 --- a/sdk-tests/sdk-token-test/src/pda_ctoken/processor.rs +++ b/sdk-tests/sdk-token-test/src/pda_ctoken/processor.rs @@ -1,5 +1,5 @@ use anchor_lang::prelude::*; -use light_ctoken_interface::instructions::mint_action::{CompressedMintWithContext, Recipient}; +use light_token_interface::instructions::mint_action::{CompressedMintWithContext, Recipient}; use light_ctoken_sdk::ValidityProof; use super::{ diff --git a/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs b/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs index be78c62b65..de1e3cc516 100644 --- a/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs +++ b/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs @@ -91,7 +91,7 @@ pub fn process_compress_full_and_close<'info>( invoke(&instruction, account_infos.as_slice())?; let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); // Create close instruction with rent_sponsor for compressible accounts let close_instruction = CloseCTokenAccount::new( compressed_token_program_id, diff --git a/sdk-tests/sdk-token-test/src/process_create_ctoken_with_compress_to_pubkey.rs b/sdk-tests/sdk-token-test/src/process_create_ctoken_with_compress_to_pubkey.rs index b05688ea95..23d00cab18 100644 --- a/sdk-tests/sdk-token-test/src/process_create_ctoken_with_compress_to_pubkey.rs +++ b/sdk-tests/sdk-token-test/src/process_create_ctoken_with_compress_to_pubkey.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::*, solana_program::program::invoke_signed}; -use light_ctoken_interface::instructions::extensions::CompressToPubkey; +use light_token_interface::instructions::extensions::CompressToPubkey; use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; use crate::Generic; @@ -26,7 +26,7 @@ pub fn process_create_ctoken_with_compress_to_pubkey<'info>( pre_pay_num_epochs: 2, lamports_per_write: None, compress_to_account_pubkey: Some(compress_to_pubkey), - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: false, }; diff --git a/sdk-tests/sdk-token-test/src/process_four_transfer2.rs b/sdk-tests/sdk-token-test/src/process_four_transfer2.rs index 41f9ef5133..f628d8249f 100644 --- a/sdk-tests/sdk-token-test/src/process_four_transfer2.rs +++ b/sdk-tests/sdk-token-test/src/process_four_transfer2.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_interface::instructions::transfer2::MultiInputTokenDataWithContext; +use light_token_interface::instructions::transfer2::MultiInputTokenDataWithContext; use light_ctoken_sdk::compressed_token::{ transfer2::{ account_metas::Transfer2AccountsMetaConfig, create_transfer2_instruction, Transfer2Config, @@ -180,7 +180,7 @@ pub fn process_four_transfer2<'info>( four_invokes_params.compress_1.mint, ); token_account_compress - .compress_ctoken( + .compress_token( four_invokes_params.compress_1.amount, four_invokes_params.compress_1.solana_token_account, four_invokes_params.compress_1.authority, @@ -217,7 +217,7 @@ pub fn process_four_transfer2<'info>( validity_proof: proof, transfer_config: Transfer2Config { cpi_context: Some( - light_ctoken_interface::instructions::transfer2::CompressedCpiContext { + light_token_interface::instructions::transfer2::CompressedCpiContext { set_context: false, first_set_context: false, }, diff --git a/sdk-tests/sdk-token-test/tests/ctoken_pda.rs b/sdk-tests/sdk-token-test/tests/ctoken_pda.rs index 9f3be17fee..c45be83bdc 100644 --- a/sdk-tests/sdk-token-test/tests/ctoken_pda.rs +++ b/sdk-tests/sdk-token-test/tests/ctoken_pda.rs @@ -1,13 +1,13 @@ use anchor_lang::{AnchorDeserialize, InstructionData, ToAccountMetas}; use light_client::indexer::Indexer; use light_compressed_account::{address::derive_address, hash_to_bn254_field_size_be}; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::token_metadata::TokenMetadataInstructionData, mint_action::{CompressedMintInstructionData, CompressedMintWithContext, Recipient}, }, state::{extensions::AdditionalMetadata, CompressedMintMetadata}, - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, }; use light_ctoken_sdk::compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, @@ -91,7 +91,7 @@ async fn test_ctoken_pda() { println!("🧪 Verifying chained CPI results..."); // 1. Verify compressed mint was created and mint authority was revoked - let compressed_mint = light_ctoken_interface::state::CompressedMint::deserialize( + let compressed_mint = light_token_interface::state::CompressedMint::deserialize( &mut &mint_account.data.as_ref().unwrap().data[..], ) .unwrap(); @@ -206,7 +206,7 @@ pub async fn create_mint( }, mint_authority: Some(mint_authority.pubkey().into()), freeze_authority: freeze_authority.map(|fa| fa.into()), - extensions: metadata.map(|m| vec![light_ctoken_interface::instructions::extensions::ExtensionInstructionData::TokenMetadata(m)]), + extensions: metadata.map(|m| vec![light_token_interface::instructions::extensions::ExtensionInstructionData::TokenMetadata(m)]), }), }; @@ -225,7 +225,7 @@ pub async fn create_mint( payer: payer.pubkey(), mint_authority: mint_authority.pubkey(), mint_seed: mint_seed.pubkey(), - ctoken_program: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + ctoken_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), ctoken_cpi_authority: Pubkey::new_from_array(CPI_AUTHORITY_PDA), }; diff --git a/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs b/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs index 2cbf31c7ed..db4162b22c 100644 --- a/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs +++ b/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs @@ -4,7 +4,7 @@ use anchor_lang::{AnchorDeserialize, InstructionData}; /// Test input range for multi-input tests const TEST_INPUT_RANGE: [usize; 4] = [1, 2, 3, 4]; -use light_ctoken_interface::instructions::mint_action::{CompressedMintWithContext, Recipient}; +use light_token_interface::instructions::mint_action::{CompressedMintWithContext, Recipient}; use light_ctoken_sdk::compressed_token::{ create_compressed_mint::find_cmint_address, decompress_full::DecompressFullAccounts, }; @@ -82,7 +82,7 @@ async fn setup_decompress_full_test(num_inputs: usize) -> (LightProgramTest, Tes pre_pay_num_epochs: 0, lamports_per_write: None, compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -186,9 +186,9 @@ async fn test_decompress_full_cpi() { .await .unwrap() .unwrap(); - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; - let (dest_token, _) = CToken::zero_copy_at(&dest_account.data).unwrap(); + let (dest_token, _) = Token::zero_copy_at(&dest_account.data).unwrap(); assert_eq!( u64::from(dest_token.amount), 0, @@ -222,7 +222,7 @@ async fn test_decompress_full_cpi() { .iter() .map(|acc| { let discriminator = acc.account.data.as_ref().unwrap().discriminator; - light_ctoken_interface::state::TokenDataVersion::from_discriminator(discriminator) + light_token_interface::state::TokenDataVersion::from_discriminator(discriminator) .unwrap() as u8 }) .collect(); @@ -287,9 +287,9 @@ async fn test_decompress_full_cpi() { .await .unwrap() .unwrap(); - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; - let (dest_token_after, _) = CToken::zero_copy_at(&dest_account_after.data).unwrap(); + let (dest_token_after, _) = Token::zero_copy_at(&dest_account_after.data).unwrap(); assert_eq!( u64::from(dest_token_after.amount), ctx.compressed_amount_per_account, @@ -333,9 +333,9 @@ async fn test_decompress_full_cpi_with_context() { .await .unwrap() .unwrap(); - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; - let (dest_token_before, _) = CToken::zero_copy_at(&dest_account_before.data).unwrap(); + let (dest_token_before, _) = Token::zero_copy_at(&dest_account_before.data).unwrap(); assert_eq!( u64::from(dest_token_before.amount), 0, @@ -387,7 +387,7 @@ async fn test_decompress_full_cpi_with_context() { .unwrap() .value; - use light_ctoken_interface::state::CompressedMint; + use light_token_interface::state::CompressedMint; let compressed_mint = CompressedMint::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) .unwrap(); @@ -403,7 +403,7 @@ async fn test_decompress_full_cpi_with_context() { let mint_params = MintCompressedTokensCpiWriteParams { compressed_mint_with_context, recipients: mint_recipients, - cpi_context: light_ctoken_interface::instructions::mint_action::CpiContext { + cpi_context: light_token_interface::instructions::mint_action::CpiContext { set_context: false, first_set_context: true, // First operation sets the context in_tree_index: remaining_accounts @@ -429,7 +429,7 @@ async fn test_decompress_full_cpi_with_context() { .iter() .map(|acc| { let discriminator = acc.account.data.as_ref().unwrap().discriminator; - light_ctoken_interface::state::TokenDataVersion::from_discriminator(discriminator) + light_token_interface::state::TokenDataVersion::from_discriminator(discriminator) .unwrap() as u8 }) .collect(); @@ -516,9 +516,9 @@ async fn test_decompress_full_cpi_with_context() { .await .unwrap() .unwrap(); - use light_ctoken_interface::state::CToken; + use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; - let (dest_token_after, _) = CToken::zero_copy_at(&dest_account_after.data).unwrap(); + let (dest_token_after, _) = Token::zero_copy_at(&dest_account_after.data).unwrap(); assert_eq!( u64::from(dest_token_after.amount), ctx.compressed_amount_per_account, diff --git a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs index 513baff1c1..0ddfa68fd0 100644 --- a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs +++ b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs @@ -4,13 +4,13 @@ use anchor_lang::{ use anchor_spl::token_interface::spl_token_2022; use light_client::indexer::Indexer; use light_compressed_account::{address::derive_address, hash_to_bn254_field_size_be}; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ extensions::token_metadata::TokenMetadataInstructionData, mint_action::{CompressedMintInstructionData, CompressedMintWithContext, Recipient}, }, state::{extensions::AdditionalMetadata, CompressedMintMetadata}, - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, }; use light_ctoken_sdk::{ compressed_token::create_compressed_mint::{ @@ -97,7 +97,7 @@ async fn test_pda_ctoken() { println!("🧪 Verifying chained CPI results..."); // 1. Verify compressed mint was created and mint authority was revoked - let compressed_mint = light_ctoken_interface::state::CompressedMint::deserialize( + let compressed_mint = light_token_interface::state::CompressedMint::deserialize( &mut &mint_account.data.as_ref().unwrap().data[..], ) .unwrap(); @@ -212,7 +212,7 @@ pub async fn create_mint( pre_pay_num_epochs: 2, lamports_per_write: Some(1000), compress_to_account_pubkey: None, - token_account_version: light_ctoken_interface::state::TokenDataVersion::ShaFlat, + token_account_version: light_token_interface::state::TokenDataVersion::ShaFlat, compression_only: true, }; @@ -279,7 +279,7 @@ pub async fn create_mint( }, mint_authority: Some(mint_authority.pubkey().into()), freeze_authority: freeze_authority.map(|fa| fa.into()), - extensions: metadata.map(|m| vec![light_ctoken_interface::instructions::extensions::ExtensionInstructionData::TokenMetadata(m)]), + extensions: metadata.map(|m| vec![light_token_interface::instructions::extensions::ExtensionInstructionData::TokenMetadata(m)]), }), }; @@ -298,7 +298,7 @@ pub async fn create_mint( payer: payer.pubkey(), mint_authority: mint_authority.pubkey(), mint_seed: mint_seed.pubkey(), - ctoken_program: Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + ctoken_program: Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), ctoken_cpi_authority: Pubkey::new_from_array(CPI_AUTHORITY_PDA), token_account, }; diff --git a/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs b/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs index a9f0db4ad4..2c3f51b01f 100644 --- a/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs +++ b/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::AccountMeta, InstructionData}; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::{ mint_action::{CompressedMintWithContext, Recipient}, transfer2::MultiInputTokenDataWithContext, @@ -156,7 +156,7 @@ async fn create_compressed_mint_helper( // Find mint PDA let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let (mint_pda, _) = Pubkey::find_program_address( &[COMPRESSED_MINT_SEED, mint_signer.pubkey().as_ref()], &compressed_token_program_id, @@ -229,7 +229,7 @@ async fn mint_compressed_tokens( .unwrap(); // Create expected compressed mint for the input - let expected_compressed_mint = light_ctoken_interface::state::CompressedMint { + let expected_compressed_mint = light_token_interface::state::CompressedMint { base: BaseMint { mint_authority: Some(payer.pubkey().into()), supply: 0, diff --git a/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs b/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs index 39eea72671..39ae7a9ca1 100644 --- a/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs +++ b/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs @@ -2,12 +2,12 @@ use anchor_lang::{ prelude::{AccountMeta, Pubkey}, InstructionData, }; -use light_ctoken_interface::{ +use light_token_interface::{ instructions::mint_action::{CompressedMintWithContext, Recipient}, state::{ BaseMint, CompressedMint, CompressedMintMetadata, TokenDataVersion, ACCOUNT_TYPE_MINT, }, - COMPRESSED_MINT_SEED, CTOKEN_PROGRAM_ID, + COMPRESSED_MINT_SEED, LIGHT_TOKEN_PROGRAM_ID, }; use light_ctoken_sdk::{ compressed_token::{ @@ -52,7 +52,7 @@ async fn test_compress_full_and_close() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; let compressed_token_program_id = - Pubkey::new_from_array(light_ctoken_interface::CTOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let (mint_pda, _) = Pubkey::find_program_address( &[COMPRESSED_MINT_SEED, mint_signer.pubkey().as_ref()], &compressed_token_program_id, @@ -275,12 +275,12 @@ async fn test_compress_full_and_close() { // Create remaining accounts following four_multi_transfer pattern let mut remaining_accounts = PackedAccounts::default(); remaining_accounts.add_pre_accounts_meta(AccountMeta::new_readonly( - Pubkey::new_from_array(CTOKEN_PROGRAM_ID), + Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID), false, )); remaining_accounts .add_system_accounts_v2(SystemAccountMetaConfig::new(Pubkey::new_from_array( - CTOKEN_PROGRAM_ID, + LIGHT_TOKEN_PROGRAM_ID, ))) .unwrap(); diff --git a/sdk-tests/sdk-token-test/tests/test_compress_to_pubkey.rs b/sdk-tests/sdk-token-test/tests/test_compress_to_pubkey.rs index 822d575878..1c162165ee 100644 --- a/sdk-tests/sdk-token-test/tests/test_compress_to_pubkey.rs +++ b/sdk-tests/sdk-token-test/tests/test_compress_to_pubkey.rs @@ -1,5 +1,5 @@ use anchor_lang::InstructionData; -use light_ctoken_interface::CTOKEN_PROGRAM_ID; +use light_ctoken_sdk::ctoken::CTOKEN_PROGRAM_ID; use light_program_test::{ program_test::TestRpc, Indexer, LightProgramTest, ProgramTestConfig, Rpc, }; From daa8f59d46d94f71ca6c3d2b5413f948c23b66f7 Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 12 Jan 2026 21:41:32 +0000 Subject: [PATCH 2/9] chore: fix references to ctoken-types in programs directory - Update comment in extensions/mod.rs to reference light-token-interface instead of ctoken-types - Update SDK documentation in CLAUDE.md to reference light-token-interface and token-sdk instead of ctoken-types and ctoken-sdk - Both programs still compile successfully after renaming Co-Authored-By: Claude Opus 4.5 --- programs/compressed-token/program/CLAUDE.md | 4 ++-- programs/compressed-token/program/src/extensions/mod.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/programs/compressed-token/program/CLAUDE.md b/programs/compressed-token/program/CLAUDE.md index e218a065a5..b9035c9263 100644 --- a/programs/compressed-token/program/CLAUDE.md +++ b/programs/compressed-token/program/CLAUDE.md @@ -253,9 +253,9 @@ validate_mint_uniqueness(...).map_err(ProgramError::from)?; | 18 | MintDecimalsMismatch | Decimals mismatch | ## SDKs (`sdk-libs/`) -- **`ctoken-sdk/`** - SDK for programs to interact with compressed tokens (CPIs, instruction builders) +- **`token-sdk/`** - SDK for programs to interact with compressed tokens (CPIs, instruction builders) - **`token-client/`** - Client SDK for Rust applications (test helpers, transaction builders) -- **`ctoken-types/`** - Lightweight types for client-side usage +- **`light-token-interface/`** - Lightweight types for client-side usage ## Compressible Extension Documentation When working with ctoken accounts that have the compressible extension (rent management), you **MUST** read: diff --git a/programs/compressed-token/program/src/extensions/mod.rs b/programs/compressed-token/program/src/extensions/mod.rs index 433d25c86f..d61076a86e 100644 --- a/programs/compressed-token/program/src/extensions/mod.rs +++ b/programs/compressed-token/program/src/extensions/mod.rs @@ -6,7 +6,7 @@ pub mod token_metadata; pub use check_mint_extensions::{ check_mint_extensions, has_mint_extensions, parse_mint_extensions, MintExtensionChecks, }; -// Import from ctoken-types instead of local modules +// Import from light-token-interface instead of local modules use light_token_interface::{ instructions::mint_action::ZAction, state::{ From 4247906de97d76a539ba2b9933890cdd57c5a409 Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 12 Jan 2026 22:11:37 +0000 Subject: [PATCH 3/9] chore: rename light-ctoken-types to light-token-types Phase 2 of ctoken to light-token rename: - Rename crate: light-ctoken-types -> light-token-types - Rename directory: sdk-libs/ctoken-types -> sdk-libs/token-types - Update all imports across the codebase: - light-ctoken-types -> light-token-types (Cargo.toml) - light_ctoken_types -> light_token_types (Rust code) - Update workspace Cargo.toml dependency --- Cargo.lock | 42 +++++++++---------- Cargo.toml | 2 +- sdk-libs/ctoken-sdk/Cargo.toml | 4 +- .../src/compressed_token/v1/account.rs | 2 +- .../v1/approve/instruction.rs | 2 +- .../v1/batch_compress/instruction.rs | 2 +- .../ctoken-sdk/src/compressed_token/v1/mod.rs | 2 +- .../v1/transfer/instruction.rs | 2 +- .../src/compressed_token/v1/transfer/mod.rs | 2 +- .../v2/mint_action/cpi_accounts.rs | 2 +- .../v2/mint_to_compressed/instruction.rs | 4 +- .../v2/transfer2/account_metas.rs | 2 +- .../v2/transfer2/cpi_accounts.rs | 2 +- .../v2/update_compressed_mint/instruction.rs | 2 +- sdk-libs/ctoken-sdk/src/constants.rs | 16 +++---- .../ctoken/create_associated_token_account.rs | 10 ++--- sdk-libs/ctoken-sdk/src/ctoken/mod.rs | 2 +- sdk-libs/ctoken-sdk/src/error.rs | 2 +- sdk-libs/ctoken-sdk/src/utils.rs | 2 +- .../ctoken-sdk/tests/account_metas_test.rs | 2 +- .../tests/mint_action_cpi_accounts_tests.rs | 2 +- sdk-libs/token-client/Cargo.toml | 2 +- .../src/actions/update_compressed_mint.rs | 2 +- .../instructions/update_compressed_mint.rs | 2 +- .../{ctoken-types => token-types}/Cargo.toml | 2 +- .../src/account_infos/batch_compress.rs | 0 .../src/account_infos/burn.rs | 0 .../src/account_infos/config.rs | 0 .../account_infos/create_compressed_mint.rs | 0 .../src/account_infos/freeze.rs | 0 .../src/account_infos/mint_to.rs | 0 .../src/account_infos/mint_to_compressed.rs | 0 .../src/account_infos/mod.rs | 0 .../src/account_infos/transfer.rs | 0 .../src/constants.rs | 0 .../src/error.rs | 0 .../src/instruction/batch_compress.rs | 0 .../src/instruction/burn.rs | 0 .../src/instruction/delegation.rs | 0 .../src/instruction/freeze.rs | 0 .../src/instruction/generic.rs | 0 .../src/instruction/mint_to.rs | 0 .../src/instruction/mod.rs | 0 .../src/instruction/transfer.rs | 0 .../src/instruction/update_compressed_mint.rs | 0 .../{ctoken-types => token-types}/src/lib.rs | 0 sdk-tests/csdk-anchor-derived-test/Cargo.toml | 2 +- .../tests/basic_test.rs | 3 +- .../csdk-anchor-full-derived-test/Cargo.toml | 2 +- .../tests/basic_test.rs | 3 +- sdk-tests/sdk-compressible-test/Cargo.toml | 2 +- .../tests/multi_account_tests.rs | 2 +- sdk-tests/sdk-ctoken-test/Cargo.toml | 2 +- .../tests/test_transfer_interface.rs | 2 +- .../tests/test_transfer_spl_ctoken.rs | 2 +- sdk-tests/sdk-token-test/Cargo.toml | 2 +- .../src/process_batch_compress_tokens.rs | 2 +- sdk-tests/sdk-token-test/tests/ctoken_pda.rs | 2 +- sdk-tests/sdk-token-test/tests/pda_ctoken.rs | 2 +- sdk-tests/sdk-token-test/tests/test.rs | 2 +- .../tests/test_4_invocations.rs | 2 +- .../sdk-token-test/tests/test_deposit.rs | 2 +- 62 files changed, 76 insertions(+), 74 deletions(-) rename sdk-libs/{ctoken-types => token-types}/Cargo.toml (95%) rename sdk-libs/{ctoken-types => token-types}/src/account_infos/batch_compress.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/account_infos/burn.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/account_infos/config.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/account_infos/create_compressed_mint.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/account_infos/freeze.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/account_infos/mint_to.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/account_infos/mint_to_compressed.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/account_infos/mod.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/account_infos/transfer.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/constants.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/error.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/instruction/batch_compress.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/instruction/burn.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/instruction/delegation.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/instruction/freeze.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/instruction/generic.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/instruction/mint_to.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/instruction/mod.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/instruction/transfer.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/instruction/update_compressed_mint.rs (100%) rename sdk-libs/{ctoken-types => token-types}/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index abf6331f04..074c75308b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1646,7 +1646,6 @@ dependencies = [ "light-compressible", "light-compressible-client", "light-ctoken-sdk", - "light-ctoken-types", "light-hasher", "light-macros", "light-program-test", @@ -1656,6 +1655,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-types", "solana-account", "solana-instruction", "solana-keypair", @@ -1681,7 +1681,6 @@ dependencies = [ "light-compressible", "light-compressible-client", "light-ctoken-sdk", - "light-ctoken-types", "light-hasher", "light-macros", "light-program-test", @@ -1691,6 +1690,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-types", "solana-account", "solana-account-info", "solana-instruction", @@ -3759,12 +3759,12 @@ dependencies = [ "light-compressed-account", "light-compressed-token", "light-compressible", - "light-ctoken-types", "light-macros", "light-program-profiler", "light-sdk", "light-sdk-types", "light-token-interface", + "light-token-types", "light-zero-copy", "pinocchio", "solana-account-info", @@ -3778,20 +3778,6 @@ dependencies = [ "thiserror 2.0.17", ] -[[package]] -name = "light-ctoken-types" -version = "0.2.1" -dependencies = [ - "anchor-lang", - "borsh 0.10.4", - "light-account-checks", - "light-compressed-account", - "light-macros", - "light-sdk-types", - "solana-msg 2.2.1", - "thiserror 2.0.17", -] - [[package]] name = "light-event" version = "0.2.1" @@ -4253,9 +4239,9 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-ctoken-sdk", - "light-ctoken-types", "light-sdk", "light-token-interface", + "light-token-types", "light-zero-copy", "solana-instruction", "solana-keypair", @@ -4303,6 +4289,20 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "light-token-types" +version = "0.2.1" +dependencies = [ + "anchor-lang", + "borsh 0.10.4", + "light-account-checks", + "light-compressed-account", + "light-macros", + "light-sdk-types", + "solana-msg 2.2.1", + "thiserror 2.0.17", +] + [[package]] name = "light-verifier" version = "6.0.0" @@ -6051,7 +6051,6 @@ dependencies = [ "light-compressible", "light-compressible-client", "light-ctoken-sdk", - "light-ctoken-types", "light-hasher", "light-macros", "light-program-test", @@ -6060,6 +6059,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-types", "solana-account", "solana-instruction", "solana-keypair", @@ -6084,12 +6084,12 @@ dependencies = [ "light-compressible", "light-compressible-client", "light-ctoken-sdk", - "light-ctoken-types", "light-program-test", "light-sdk", "light-sdk-types", "light-test-utils", "light-token-interface", + "light-token-types", "solana-program", "solana-sdk", "spl-pod", @@ -6160,7 +6160,6 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-ctoken-sdk", - "light-ctoken-types", "light-hasher", "light-program-profiler", "light-program-test", @@ -6169,6 +6168,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-types", "light-zero-copy", "serial_test", "solana-sdk", diff --git a/Cargo.toml b/Cargo.toml index ac66d6d86e..d607ad81db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -204,7 +204,7 @@ account-compression = { path = "programs/account-compression", version = "2.0.0" light-compressed-token = { path = "programs/compressed-token/program", version = "2.1.0", features = [ "cpi", ] } -light-ctoken-types = { path = "sdk-libs/ctoken-types", version = "0.2.1" } +light-token-types = { path = "sdk-libs/token-types", version = "0.2.1" } light-ctoken-sdk = { path = "sdk-libs/ctoken-sdk", version = "0.2.1" } light-token-client = { path = "sdk-libs/token-client", version = "0.1.0" } light-system-program-anchor = { path = "anchor-programs/system", version = "2.0.0", features = [ diff --git a/sdk-libs/ctoken-sdk/Cargo.toml b/sdk-libs/ctoken-sdk/Cargo.toml index 64625e38c1..f7962290c5 100644 --- a/sdk-libs/ctoken-sdk/Cargo.toml +++ b/sdk-libs/ctoken-sdk/Cargo.toml @@ -11,7 +11,7 @@ default = [] v1 = [] compressible = [] -anchor = ["anchor-lang", "light-ctoken-types/anchor", "light-token-interface/anchor"] +anchor = ["anchor-lang", "light-token-types/anchor", "light-token-interface/anchor"] cpi-context = ["light-sdk/cpi-context"] profile-program = [ "light-program-profiler/profile-program", @@ -26,7 +26,7 @@ profile-heap = [ [dependencies] # Light Protocol dependencies -light-ctoken-types = { workspace = true } +light-token-types = { workspace = true } light-compressed-account = { workspace = true, features = ["std"] } light-compressible = { workspace = true } light-token-interface = { workspace = true } diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/account.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v1/account.rs index c7d77991a1..b297067011 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/account.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v1/account.rs @@ -1,6 +1,6 @@ use std::ops::Deref; -use light_ctoken_types::{PackedTokenTransferOutputData, TokenAccountMeta}; +use light_token_types::{PackedTokenTransferOutputData, TokenAccountMeta}; use solana_pubkey::Pubkey; use crate::error::CTokenSdkError; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs index 6b5c585ee3..785090482d 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs @@ -1,6 +1,6 @@ use borsh::BorshSerialize; use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; -use light_ctoken_types::{ +use light_token_types::{ instruction::delegation::CompressedTokenInstructionDataApprove, ValidityProof, }; use solana_instruction::Instruction; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs index 16fa1ffaf6..75041bdc3a 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs @@ -1,5 +1,5 @@ use light_token_interface; -use light_ctoken_types::{ +use light_token_types::{ instruction::batch_compress::BatchCompressInstructionData, BATCH_COMPRESS, }; use solana_instruction::Instruction; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/mod.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v1/mod.rs index 3322df7f0e..c6d99e9151 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/mod.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v1/mod.rs @@ -4,4 +4,4 @@ pub mod batch_compress; pub mod transfer; pub use account::*; -pub use light_ctoken_types::TokenAccountMeta; +pub use light_token_types::TokenAccountMeta; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs index e3567750d0..69a6126b05 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs @@ -1,5 +1,5 @@ use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; -use light_ctoken_types::{ +use light_token_types::{ constants::TRANSFER, instruction::transfer::CompressedTokenInstructionDataTransfer, CompressedCpiContext, ValidityProof, }; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/mod.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/mod.rs index d02cd38bd1..a0a00ada2e 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/mod.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/mod.rs @@ -1,4 +1,4 @@ -use light_ctoken_types::account_infos::TransferAccountInfos as TransferAccountInfosTypes; +use light_token_types::account_infos::TransferAccountInfos as TransferAccountInfosTypes; use solana_account_info::AccountInfo; pub mod account_infos; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs index 3fed476b03..4bcb516e79 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs @@ -1,6 +1,6 @@ use light_account_checks::{AccountError, AccountInfoTrait, AccountIterator}; use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; -use light_ctoken_types::CPI_AUTHORITY_PDA; +use light_token_types::CPI_AUTHORITY_PDA; use light_program_profiler::profile; use light_sdk_types::{ ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, LIGHT_SYSTEM_PROGRAM_ID, diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs index cbc30f3a90..5326b5fa68 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs @@ -2,8 +2,8 @@ use light_compressed_account::instruction_data::traits::LightInstructionData; use light_token_interface::instructions::mint_action::{ CompressedMintWithContext, CpiContext, Recipient, }; -pub use light_ctoken_types::account_infos::mint_to_compressed::DecompressedMintConfig; -use light_ctoken_types::CompressedProof; +pub use light_token_types::account_infos::mint_to_compressed::DecompressedMintConfig; +use light_token_types::CompressedProof; use solana_instruction::Instruction; use solana_pubkey::Pubkey; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/account_metas.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/account_metas.rs index 68bae49e47..8b774ee215 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/account_metas.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/account_metas.rs @@ -1,4 +1,4 @@ -use light_ctoken_types::CPI_AUTHORITY_PDA; +use light_token_types::CPI_AUTHORITY_PDA; use light_sdk::constants::LIGHT_SYSTEM_PROGRAM_ID; use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs index 326656c163..722ec73273 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs @@ -1,6 +1,6 @@ use light_account_checks::{AccountError, AccountInfoTrait, AccountIterator}; use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; -use light_ctoken_types::CPI_AUTHORITY_PDA; +use light_token_types::CPI_AUTHORITY_PDA; use light_program_profiler::profile; use light_sdk_types::{ ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, LIGHT_SYSTEM_PROGRAM_ID, diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs b/sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs index 317c4ff9ea..e0ef8b3873 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs +++ b/sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs @@ -5,7 +5,7 @@ use light_token_interface::{ self, instructions::mint_action::{CompressedMintWithContext, CpiContext}, }; -use light_ctoken_types::CompressedMintAuthorityType; +use light_token_types::CompressedMintAuthorityType; use solana_instruction::Instruction; use solana_pubkey::Pubkey; diff --git a/sdk-libs/ctoken-sdk/src/constants.rs b/sdk-libs/ctoken-sdk/src/constants.rs index c53312c423..cde0a6c32a 100644 --- a/sdk-libs/ctoken-sdk/src/constants.rs +++ b/sdk-libs/ctoken-sdk/src/constants.rs @@ -1,22 +1,22 @@ use solana_pubkey::Pubkey; pub const SPL_TOKEN_PROGRAM_ID: Pubkey = - Pubkey::new_from_array(light_ctoken_types::SPL_TOKEN_PROGRAM_ID); + Pubkey::new_from_array(light_token_types::SPL_TOKEN_PROGRAM_ID); pub const SPL_TOKEN_2022_PROGRAM_ID: Pubkey = - Pubkey::new_from_array(light_ctoken_types::SPL_TOKEN_2022_PROGRAM_ID); + Pubkey::new_from_array(light_token_types::SPL_TOKEN_2022_PROGRAM_ID); pub const LIGHT_SYSTEM_PROGRAM_ID: Pubkey = - Pubkey::new_from_array(light_ctoken_types::LIGHT_SYSTEM_PROGRAM_ID); + Pubkey::new_from_array(light_token_types::LIGHT_SYSTEM_PROGRAM_ID); pub const ACCOUNT_COMPRESSION_PROGRAM_ID: Pubkey = - Pubkey::new_from_array(light_ctoken_types::ACCOUNT_COMPRESSION_PROGRAM_ID); + Pubkey::new_from_array(light_token_types::ACCOUNT_COMPRESSION_PROGRAM_ID); pub const ACCOUNT_COMPRESSION_AUTHORITY_PDA: Pubkey = - Pubkey::new_from_array(light_ctoken_types::ACCOUNT_COMPRESSION_AUTHORITY_PDA); + Pubkey::new_from_array(light_token_types::ACCOUNT_COMPRESSION_AUTHORITY_PDA); -pub const NOOP_PROGRAM_ID: Pubkey = Pubkey::new_from_array(light_ctoken_types::NOOP_PROGRAM_ID); +pub const NOOP_PROGRAM_ID: Pubkey = Pubkey::new_from_array(light_token_types::NOOP_PROGRAM_ID); -pub const CPI_AUTHORITY_PDA: Pubkey = Pubkey::new_from_array(light_ctoken_types::CPI_AUTHORITY_PDA); +pub const CPI_AUTHORITY_PDA: Pubkey = Pubkey::new_from_array(light_token_types::CPI_AUTHORITY_PDA); -pub const CTOKEN_PROGRAM_ID: Pubkey = Pubkey::new_from_array(light_ctoken_types::PROGRAM_ID); +pub const CTOKEN_PROGRAM_ID: Pubkey = Pubkey::new_from_array(light_token_types::PROGRAM_ID); diff --git a/sdk-libs/ctoken-sdk/src/ctoken/create_associated_token_account.rs b/sdk-libs/ctoken-sdk/src/ctoken/create_associated_token_account.rs index f8b88f9b63..f5e5dfb034 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/create_associated_token_account.rs +++ b/sdk-libs/ctoken-sdk/src/ctoken/create_associated_token_account.rs @@ -1,5 +1,5 @@ use borsh::BorshSerialize; -use light_ctoken_types::{ +use light_token_types::{ instructions::{ create_associated_token_account::CreateAssociatedTokenAccountInstructionData, create_associated_token_account2::CreateAssociatedTokenAccount2InstructionData, @@ -221,7 +221,7 @@ fn create_ata_instruction_unified (Pubkey, u8) { Pubkey::find_program_address( &[ owner.as_ref(), - light_ctoken_types::COMPRESSED_TOKEN_PROGRAM_ID.as_ref(), + light_token_types::COMPRESSED_TOKEN_PROGRAM_ID.as_ref(), mint.as_ref(), ], - &Pubkey::from(light_ctoken_types::COMPRESSED_TOKEN_PROGRAM_ID), + &Pubkey::from(light_token_types::COMPRESSED_TOKEN_PROGRAM_ID), ) } @@ -397,7 +397,7 @@ fn create_ata2_instruction_unified { pub account_info: AccountInfo<'info>, pub signer_seeds: Vec>, } -use light_ctoken_types::{ +use light_token_types::{ ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, CPI_AUTHORITY_PDA, LIGHT_SYSTEM_PROGRAM_ID, NOOP_PROGRAM_ID, PROGRAM_ID as LIGHT_COMPRESSED_TOKEN_PROGRAM_ID, }; diff --git a/sdk-libs/ctoken-sdk/tests/account_metas_test.rs b/sdk-libs/ctoken-sdk/tests/account_metas_test.rs index 230ebdc948..a52970a051 100644 --- a/sdk-libs/ctoken-sdk/tests/account_metas_test.rs +++ b/sdk-libs/ctoken-sdk/tests/account_metas_test.rs @@ -9,7 +9,7 @@ use light_ctoken_sdk::{ }, utils::CTokenDefaultAccounts, }; -use light_ctoken_types::constants::{ +use light_token_types::constants::{ ACCOUNT_COMPRESSION_PROGRAM_ID, CPI_AUTHORITY_PDA, LIGHT_SYSTEM_PROGRAM_ID, NOOP_PROGRAM_ID, PROGRAM_ID as CTOKEN_PROGRAM_ID, }; diff --git a/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs b/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs index c645dfa68d..611c584d99 100644 --- a/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs +++ b/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs @@ -5,7 +5,7 @@ use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_ctoken_sdk::compressed_token::mint_action::{ cpi_accounts::MintActionCpiAccountsConfig, MintActionCpiAccounts, }; -use light_ctoken_types::CPI_AUTHORITY_PDA; +use light_token_types::CPI_AUTHORITY_PDA; use light_sdk_types::{ ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, LIGHT_SYSTEM_PROGRAM_ID, REGISTERED_PROGRAM_PDA, diff --git a/sdk-libs/token-client/Cargo.toml b/sdk-libs/token-client/Cargo.toml index 373c9302b6..8c5d9ba026 100644 --- a/sdk-libs/token-client/Cargo.toml +++ b/sdk-libs/token-client/Cargo.toml @@ -7,7 +7,7 @@ edition = { workspace = true } [dependencies] # Light Protocol dependencies -light-ctoken-types = { workspace = true } +light-token-types = { workspace = true } light-compressed-account = { workspace = true, features = ["std"] } light-compressible = { workspace = true, features = ["anchor"] } light-token-interface = { workspace = true } diff --git a/sdk-libs/token-client/src/actions/update_compressed_mint.rs b/sdk-libs/token-client/src/actions/update_compressed_mint.rs index 42a3ae5b6b..a6ee9b5d1d 100644 --- a/sdk-libs/token-client/src/actions/update_compressed_mint.rs +++ b/sdk-libs/token-client/src/actions/update_compressed_mint.rs @@ -2,7 +2,7 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_types::CompressedMintAuthorityType; +use light_token_types::CompressedMintAuthorityType; use solana_keypair::Keypair; use solana_pubkey::Pubkey; use solana_signature::Signature; diff --git a/sdk-libs/token-client/src/instructions/update_compressed_mint.rs b/sdk-libs/token-client/src/instructions/update_compressed_mint.rs index 9665bf0693..54be8dec02 100644 --- a/sdk-libs/token-client/src/instructions/update_compressed_mint.rs +++ b/sdk-libs/token-client/src/instructions/update_compressed_mint.rs @@ -10,7 +10,7 @@ use light_token_interface::{ use light_ctoken_sdk::compressed_token::update_compressed_mint::{ update_compressed_mint, UpdateCompressedMintInputs, }; -use light_ctoken_types::CompressedMintAuthorityType; +use light_token_types::CompressedMintAuthorityType; use solana_instruction::Instruction; use solana_keypair::Keypair; use solana_pubkey::Pubkey; diff --git a/sdk-libs/ctoken-types/Cargo.toml b/sdk-libs/token-types/Cargo.toml similarity index 95% rename from sdk-libs/ctoken-types/Cargo.toml rename to sdk-libs/token-types/Cargo.toml index 0c74ec85d8..e29b9fcccb 100644 --- a/sdk-libs/ctoken-types/Cargo.toml +++ b/sdk-libs/token-types/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "light-ctoken-types" +name = "light-token-types" version = "0.2.1" edition = "2021" description = "ctoken and compressed token types for Light Protocol" diff --git a/sdk-libs/ctoken-types/src/account_infos/batch_compress.rs b/sdk-libs/token-types/src/account_infos/batch_compress.rs similarity index 100% rename from sdk-libs/ctoken-types/src/account_infos/batch_compress.rs rename to sdk-libs/token-types/src/account_infos/batch_compress.rs diff --git a/sdk-libs/ctoken-types/src/account_infos/burn.rs b/sdk-libs/token-types/src/account_infos/burn.rs similarity index 100% rename from sdk-libs/ctoken-types/src/account_infos/burn.rs rename to sdk-libs/token-types/src/account_infos/burn.rs diff --git a/sdk-libs/ctoken-types/src/account_infos/config.rs b/sdk-libs/token-types/src/account_infos/config.rs similarity index 100% rename from sdk-libs/ctoken-types/src/account_infos/config.rs rename to sdk-libs/token-types/src/account_infos/config.rs diff --git a/sdk-libs/ctoken-types/src/account_infos/create_compressed_mint.rs b/sdk-libs/token-types/src/account_infos/create_compressed_mint.rs similarity index 100% rename from sdk-libs/ctoken-types/src/account_infos/create_compressed_mint.rs rename to sdk-libs/token-types/src/account_infos/create_compressed_mint.rs diff --git a/sdk-libs/ctoken-types/src/account_infos/freeze.rs b/sdk-libs/token-types/src/account_infos/freeze.rs similarity index 100% rename from sdk-libs/ctoken-types/src/account_infos/freeze.rs rename to sdk-libs/token-types/src/account_infos/freeze.rs diff --git a/sdk-libs/ctoken-types/src/account_infos/mint_to.rs b/sdk-libs/token-types/src/account_infos/mint_to.rs similarity index 100% rename from sdk-libs/ctoken-types/src/account_infos/mint_to.rs rename to sdk-libs/token-types/src/account_infos/mint_to.rs diff --git a/sdk-libs/ctoken-types/src/account_infos/mint_to_compressed.rs b/sdk-libs/token-types/src/account_infos/mint_to_compressed.rs similarity index 100% rename from sdk-libs/ctoken-types/src/account_infos/mint_to_compressed.rs rename to sdk-libs/token-types/src/account_infos/mint_to_compressed.rs diff --git a/sdk-libs/ctoken-types/src/account_infos/mod.rs b/sdk-libs/token-types/src/account_infos/mod.rs similarity index 100% rename from sdk-libs/ctoken-types/src/account_infos/mod.rs rename to sdk-libs/token-types/src/account_infos/mod.rs diff --git a/sdk-libs/ctoken-types/src/account_infos/transfer.rs b/sdk-libs/token-types/src/account_infos/transfer.rs similarity index 100% rename from sdk-libs/ctoken-types/src/account_infos/transfer.rs rename to sdk-libs/token-types/src/account_infos/transfer.rs diff --git a/sdk-libs/ctoken-types/src/constants.rs b/sdk-libs/token-types/src/constants.rs similarity index 100% rename from sdk-libs/ctoken-types/src/constants.rs rename to sdk-libs/token-types/src/constants.rs diff --git a/sdk-libs/ctoken-types/src/error.rs b/sdk-libs/token-types/src/error.rs similarity index 100% rename from sdk-libs/ctoken-types/src/error.rs rename to sdk-libs/token-types/src/error.rs diff --git a/sdk-libs/ctoken-types/src/instruction/batch_compress.rs b/sdk-libs/token-types/src/instruction/batch_compress.rs similarity index 100% rename from sdk-libs/ctoken-types/src/instruction/batch_compress.rs rename to sdk-libs/token-types/src/instruction/batch_compress.rs diff --git a/sdk-libs/ctoken-types/src/instruction/burn.rs b/sdk-libs/token-types/src/instruction/burn.rs similarity index 100% rename from sdk-libs/ctoken-types/src/instruction/burn.rs rename to sdk-libs/token-types/src/instruction/burn.rs diff --git a/sdk-libs/ctoken-types/src/instruction/delegation.rs b/sdk-libs/token-types/src/instruction/delegation.rs similarity index 100% rename from sdk-libs/ctoken-types/src/instruction/delegation.rs rename to sdk-libs/token-types/src/instruction/delegation.rs diff --git a/sdk-libs/ctoken-types/src/instruction/freeze.rs b/sdk-libs/token-types/src/instruction/freeze.rs similarity index 100% rename from sdk-libs/ctoken-types/src/instruction/freeze.rs rename to sdk-libs/token-types/src/instruction/freeze.rs diff --git a/sdk-libs/ctoken-types/src/instruction/generic.rs b/sdk-libs/token-types/src/instruction/generic.rs similarity index 100% rename from sdk-libs/ctoken-types/src/instruction/generic.rs rename to sdk-libs/token-types/src/instruction/generic.rs diff --git a/sdk-libs/ctoken-types/src/instruction/mint_to.rs b/sdk-libs/token-types/src/instruction/mint_to.rs similarity index 100% rename from sdk-libs/ctoken-types/src/instruction/mint_to.rs rename to sdk-libs/token-types/src/instruction/mint_to.rs diff --git a/sdk-libs/ctoken-types/src/instruction/mod.rs b/sdk-libs/token-types/src/instruction/mod.rs similarity index 100% rename from sdk-libs/ctoken-types/src/instruction/mod.rs rename to sdk-libs/token-types/src/instruction/mod.rs diff --git a/sdk-libs/ctoken-types/src/instruction/transfer.rs b/sdk-libs/token-types/src/instruction/transfer.rs similarity index 100% rename from sdk-libs/ctoken-types/src/instruction/transfer.rs rename to sdk-libs/token-types/src/instruction/transfer.rs diff --git a/sdk-libs/ctoken-types/src/instruction/update_compressed_mint.rs b/sdk-libs/token-types/src/instruction/update_compressed_mint.rs similarity index 100% rename from sdk-libs/ctoken-types/src/instruction/update_compressed_mint.rs rename to sdk-libs/token-types/src/instruction/update_compressed_mint.rs diff --git a/sdk-libs/ctoken-types/src/lib.rs b/sdk-libs/token-types/src/lib.rs similarity index 100% rename from sdk-libs/ctoken-types/src/lib.rs rename to sdk-libs/token-types/src/lib.rs diff --git a/sdk-tests/csdk-anchor-derived-test/Cargo.toml b/sdk-tests/csdk-anchor-derived-test/Cargo.toml index e6c0438462..2f32cfcbf2 100644 --- a/sdk-tests/csdk-anchor-derived-test/Cargo.toml +++ b/sdk-tests/csdk-anchor-derived-test/Cargo.toml @@ -31,7 +31,7 @@ anchor-lang = { workspace = true, features = ["idl-build"] } anchor-spl = { version = "=0.31.1", git = "https://github.com/lightprotocol/anchor", rev = "d8a2b3d9", features = ["memo", "metadata", "idl-build"] } light-token-interface = { workspace = true, features = ["anchor"] } light-ctoken-sdk = { workspace = true, features = ["anchor", "compressible"] } -light-ctoken-types = { workspace = true, features = ["anchor"] } +light-token-types = { workspace = true, features = ["anchor"] } light-compressible = { workspace = true, features = ["anchor"] } [dev-dependencies] diff --git a/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs b/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs index 4d96328f7a..b23eb516c4 100644 --- a/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs +++ b/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs @@ -9,6 +9,7 @@ use light_ctoken_sdk::compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }; use light_macros::pubkey; +use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{ program_test::{ initialize_compression_config, setup_mock_program_data, LightProgramTest, TestRpc, @@ -586,7 +587,7 @@ pub async fn create_user_record_and_game_session( config: *config_pda, rent_sponsor: RENT_SPONSOR, mint_authority, - compress_token_program_cpi_authority: light_ctoken_types::CPI_AUTHORITY_PDA.into(), + compress_token_program_cpi_authority: CPI_AUTHORITY_PDA.into(), }; let user_compressed_address = derive_address( diff --git a/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml b/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml index 2d588b9546..6d52a19730 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml +++ b/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml @@ -33,7 +33,7 @@ anchor-lang = { workspace = true, features = ["idl-build"] } anchor-spl = { version = "=0.31.1", git = "https://github.com/lightprotocol/anchor", rev = "d8a2b3d9", features = ["memo", "metadata", "idl-build"] } light-token-interface = { workspace = true, features = ["anchor"] } light-ctoken-sdk = { workspace = true, features = ["anchor", "compressible"] } -light-ctoken-types = { workspace = true, features = ["anchor"] } +light-token-types = { workspace = true, features = ["anchor"] } light-compressible = { workspace = true, features = ["anchor"] } [dev-dependencies] diff --git a/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs b/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs index e71d9a006e..84f2c85307 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs @@ -11,6 +11,7 @@ use light_ctoken_sdk::compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }; use light_macros::pubkey; +use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{ program_test::{setup_mock_program_data, LightProgramTest}, AddressWithTree, Indexer, ProgramTestConfig, Rpc, @@ -237,7 +238,7 @@ pub async fn create_user_record_and_game_session( mint_authority, some_account: some_account.pubkey(), ctoken_program: C_TOKEN_PROGRAM_ID.into(), - compress_token_program_cpi_authority: light_ctoken_types::CPI_AUTHORITY_PDA.into(), + compress_token_program_cpi_authority: CPI_AUTHORITY_PDA.into(), system_program: solana_sdk::system_program::ID, config: *config_pda, rent_sponsor: RENT_SPONSOR, diff --git a/sdk-tests/sdk-compressible-test/Cargo.toml b/sdk-tests/sdk-compressible-test/Cargo.toml index 4c0b1e179b..90c226e057 100644 --- a/sdk-tests/sdk-compressible-test/Cargo.toml +++ b/sdk-tests/sdk-compressible-test/Cargo.toml @@ -30,7 +30,7 @@ anchor-lang = { workspace = true, features = ["idl-build"] } anchor-spl = { version = "=0.31.1", git = "https://github.com/lightprotocol/anchor", rev = "d8a2b3d9", features = ["memo", "metadata", "idl-build"] } light-token-interface = { workspace = true, features = ["anchor"] } light-ctoken-sdk = { workspace = true, features = ["anchor", "compressible"] } -light-ctoken-types = { workspace = true, features = ["anchor"] } +light-token-types = { workspace = true, features = ["anchor"] } light-compressible = { workspace = true, features = ["anchor"] } [dev-dependencies] diff --git a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs index 9d153da457..00ef05c74c 100644 --- a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs +++ b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs @@ -15,7 +15,7 @@ use light_ctoken_sdk::{ ctoken, pack::compat::CTokenDataWithVariant, }; -use light_ctoken_types::CPI_AUTHORITY_PDA; +use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{ program_test::{ initialize_compression_config, setup_mock_program_data, LightProgramTest, TestRpc, diff --git a/sdk-tests/sdk-ctoken-test/Cargo.toml b/sdk-tests/sdk-ctoken-test/Cargo.toml index 9a03831843..c95c416f33 100644 --- a/sdk-tests/sdk-ctoken-test/Cargo.toml +++ b/sdk-tests/sdk-ctoken-test/Cargo.toml @@ -18,7 +18,7 @@ default = [] [dependencies] # Light Protocol SDK dependencies (workspace-based) light-ctoken-sdk = { workspace = true } -light-ctoken-types = { workspace = true } +light-token-types = { workspace = true } light-token-interface = { workspace = true } light-sdk = { workspace = true, features = ["v2"] } light-sdk-types = { workspace = true } diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs b/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs index d79769cbfc..5343835a8d 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs @@ -8,7 +8,7 @@ use light_ctoken_sdk::{ ctoken::{derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount}, spl_interface::find_spl_interface_pda_with_index, }; -use light_ctoken_types::CPI_AUTHORITY_PDA; +use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::spl::{ create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs b/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs index 15a5e803c5..b981506832 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs @@ -8,7 +8,7 @@ use light_ctoken_sdk::{ ctoken::{derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount}, spl_interface::find_spl_interface_pda_with_index, }; -use light_ctoken_types::CPI_AUTHORITY_PDA; +use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::spl::{ create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, diff --git a/sdk-tests/sdk-token-test/Cargo.toml b/sdk-tests/sdk-token-test/Cargo.toml index 1608862a58..4b4aaa63dc 100644 --- a/sdk-tests/sdk-token-test/Cargo.toml +++ b/sdk-tests/sdk-token-test/Cargo.toml @@ -32,7 +32,7 @@ profile-heap = [ [dependencies] light-ctoken-sdk = { workspace = true, features = ["anchor", "cpi-context", "v1"] } -light-ctoken-types = { workspace = true } +light-token-types = { workspace = true } anchor-lang = { workspace = true } light-hasher = { workspace = true } light-sdk = { workspace = true, features = ["v2", "cpi-context"] } diff --git a/sdk-tests/sdk-token-test/src/process_batch_compress_tokens.rs b/sdk-tests/sdk-token-test/src/process_batch_compress_tokens.rs index 1a9eb22f78..88ec1671b8 100644 --- a/sdk-tests/sdk-token-test/src/process_batch_compress_tokens.rs +++ b/sdk-tests/sdk-token-test/src/process_batch_compress_tokens.rs @@ -2,7 +2,7 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; use light_ctoken_sdk::compressed_token::batch_compress::{ create_batch_compress_instruction, BatchCompressInputs, Recipient, }; -use light_ctoken_types::account_infos::BatchCompressAccountInfos; +use light_token_types::account_infos::BatchCompressAccountInfos; use crate::Generic; diff --git a/sdk-tests/sdk-token-test/tests/ctoken_pda.rs b/sdk-tests/sdk-token-test/tests/ctoken_pda.rs index c45be83bdc..f208b35c0f 100644 --- a/sdk-tests/sdk-token-test/tests/ctoken_pda.rs +++ b/sdk-tests/sdk-token-test/tests/ctoken_pda.rs @@ -12,7 +12,7 @@ use light_token_interface::{ use light_ctoken_sdk::compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }; -use light_ctoken_types::CPI_AUTHORITY_PDA; +use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{LightProgramTest, ProgramTestConfig, Rpc, RpcError}; use light_sdk::instruction::{PackedAccounts, SystemAccountMetaConfig}; use sdk_token_test::{ChainedCtokenInstructionData, PdaCreationData, ID}; diff --git a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs index 0ddfa68fd0..dae2863c8f 100644 --- a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs +++ b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs @@ -18,7 +18,7 @@ use light_ctoken_sdk::{ }, ctoken::{derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount}, }; -use light_ctoken_types::CPI_AUTHORITY_PDA; +use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{LightProgramTest, ProgramTestConfig, Rpc, RpcError}; use light_sdk::instruction::{PackedAccounts, SystemAccountMetaConfig}; use sdk_token_test::{ChainedCtokenInstructionData, PdaCreationData, ID}; diff --git a/sdk-tests/sdk-token-test/tests/test.rs b/sdk-tests/sdk-token-test/tests/test.rs index 2eb917d7d3..a4f6bd5cac 100644 --- a/sdk-tests/sdk-token-test/tests/test.rs +++ b/sdk-tests/sdk-token-test/tests/test.rs @@ -14,7 +14,7 @@ use light_ctoken_sdk::{ }, spl_interface::{find_spl_interface_pda_with_index, get_spl_interface_pda}, }; -use light_ctoken_types::{TokenAccountMeta, SPL_TOKEN_PROGRAM_ID}; +use light_token_types::{TokenAccountMeta, SPL_TOKEN_PROGRAM_ID}; use light_program_test::{Indexer, LightProgramTest, ProgramTestConfig, Rpc}; use light_sdk::instruction::PackedAccounts; use light_test_utils::{ diff --git a/sdk-tests/sdk-token-test/tests/test_4_invocations.rs b/sdk-tests/sdk-token-test/tests/test_4_invocations.rs index 5c0e3fab9a..237765410e 100644 --- a/sdk-tests/sdk-token-test/tests/test_4_invocations.rs +++ b/sdk-tests/sdk-token-test/tests/test_4_invocations.rs @@ -9,7 +9,7 @@ use light_ctoken_sdk::{ spl_interface::get_spl_interface_pda, utils::CTokenDefaultAccounts, }; -use light_ctoken_types::SPL_TOKEN_PROGRAM_ID; +use light_token_types::SPL_TOKEN_PROGRAM_ID; use light_program_test::{AddressWithTree, Indexer, LightProgramTest, ProgramTestConfig, Rpc}; use light_sdk::{ address::v1::derive_address, diff --git a/sdk-tests/sdk-token-test/tests/test_deposit.rs b/sdk-tests/sdk-token-test/tests/test_deposit.rs index b35cc25510..34bd4db502 100644 --- a/sdk-tests/sdk-token-test/tests/test_deposit.rs +++ b/sdk-tests/sdk-token-test/tests/test_deposit.rs @@ -7,7 +7,7 @@ use light_ctoken_sdk::{ spl_interface::find_spl_interface_pda_with_index, utils::CTokenDefaultAccounts, }; -use light_ctoken_types::{TokenAccountMeta, SPL_TOKEN_PROGRAM_ID}; +use light_token_types::{TokenAccountMeta, SPL_TOKEN_PROGRAM_ID}; use light_program_test::{AddressWithTree, Indexer, LightProgramTest, ProgramTestConfig, Rpc}; use light_sdk::{ address::v1::derive_address, From b126843729e72ede748e401347ea4cc220ed8c38 Mon Sep 17 00:00:00 2001 From: ananas Date: Mon, 12 Jan 2026 23:58:47 +0000 Subject: [PATCH 4/9] ctoken-sdk -> token-sdk --- .github/workflows/sdk-tests.yml | 8 +- Cargo.lock | 92 +++++++-------- Cargo.toml | 6 +- forester/Cargo.toml | 2 +- forester/src/compressible/compressor.rs | 4 +- forester/src/compressible/state.rs | 6 +- forester/tests/e2e_test.rs | 4 +- .../batched_state_async_indexer_test.rs | 2 +- forester/tests/test_compressible_ctoken.rs | 4 +- .../src/instructions/mint_action/builder.rs | 2 +- .../mint_action/instruction_data.rs | 6 +- program-libs/token-interface/src/state/mod.rs | 4 +- .../token-interface/src/state/token/borsh.rs | 2 +- .../token-interface/src/state/token/mod.rs | 4 +- .../src/state/token/zero_copy.rs | 2 +- .../tests/cross_deserialization.rs | 4 +- program-libs/token-interface/tests/mod.rs | 2 +- .../token-interface/tests/token/spl_compat.rs | 4 +- .../token-interface/tests/token/top_up.rs | 4 +- .../tests/token/zero_copy_new.rs | 5 +- .../token-interface/tests/token_data.rs | 2 +- .../compressed-token-test/Cargo.toml | 2 +- .../tests/compress_only/all.rs | 22 ++-- .../tests/compress_only/ata_decompress.rs | 46 ++++---- .../compress_only/decompress_restrictions.rs | 22 ++-- .../tests/compress_only/default_state.rs | 10 +- .../compress_only/invalid_destination.rs | 30 ++--- .../compress_only/invalid_extension_state.rs | 30 ++--- .../tests/compress_only/mod.rs | 18 +-- .../compress_only/restricted_required.rs | 6 +- .../tests/compress_only/withheld_fee.rs | 28 ++--- .../tests/ctoken/approve_revoke.rs | 10 +- .../tests/ctoken/burn.rs | 38 +++---- .../tests/ctoken/compress_and_close.rs | 6 +- .../tests/ctoken/create.rs | 14 +-- .../tests/ctoken/create_ata.rs | 56 +++++----- .../tests/ctoken/create_ata2.rs | 19 ++-- .../tests/ctoken/extensions.rs | 42 +++---- .../tests/ctoken/extensions_failing.rs | 34 +++--- .../tests/ctoken/freeze_thaw.rs | 16 +-- .../tests/ctoken/functional.rs | 8 +- .../tests/ctoken/functional_ata.rs | 10 +- .../tests/ctoken/shared.rs | 44 ++++---- .../tests/ctoken/spl_instruction_compat.rs | 2 +- .../tests/ctoken/transfer.rs | 14 +-- .../tests/ctoken/transfer_checked.rs | 26 ++--- .../tests/freeze/compress_only.rs | 24 ++-- .../tests/freeze/functional.rs | 4 +- .../compressed-token-test/tests/mint/burn.rs | 18 +-- .../tests/mint/cpi_context.rs | 6 +- .../tests/mint/ctoken_mint_to.rs | 24 ++-- .../tests/mint/edge_cases.rs | 26 ++--- .../tests/mint/failing.rs | 29 +++-- .../tests/mint/functional.rs | 63 +++++------ .../tests/mint/random.rs | 18 +-- .../compressed-token-test/tests/token_pool.rs | 8 +- .../tests/transfer2/compress_failing.rs | 18 +-- .../tests/transfer2/compress_spl_failing.rs | 24 ++-- .../tests/transfer2/decompress_failing.rs | 16 +-- .../no_system_program_cpi_failing.rs | 20 ++-- .../tests/transfer2/shared.rs | 20 ++-- .../tests/transfer2/spl_ctoken.rs | 30 ++--- .../tests/transfer2/transfer_failing.rs | 18 +-- .../compressed-token-test/tests/v1.rs | 6 +- program-tests/registry-test/Cargo.toml | 2 +- .../registry-test/tests/compressible.rs | 85 +++++++------- program-tests/system-cpi-test/Cargo.toml | 2 +- program-tests/system-cpi-test/tests/test.rs | 2 +- program-tests/utils/Cargo.toml | 2 +- program-tests/utils/src/assert_claim.rs | 4 +- .../utils/src/assert_close_token_account.rs | 2 +- .../utils/src/assert_create_token_account.rs | 8 +- .../utils/src/assert_ctoken_approve_revoke.rs | 10 +- program-tests/utils/src/assert_ctoken_burn.rs | 2 +- .../utils/src/assert_ctoken_freeze_thaw.rs | 10 +- .../utils/src/assert_ctoken_mint_to.rs | 2 +- .../utils/src/assert_ctoken_transfer.rs | 2 +- program-tests/utils/src/assert_metadata.rs | 2 +- program-tests/utils/src/assert_mint_action.rs | 6 +- .../utils/src/assert_mint_to_compressed.rs | 6 +- program-tests/utils/src/assert_token_tx.rs | 2 +- program-tests/utils/src/assert_transfer2.rs | 28 ++--- program-tests/utils/src/conversions.rs | 18 +-- program-tests/utils/src/e2e_test_env.rs | 2 +- program-tests/utils/src/mint_2022.rs | 2 +- program-tests/utils/src/spl.rs | 4 +- .../anchor/src/process_transfer.rs | 4 +- .../compressed_token/mint_action/accounts.rs | 2 +- .../actions/compress_and_close_cmint.rs | 2 +- .../mint_action/actions/create_mint.rs | 2 +- .../mint_action/actions/decompress_mint.rs | 2 +- .../mint_action/actions/mint_to.rs | 4 +- .../mint_action/actions/mint_to_ctoken.rs | 4 +- .../mint_action/actions/process_actions.rs | 2 +- .../mint_action/actions/update_metadata.rs | 2 +- .../mint_action/mint_input.rs | 2 +- .../mint_action/mint_output.rs | 4 +- .../compressed_token/mint_action/processor.rs | 2 +- .../mint_action/queue_indices.rs | 2 +- .../mint_action/zero_copy_config.rs | 2 +- .../transfer2/check_extensions.rs | 2 +- .../compression/ctoken/compress_and_close.rs | 4 +- .../ctoken/compress_or_decompress_ctokens.rs | 2 +- .../compression/ctoken/decompress.rs | 2 +- .../transfer2/compression/ctoken/mod.rs | 2 +- .../transfer2/compression/mod.rs | 2 +- .../transfer2/compression/spl.rs | 4 +- .../src/compressed_token/transfer2/cpi.rs | 2 +- .../compressed_token/transfer2/processor.rs | 2 +- .../compressed_token/transfer2/sum_check.rs | 2 +- .../transfer2/token_inputs.rs | 2 +- .../transfer2/token_outputs.rs | 2 +- .../program/src/compressible/claim.rs | 4 +- .../program/src/ctoken/close/processor.rs | 2 +- .../program/src/ctoken/create.rs | 2 +- .../program/src/ctoken/create_ata.rs | 2 +- .../program/src/ctoken/transfer/shared.rs | 4 +- .../src/extensions/check_mint_extensions.rs | 4 +- .../program/src/extensions/mod.rs | 2 +- .../program/src/extensions/processor.rs | 2 +- .../program/src/extensions/token_metadata.rs | 2 +- programs/compressed-token/program/src/lib.rs | 2 +- .../program/src/shared/compressible_top_up.rs | 2 +- .../program/src/shared/cpi_bytes_size.rs | 2 +- .../src/shared/initialize_ctoken_account.rs | 6 +- .../program/src/shared/owner_validation.rs | 2 +- .../program/src/shared/token_output.rs | 4 +- .../program/tests/mint_action.rs | 2 +- .../program/tests/mint_validation.rs | 4 +- .../program/tests/token_input.rs | 2 +- .../program/tests/token_output.rs | 2 +- .../compressible/compressed_token/accounts.rs | 6 +- .../compressed_token/compress_and_close.rs | 2 +- sdk-libs/client/Cargo.toml | 2 +- sdk-libs/client/src/indexer/types.rs | 22 ++-- sdk-libs/compressible-client/src/lib.rs | 4 +- sdk-libs/macros/src/compressible/GUIDE.md | 4 +- .../src/compressible/decompress_context.rs | 32 +++--- .../macros/src/compressible/instructions.rs | 10 +- .../macros/src/compressible/variant_enum.rs | 6 +- sdk-libs/program-test/Cargo.toml | 2 +- sdk-libs/program-test/src/compressible.rs | 6 +- .../forester/compress_and_close_forester.rs | 2 +- .../program-test/src/indexer/extensions.rs | 2 +- .../program-test/src/indexer/test_indexer.rs | 2 +- .../program-test/src/logging/formatter.rs | 2 +- .../src/program_test/extensions.rs | 2 +- sdk-libs/sdk-types/src/constants.rs | 2 +- .../src/compressible/decompress_runtime.rs | 52 ++++----- sdk-libs/sdk/src/compressible/mod.rs | 2 +- sdk-libs/token-client/Cargo.toml | 2 +- .../create_compressible_token_account.rs | 4 +- .../token-client/src/actions/mint_action.rs | 6 +- .../token-client/src/actions/spl_interface.rs | 2 +- .../src/actions/transfer2/compress.rs | 2 +- .../src/actions/transfer2/ctoken_to_spl.rs | 6 +- .../src/actions/transfer2/spl_to_ctoken.rs | 6 +- .../src/instructions/create_mint.rs | 2 +- .../src/instructions/mint_action.rs | 4 +- .../src/instructions/mint_to_compressed.rs | 4 +- .../src/instructions/transfer2.rs | 22 ++-- .../instructions/update_compressed_mint.rs | 2 +- sdk-libs/token-client/src/lib.rs | 2 +- sdk-libs/{ctoken-sdk => token-sdk}/Cargo.toml | 2 +- .../compressed_token/ctoken_instruction.rs | 0 .../src/compressed_token/mod.rs | 0 .../src/compressed_token/v1/account.rs | 20 ++-- .../v1/approve/account_metas.rs | 0 .../v1/approve/instruction.rs | 8 +- .../src/compressed_token/v1/approve/mod.rs | 0 .../v1/batch_compress/account_metas.rs | 0 .../v1/batch_compress/instruction.rs | 4 +- .../compressed_token/v1/batch_compress/mod.rs | 0 .../src/compressed_token/v1/mod.rs | 0 .../v1/transfer/account_infos.rs | 4 +- .../v1/transfer/account_metas.rs | 0 .../v1/transfer/instruction.rs | 14 +-- .../src/compressed_token/v1/transfer/mod.rs | 0 .../src/compressed_token/v2/account2.rs | 52 ++++----- .../compressed_token/v2/compress_and_close.rs | 44 ++++---- .../create_compressed_mint/account_metas.rs | 0 .../v2/create_compressed_mint/instruction.rs | 8 +- .../v2/create_compressed_mint/mod.rs | 0 .../compressed_token/v2/decompress_full.rs | 16 +-- .../v2/mint_action/account_metas.rs | 2 +- .../v2/mint_action/cpi_accounts.rs | 10 +- .../v2/mint_action/instruction.rs | 4 +- .../compressed_token/v2/mint_action/mod.rs | 0 .../v2/mint_to_compressed/account_metas.rs | 0 .../v2/mint_to_compressed/instruction.rs | 13 +-- .../v2/mint_to_compressed/mod.rs | 0 .../src/compressed_token/v2/mod.rs | 0 .../compressed_token/v2/token_metadata_ui.rs | 0 .../v2/transfer2/account_metas.rs | 2 +- .../v2/transfer2/cpi_accounts.rs | 12 +- .../v2/transfer2/instruction.rs | 8 +- .../src/compressed_token/v2/transfer2/mod.rs | 0 .../update_compressed_mint/account_metas.rs | 0 .../v2/update_compressed_mint/instruction.rs | 8 +- .../v2/update_compressed_mint/mod.rs | 0 .../src/compressible/decompress_runtime.rs | 12 +- .../src/compressible/mod.rs | 0 .../src/constants.rs | 2 +- .../{ctoken-sdk => token-sdk}/src/error.rs | 103 ++++++++--------- sdk-libs/{ctoken-sdk => token-sdk}/src/lib.rs | 25 +++-- .../{ctoken-sdk => token-sdk}/src/pack.rs | 4 +- .../src/spl_interface.rs | 4 +- .../ctoken => token-sdk/src/token}/approve.rs | 30 ++--- .../src/token}/approve_checked.rs | 30 ++--- .../ctoken => token-sdk/src/token}/burn.rs | 30 ++--- .../src/token}/burn_checked.rs | 30 ++--- .../ctoken => token-sdk/src/token}/close.rs | 24 ++-- .../src/token}/compressible.rs | 6 +- .../ctoken => token-sdk/src/token}/create.rs | 24 ++-- .../token}/create_associated_token_account.rs | 14 +-- .../src/token}/create_ata.rs | 28 ++--- .../src/token}/create_cmint.rs | 10 +- .../src/token}/decompress.rs | 16 +-- .../src/token}/decompress_cmint.rs | 0 .../ctoken => token-sdk/src/token}/freeze.rs | 30 ++--- .../ctoken => token-sdk/src/token}/mint_to.rs | 74 ++++++------ .../src/ctoken => token-sdk/src/token}/mod.rs | 84 ++++++++------ .../ctoken => token-sdk/src/token}/revoke.rs | 30 ++--- .../ctoken => token-sdk/src/token}/thaw.rs | 30 ++--- .../src/token/token_mint_to.rs} | 32 +++--- .../src/token/token_mint_to_checked.rs} | 32 +++--- .../src/token}/transfer_interface.rs | 54 ++++----- .../src/token/transfer_spl_to_token.rs} | 26 ++--- .../src/token/transfer_token.rs} | 30 ++--- .../src/token/transfer_token_checked.rs} | 30 ++--- .../src/token/transfer_token_to_spl.rs} | 28 ++--- .../{ctoken-sdk => token-sdk}/src/utils.rs | 22 ++-- .../tests/account_metas_test.rs | 8 +- .../tests/create_associated_token_account.rs | 18 +-- .../tests/mint_action_cpi_accounts_tests.rs | 105 +++++++++++++++--- .../tests/pack_test.rs | 4 +- sdk-tests/client-test/Cargo.toml | 2 +- sdk-tests/client-test/tests/light_client.rs | 2 +- .../client-test/tests/light_program_test.rs | 2 +- sdk-tests/csdk-anchor-derived-test/Cargo.toml | 2 +- .../src/instruction_accounts.rs | 2 +- sdk-tests/csdk-anchor-derived-test/src/lib.rs | 12 +- .../csdk-anchor-derived-test/src/processor.rs | 36 +++--- .../csdk-anchor-derived-test/src/state.rs | 2 +- .../csdk-anchor-derived-test/src/variant.rs | 10 +- .../tests/basic_test.rs | 20 ++-- .../csdk-anchor-full-derived-test/Cargo.toml | 2 +- .../src/instruction_accounts.rs | 4 +- .../csdk-anchor-full-derived-test/src/lib.rs | 12 +- .../src/state.rs | 2 +- .../tests/basic_test.rs | 20 ++-- sdk-tests/sdk-compressible-test/Cargo.toml | 2 +- .../src/instruction_accounts.rs | 2 +- .../create_user_record_and_game_session.rs | 8 +- .../decompress_accounts_idempotent.rs | 14 +-- sdk-tests/sdk-compressible-test/src/state.rs | 8 +- .../tests/multi_account_tests.rs | 28 ++--- .../Cargo.lock | 0 .../Cargo.toml | 4 +- .../README.md | 0 .../Xargo.toml | 0 .../src/approve.rs | 6 +- .../src/burn.rs | 6 +- .../src/close.rs | 6 +- .../src/create_ata.rs | 6 +- .../src/create_cmint.rs | 2 +- .../src/create_token_account.rs | 6 +- .../src/ctoken_mint_to.rs | 6 +- .../src/decompress_cmint.rs | 2 +- .../src/freeze.rs | 6 +- .../src/lib.rs | 12 +- .../src/mint_to_ctoken.rs | 12 +- .../src/revoke.rs | 6 +- .../src/thaw.rs | 6 +- .../src/transfer.rs | 6 +- .../src/transfer_checked.rs | 6 +- .../src/transfer_interface.rs | 2 +- .../src/transfer_spl_ctoken.rs | 22 ++-- .../tests/scenario_cmint.rs | 4 +- .../tests/scenario_cmint_compression_only.rs | 4 +- .../tests/scenario_spl.rs | 28 ++--- .../tests/scenario_spl_restricted_ext.rs | 18 +-- .../tests/shared.rs | 72 ++++++------ .../tests/test_approve_revoke.rs | 12 +- .../tests/test_burn.rs | 8 +- .../tests/test_close.rs | 18 +-- .../tests/test_create_ata.rs | 18 +-- .../tests/test_create_cmint.rs | 14 +-- .../tests/test_create_token_account.rs | 16 +-- .../tests/test_ctoken_mint_to.rs | 32 +++--- .../tests/test_decompress_cmint.rs | 27 ++--- .../tests/test_freeze_thaw.rs | 12 +- .../tests/test_mint_to_ctoken.rs | 22 ++-- .../tests/test_transfer.rs | 6 +- .../tests/test_transfer_checked.rs | 30 ++--- .../tests/test_transfer_interface.rs | 26 ++--- .../tests/test_transfer_spl_ctoken.rs | 38 +++---- sdk-tests/sdk-token-test/Cargo.toml | 6 +- .../src/ctoken_pda/create_pda.rs | 2 +- .../sdk-token-test/src/ctoken_pda/mint.rs | 4 +- .../src/ctoken_pda/processor.rs | 2 +- sdk-tests/sdk-token-test/src/lib.rs | 12 +- .../src/mint_compressed_tokens_cpi_write.rs | 2 +- .../src/pda_ctoken/create_pda.rs | 2 +- .../sdk-token-test/src/pda_ctoken/mint.rs | 7 +- .../src/pda_ctoken/processor.rs | 2 +- .../src/process_batch_compress_tokens.rs | 2 +- .../src/process_compress_full_and_close.rs | 4 +- .../src/process_compress_tokens.rs | 2 +- .../src/process_create_compressed_account.rs | 10 +- ...s_create_ctoken_with_compress_to_pubkey.rs | 4 +- .../process_decompress_full_cpi_context.rs | 4 +- .../src/process_decompress_tokens.rs | 2 +- .../src/process_four_invokes.rs | 8 +- .../src/process_four_transfer2.rs | 16 +-- .../src/process_transfer_tokens.rs | 2 +- .../src/process_update_deposit.rs | 12 +- sdk-tests/sdk-token-test/tests/ctoken_pda.rs | 6 +- .../tests/decompress_full_cpi.rs | 20 ++-- sdk-tests/sdk-token-test/tests/pda_ctoken.rs | 10 +- sdk-tests/sdk-token-test/tests/test.rs | 14 +-- .../tests/test_4_invocations.rs | 20 ++-- .../sdk-token-test/tests/test_4_transfer2.rs | 16 +-- .../tests/test_compress_full_and_close.rs | 12 +- .../tests/test_compress_to_pubkey.rs | 4 +- .../sdk-token-test/tests/test_deposit.rs | 16 +-- xtask/Cargo.toml | 2 +- xtask/src/create_ctoken_account.rs | 4 +- 328 files changed, 1955 insertions(+), 1892 deletions(-) rename sdk-libs/{ctoken-sdk => token-sdk}/Cargo.toml (98%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/ctoken_instruction.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/account.rs (91%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/approve/account_metas.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/approve/instruction.rs (93%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/approve/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/batch_compress/account_metas.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/batch_compress/instruction.rs (96%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/batch_compress/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/transfer/account_infos.rs (96%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/transfer/account_metas.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/transfer/instruction.rs (95%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v1/transfer/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/account2.rs (89%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/compress_and_close.rs (93%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/create_compressed_mint/account_metas.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/create_compressed_mint/instruction.rs (96%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/create_compressed_mint/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/decompress_full.rs (97%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/mint_action/account_metas.rs (99%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/mint_action/cpi_accounts.rs (99%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/mint_action/instruction.rs (97%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/mint_action/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/mint_to_compressed/account_metas.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/mint_to_compressed/instruction.rs (91%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/mint_to_compressed/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/token_metadata_ui.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/transfer2/account_metas.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/transfer2/cpi_accounts.rs (97%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/transfer2/instruction.rs (97%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/transfer2/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/update_compressed_mint/account_metas.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/update_compressed_mint/instruction.rs (96%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressed_token/v2/update_compressed_mint/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressible/decompress_runtime.rs (97%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/compressible/mod.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/constants.rs (89%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/error.rs (55%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/lib.rs (67%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/pack.rs (100%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/spl_interface.rs (97%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/approve.rs (80%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/approve_checked.rs (83%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/burn.rs (82%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/burn_checked.rs (82%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/close.rs (85%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/compressible.rs (96%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/create.rs (89%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/create_associated_token_account.rs (97%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/create_ata.rs (88%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/create_cmint.rs (98%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/decompress.rs (95%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/decompress_cmint.rs (100%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/freeze.rs (77%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/mint_to.rs (88%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/mod.rs (68%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/revoke.rs (76%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/thaw.rs (78%) rename sdk-libs/{ctoken-sdk/src/ctoken/ctoken_mint_to.rs => token-sdk/src/token/token_mint_to.rs} (82%) rename sdk-libs/{ctoken-sdk/src/ctoken/ctoken_mint_to_checked.rs => token-sdk/src/token/token_mint_to_checked.rs} (79%) rename sdk-libs/{ctoken-sdk/src/ctoken => token-sdk/src/token}/transfer_interface.rs (81%) rename sdk-libs/{ctoken-sdk/src/ctoken/transfer_spl_ctoken.rs => token-sdk/src/token/transfer_spl_to_token.rs} (92%) rename sdk-libs/{ctoken-sdk/src/ctoken/transfer_ctoken.rs => token-sdk/src/token/transfer_token.rs} (83%) rename sdk-libs/{ctoken-sdk/src/ctoken/transfer_ctoken_checked.rs => token-sdk/src/token/transfer_token_checked.rs} (84%) rename sdk-libs/{ctoken-sdk/src/ctoken/transfer_ctoken_spl.rs => token-sdk/src/token/transfer_token_to_spl.rs} (92%) rename sdk-libs/{ctoken-sdk => token-sdk}/src/utils.rs (81%) rename sdk-libs/{ctoken-sdk => token-sdk}/tests/account_metas_test.rs (97%) rename sdk-libs/{ctoken-sdk => token-sdk}/tests/create_associated_token_account.rs (72%) rename sdk-libs/{ctoken-sdk => token-sdk}/tests/mint_action_cpi_accounts_tests.rs (93%) rename sdk-libs/{ctoken-sdk => token-sdk}/tests/pack_test.rs (99%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/Cargo.lock (100%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/Cargo.toml (95%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/README.md (100%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/Xargo.toml (100%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/approve.rs (95%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/burn.rs (95%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/close.rs (94%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/create_ata.rs (94%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/create_cmint.rs (99%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/create_token_account.rs (95%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/ctoken_mint_to.rs (96%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/decompress_cmint.rs (99%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/freeze.rs (94%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/lib.rs (98%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/mint_to_ctoken.rs (96%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/revoke.rs (94%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/thaw.rs (95%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/transfer.rs (95%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/transfer_checked.rs (94%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/transfer_interface.rs (98%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/src/transfer_spl_ctoken.rs (93%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/scenario_cmint.rs (99%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/scenario_cmint_compression_only.rs (99%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/scenario_spl.rs (95%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/scenario_spl_restricted_ext.rs (97%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/shared.rs (87%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_approve_revoke.rs (97%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_burn.rs (96%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_close.rs (91%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_create_ata.rs (91%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_create_cmint.rs (93%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_create_token_account.rs (90%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_ctoken_mint_to.rs (91%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_decompress_cmint.rs (96%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_freeze_thaw.rs (97%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_mint_to_ctoken.rs (95%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_transfer.rs (95%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_transfer_checked.rs (93%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_transfer_interface.rs (97%) rename sdk-tests/{sdk-ctoken-test => sdk-light-token-test}/tests/test_transfer_spl_ctoken.rs (95%) diff --git a/.github/workflows/sdk-tests.yml b/.github/workflows/sdk-tests.yml index fac4bd7428..27fbd5c385 100644 --- a/.github/workflows/sdk-tests.yml +++ b/.github/workflows/sdk-tests.yml @@ -48,13 +48,13 @@ jobs: matrix: include: - program: native - sub-tests: '["cargo-test-sbf -p sdk-native-test", "cargo-test-sbf -p sdk-v1-native-test", "cargo-test-sbf -p sdk-ctoken-test", "cargo-test-sbf -p client-test"]' + sub-tests: '["cargo-test-sbf -p sdk-native-test", "cargo-test-sbf -p sdk-v1-native-test", "cargo-test-sbf -p sdk-light-token-test", "cargo-test-sbf -p client-test"]' - program: anchor & pinocchio sub-tests: '["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk-compressible-test", "cargo-test-sbf -p csdk-anchor-derived-test", "cargo-test-sbf -p csdk-anchor-full-derived-test", "cargo-test-sbf -p sdk-pinocchio-v1-test", "cargo-test-sbf -p sdk-pinocchio-v2-test", "cargo-test-sbf -p pinocchio-nostd-test"]' - program: token test sub-tests: '["cargo-test-sbf -p sdk-token-test"]' - program: sdk-libs - packages: light-sdk-macros light-sdk light-program-test light-client light-ctoken-types light-ctoken-sdk + packages: light-sdk-macros light-sdk light-program-test light-client light-token-types light-token-sdk test_cmd: | cargo test -p light-sdk-macros cargo test -p light-sdk-macros --all-features @@ -63,8 +63,8 @@ jobs: cargo test -p light-program-test cargo test -p light-client cargo test -p light-sparse-merkle-tree - cargo test -p light-ctoken-types - cargo test -p light-ctoken-sdk --all-features + cargo test -p light-token-types + cargo test -p light-token-sdk --all-features steps: - name: Checkout sources uses: actions/checkout@v6 diff --git a/Cargo.lock b/Cargo.lock index 074c75308b..df88d28c3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1346,7 +1346,6 @@ dependencies = [ "light-client", "light-compressed-account", "light-compressed-token", - "light-ctoken-sdk", "light-hasher", "light-indexed-array", "light-macros", @@ -1357,6 +1356,7 @@ dependencies = [ "light-sdk-pinocchio", "light-sdk-types", "light-test-utils", + "light-token-sdk", "light-zero-copy", "num-bigint 0.4.6", "rand 0.8.5", @@ -1428,7 +1428,6 @@ dependencies = [ "light-compressed-account", "light-compressed-token", "light-compressible", - "light-ctoken-sdk", "light-program-test", "light-prover-client", "light-registry", @@ -1437,6 +1436,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-sdk", "light-verifier", "light-zero-copy", "rand 0.8.5", @@ -1645,7 +1645,6 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-compressible-client", - "light-ctoken-sdk", "light-hasher", "light-macros", "light-program-test", @@ -1655,6 +1654,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-sdk", "light-token-types", "solana-account", "solana-instruction", @@ -1680,7 +1680,6 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-compressible-client", - "light-ctoken-sdk", "light-hasher", "light-macros", "light-program-test", @@ -1690,6 +1689,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-sdk", "light-token-types", "solana-account", "solana-account-info", @@ -2373,7 +2373,6 @@ dependencies = [ "light-compressed-account", "light-compressed-token", "light-compressible", - "light-ctoken-sdk", "light-hash-set", "light-hasher", "light-merkle-tree-metadata", @@ -2385,6 +2384,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-sdk", "photon-api", "prometheus", "rand 0.8.5", @@ -3586,7 +3586,6 @@ dependencies = [ "lazy_static", "light-compressed-account", "light-concurrent-merkle-tree", - "light-ctoken-sdk", "light-event", "light-hasher", "light-indexed-merkle-tree", @@ -3594,6 +3593,7 @@ dependencies = [ "light-prover-client", "light-sdk", "light-token-interface", + "light-token-sdk", "litesvm", "num-bigint 0.4.6", "photon-api", @@ -3748,36 +3748,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "light-ctoken-sdk" -version = "0.2.1" -dependencies = [ - "anchor-lang", - "arrayvec", - "borsh 0.10.4", - "light-account-checks", - "light-compressed-account", - "light-compressed-token", - "light-compressible", - "light-macros", - "light-program-profiler", - "light-sdk", - "light-sdk-types", - "light-token-interface", - "light-token-types", - "light-zero-copy", - "pinocchio", - "solana-account-info", - "solana-cpi", - "solana-instruction", - "solana-msg 2.2.1", - "solana-program-error 2.2.2", - "solana-pubkey 2.4.0", - "spl-pod", - "spl-token-2022 7.0.0", - "thiserror 2.0.17", -] - [[package]] name = "light-event" version = "0.2.1" @@ -3961,7 +3931,6 @@ dependencies = [ "light-compressible", "light-compressible-client", "light-concurrent-merkle-tree", - "light-ctoken-sdk", "light-event", "light-hasher", "light-indexed-array", @@ -3973,6 +3942,7 @@ dependencies = [ "light-sdk", "light-sdk-types", "light-token-interface", + "light-token-sdk", "light-zero-copy", "litesvm", "log", @@ -4200,7 +4170,6 @@ dependencies = [ "light-compressed-token", "light-compressible", "light-concurrent-merkle-tree", - "light-ctoken-sdk", "light-event", "light-hasher", "light-indexed-array", @@ -4215,6 +4184,7 @@ dependencies = [ "light-system-program-anchor", "light-token-client", "light-token-interface", + "light-token-sdk", "light-zero-copy", "log", "num-bigint 0.4.6", @@ -4238,9 +4208,9 @@ dependencies = [ "light-client", "light-compressed-account", "light-compressible", - "light-ctoken-sdk", "light-sdk", "light-token-interface", + "light-token-sdk", "light-token-types", "light-zero-copy", "solana-instruction", @@ -4289,6 +4259,36 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "light-token-sdk" +version = "0.2.1" +dependencies = [ + "anchor-lang", + "arrayvec", + "borsh 0.10.4", + "light-account-checks", + "light-compressed-account", + "light-compressed-token", + "light-compressible", + "light-macros", + "light-program-profiler", + "light-sdk", + "light-sdk-types", + "light-token-interface", + "light-token-types", + "light-zero-copy", + "pinocchio", + "solana-account-info", + "solana-cpi", + "solana-instruction", + "solana-msg 2.2.1", + "solana-program-error 2.2.2", + "solana-pubkey 2.4.0", + "spl-pod", + "spl-token-2022 7.0.0", + "thiserror 2.0.17", +] + [[package]] name = "light-token-types" version = "0.2.1" @@ -5619,7 +5619,6 @@ dependencies = [ "light-client", "light-compressed-account", "light-compressible", - "light-ctoken-sdk", "light-hasher", "light-program-test", "light-prover-client", @@ -5627,6 +5626,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-sdk", "light-zero-copy", "serial_test", "solana-sdk", @@ -6050,7 +6050,6 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-compressible-client", - "light-ctoken-sdk", "light-hasher", "light-macros", "light-program-test", @@ -6059,6 +6058,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-sdk", "light-token-types", "solana-account", "solana-instruction", @@ -6074,7 +6074,7 @@ dependencies = [ ] [[package]] -name = "sdk-ctoken-test" +name = "sdk-light-token-test" version = "0.1.0" dependencies = [ "anchor-spl 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -6083,12 +6083,12 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-compressible-client", - "light-ctoken-sdk", "light-program-test", "light-sdk", "light-sdk-types", "light-test-utils", "light-token-interface", + "light-token-sdk", "light-token-types", "solana-program", "solana-sdk", @@ -6159,7 +6159,6 @@ dependencies = [ "light-client", "light-compressed-account", "light-compressible", - "light-ctoken-sdk", "light-hasher", "light-program-profiler", "light-program-test", @@ -6168,6 +6167,7 @@ dependencies = [ "light-test-utils", "light-token-client", "light-token-interface", + "light-token-sdk", "light-token-types", "light-zero-copy", "serial_test", @@ -10199,7 +10199,6 @@ dependencies = [ "light-client", "light-compressed-account", "light-compressed-token", - "light-ctoken-sdk", "light-hasher", "light-merkle-tree-metadata", "light-program-test", @@ -10209,6 +10208,7 @@ dependencies = [ "light-sdk-types", "light-system-program-anchor", "light-test-utils", + "light-token-sdk", "light-verifier", "rand 0.8.5", "serial_test", @@ -11804,7 +11804,6 @@ dependencies = [ "light-compressed-account", "light-compressible", "light-concurrent-merkle-tree", - "light-ctoken-sdk", "light-hash-set", "light-hasher", "light-indexed-merkle-tree", @@ -11812,6 +11811,7 @@ dependencies = [ "light-program-test", "light-registry", "light-test-utils", + "light-token-sdk", "num-bigint 0.4.6", "quote", "rand 0.8.5", diff --git a/Cargo.toml b/Cargo.toml index d607ad81db..2d261f98a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ members = [ "programs/registry", "anchor-programs/system", "sdk-libs/client", - "sdk-libs/ctoken-sdk", + "sdk-libs/token-sdk", "sdk-libs/event", "sdk-libs/token-client", "sdk-libs/macros", @@ -56,7 +56,7 @@ members = [ "sdk-tests/sdk-v1-native-test", "sdk-tests/sdk-token-test", "sdk-tests/sdk-compressible-test", - "sdk-tests/sdk-ctoken-test", + "sdk-tests/sdk-light-token-test", "sdk-tests/csdk-anchor-derived-test", "sdk-tests/csdk-anchor-full-derived-test", "forester-utils", @@ -205,7 +205,7 @@ light-compressed-token = { path = "programs/compressed-token/program", version = "cpi", ] } light-token-types = { path = "sdk-libs/token-types", version = "0.2.1" } -light-ctoken-sdk = { path = "sdk-libs/ctoken-sdk", version = "0.2.1" } +light-token-sdk = { path = "sdk-libs/token-sdk", version = "0.2.1" } light-token-client = { path = "sdk-libs/token-client", version = "0.1.0" } light-system-program-anchor = { path = "anchor-programs/system", version = "2.0.0", features = [ "cpi", diff --git a/forester/Cargo.toml b/forester/Cargo.toml index 24a8dc5f53..5d829727e4 100644 --- a/forester/Cargo.toml +++ b/forester/Cargo.toml @@ -28,7 +28,7 @@ light-sdk = { workspace = true, features = ["anchor"] } light-program-test = { workspace = true } light-compressible = { workspace = true } light-token-interface = { workspace = true } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } solana-rpc-client-api = { workspace = true } solana-transaction-status = { workspace = true } bb8 = { workspace = true } diff --git a/forester/src/compressible/compressor.rs b/forester/src/compressible/compressor.rs index 4689594476..1607d13b7d 100644 --- a/forester/src/compressible/compressor.rs +++ b/forester/src/compressible/compressor.rs @@ -5,13 +5,13 @@ use forester_utils::rpc_pool::SolanaRpcPool; use light_client::{indexer::TreeInfo, rpc::Rpc}; use light_compressed_account::TreeType; use light_compressible::config::CompressibleConfig; -use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; -use light_ctoken_sdk::compressed_token::compress_and_close::CompressAndCloseAccounts as CTokenAccounts; use light_registry::{ accounts::CompressAndCloseContext, compressible::compressed_token::CompressAndCloseIndices, instruction::CompressAndClose, }; use light_sdk::instruction::PackedAccounts; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; +use light_token_sdk::compressed_token::compress_and_close::CompressAndCloseAccounts as CTokenAccounts; use solana_pubkey::pubkey; use solana_sdk::{ instruction::Instruction, diff --git a/forester/src/compressible/state.rs b/forester/src/compressible/state.rs index 5dc4ec4f42..4ef3e6d446 100644 --- a/forester/src/compressible/state.rs +++ b/forester/src/compressible/state.rs @@ -11,11 +11,7 @@ use crate::Result; /// Calculate the slot at which an account becomes compressible /// Returns the last funded slot; accounts are compressible when current_slot > this value -fn calculate_compressible_slot( - account: &Token, - lamports: u64, - account_size: usize, -) -> Result { +fn calculate_compressible_slot(account: &Token, lamports: u64, account_size: usize) -> Result { use light_compressible::rent::SLOTS_PER_EPOCH; use light_token_interface::state::extensions::ExtensionStruct; diff --git a/forester/tests/e2e_test.rs b/forester/tests/e2e_test.rs index 4617cf1066..31c950c022 100644 --- a/forester/tests/e2e_test.rs +++ b/forester/tests/e2e_test.rs @@ -35,8 +35,6 @@ use light_compressed_token::process_transfer::{ transfer_sdk::{create_transfer_instruction, to_account_metas}, TokenTransferOutputData, }; -use light_token_interface::state::TokenDataVersion; -use light_ctoken_sdk::compat::TokenDataWithMerkleContext; use light_hasher::Poseidon; use light_program_test::accounts::test_accounts::TestAccounts; use light_prover_client::prover::spawn_prover; @@ -48,6 +46,8 @@ use light_test_utils::{ use light_token_client::actions::{ create_compressible_token_account, CreateCompressibleTokenAccountInputs, }; +use light_token_interface::state::TokenDataVersion; +use light_token_sdk::compat::TokenDataWithMerkleContext; use rand::{prelude::SliceRandom, rngs::StdRng, Rng, SeedableRng}; use serial_test::serial; use solana_program::{native_token::LAMPORTS_PER_SOL, pubkey::Pubkey}; diff --git a/forester/tests/legacy/batched_state_async_indexer_test.rs b/forester/tests/legacy/batched_state_async_indexer_test.rs index a4dacfd6c7..d7af38989c 100644 --- a/forester/tests/legacy/batched_state_async_indexer_test.rs +++ b/forester/tests/legacy/batched_state_async_indexer_test.rs @@ -23,7 +23,7 @@ use light_compressed_account::{ use light_compressed_token::process_transfer::{ transfer_sdk::create_transfer_instruction, TokenTransferOutputData, }; -use light_ctoken_sdk::compat::TokenDataWithMerkleContext; +use light_token_sdk::compat::TokenDataWithMerkleContext; use light_program_test::accounts::test_accounts::TestAccounts; use light_prover_client::prover::spawn_prover; use light_registry::{ diff --git a/forester/tests/test_compressible_ctoken.rs b/forester/tests/test_compressible_ctoken.rs index 0c305c23ac..8fe4013dff 100644 --- a/forester/tests/test_compressible_ctoken.rs +++ b/forester/tests/test_compressible_ctoken.rs @@ -11,8 +11,6 @@ use light_client::{ local_test_validator::{spawn_validator, LightValidatorConfig}, rpc::{LightClient, LightClientConfig, Rpc}, }; -use light_token_interface::state::TokenDataVersion; -use light_ctoken_sdk::compressed_token::create_compressed_mint; use light_registry::{ protocol_config::state::ProtocolConfigPda, sdk::{ @@ -25,6 +23,8 @@ use light_registry::{ use light_token_client::actions::{ create_compressible_token_account, CreateCompressibleTokenAccountInputs, }; +use light_token_interface::state::TokenDataVersion; +use light_token_sdk::compressed_token::create_compressed_mint; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer, transaction::Transaction}; use tokio::{sync::oneshot, time::sleep}; diff --git a/program-libs/token-interface/src/instructions/mint_action/builder.rs b/program-libs/token-interface/src/instructions/mint_action/builder.rs index 9f08e67c19..a63f14fde4 100644 --- a/program-libs/token-interface/src/instructions/mint_action/builder.rs +++ b/program-libs/token-interface/src/instructions/mint_action/builder.rs @@ -6,7 +6,7 @@ use light_compressed_account::instruction_data::{ use crate::instructions::mint_action::{ Action, CompressAndCloseCMintAction, CompressedMintInstructionData, CompressedMintWithContext, CpiContext, CreateMint, DecompressMintAction, MintActionCompressedInstructionData, - MintToTokenAction, MintToCompressedAction, RemoveMetadataKeyAction, UpdateAuthority, + MintToCompressedAction, MintToTokenAction, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }; diff --git a/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs b/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs index ae16d3fe22..11105b9be5 100644 --- a/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs +++ b/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs @@ -3,9 +3,9 @@ use light_compressible::compression_info::CompressionInfo; use light_zero_copy::ZeroCopy; use super::{ - CompressAndCloseCMintAction, CpiContext, DecompressMintAction, MintToTokenAction, - MintToCompressedAction, RemoveMetadataKeyAction, UpdateAuthority, - UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, + CompressAndCloseCMintAction, CpiContext, DecompressMintAction, MintToCompressedAction, + MintToTokenAction, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, + UpdateMetadataFieldAction, }; use crate::{ instructions::extensions::{ExtensionInstructionData, ZExtensionInstructionData}, diff --git a/program-libs/token-interface/src/state/mod.rs b/program-libs/token-interface/src/state/mod.rs index fe5b05cca4..1653f38d8c 100644 --- a/program-libs/token-interface/src/state/mod.rs +++ b/program-libs/token-interface/src/state/mod.rs @@ -1,9 +1,9 @@ mod compressed_token; -pub mod token; pub mod extensions; pub mod mint; +pub mod token; pub use compressed_token::*; -pub use token::*; pub use extensions::*; pub use mint::*; +pub use token::*; diff --git a/program-libs/token-interface/src/state/token/borsh.rs b/program-libs/token-interface/src/state/token/borsh.rs index b62375e5d4..1fc692adea 100644 --- a/program-libs/token-interface/src/state/token/borsh.rs +++ b/program-libs/token-interface/src/state/token/borsh.rs @@ -1,7 +1,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_compressed_account::Pubkey; -use crate::state::{AccountState, Token, ExtensionStruct, ACCOUNT_TYPE_TOKEN_ACCOUNT}; +use crate::state::{AccountState, ExtensionStruct, Token, ACCOUNT_TYPE_TOKEN_ACCOUNT}; // Manual implementation of BorshSerialize for SPL compatibility impl BorshSerialize for Token { diff --git a/program-libs/token-interface/src/state/token/mod.rs b/program-libs/token-interface/src/state/token/mod.rs index 8b6582b758..b2f1c5cf02 100644 --- a/program-libs/token-interface/src/state/token/mod.rs +++ b/program-libs/token-interface/src/state/token/mod.rs @@ -1,10 +1,10 @@ mod borsh; -mod token_struct; mod size; +mod token_struct; mod top_up; mod zero_copy; -pub use token_struct::*; pub use size::*; +pub use token_struct::*; pub use top_up::*; pub use zero_copy::*; diff --git a/program-libs/token-interface/src/state/token/zero_copy.rs b/program-libs/token-interface/src/state/token/zero_copy.rs index b6ebd2ac36..c52cb1cd98 100644 --- a/program-libs/token-interface/src/state/token/zero_copy.rs +++ b/program-libs/token-interface/src/state/token/zero_copy.rs @@ -10,7 +10,7 @@ use light_zero_copy::{ use crate::{ state::{ - Token, ExtensionStruct, ExtensionStructConfig, ZExtensionStruct, ZExtensionStructMut, + ExtensionStruct, ExtensionStructConfig, Token, ZExtensionStruct, ZExtensionStructMut, ACCOUNT_TYPE_TOKEN_ACCOUNT, }, AnchorDeserialize, AnchorSerialize, diff --git a/program-libs/token-interface/tests/cross_deserialization.rs b/program-libs/token-interface/tests/cross_deserialization.rs index 5889ef80e5..911d9f7d89 100644 --- a/program-libs/token-interface/tests/cross_deserialization.rs +++ b/program-libs/token-interface/tests/cross_deserialization.rs @@ -10,8 +10,8 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_compressed_account::Pubkey; use light_compressible::{compression_info::CompressionInfo, rent::RentConfig}; use light_token_interface::state::{ - AccountState, BaseMint, Token, CompressedMint, CompressedMintMetadata, CompressibleExtension, - ExtensionStruct, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, + AccountState, BaseMint, CompressedMint, CompressedMintMetadata, CompressibleExtension, + ExtensionStruct, Token, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; const ACCOUNT_TYPE_OFFSET: usize = 165; diff --git a/program-libs/token-interface/tests/mod.rs b/program-libs/token-interface/tests/mod.rs index 9c659266ae..9f964602e7 100644 --- a/program-libs/token-interface/tests/mod.rs +++ b/program-libs/token-interface/tests/mod.rs @@ -1,2 +1,2 @@ -pub mod token; pub mod mint_compat; +pub mod token; diff --git a/program-libs/token-interface/tests/token/spl_compat.rs b/program-libs/token-interface/tests/token/spl_compat.rs index cb66d67f9d..db832b2b23 100644 --- a/program-libs/token-interface/tests/token/spl_compat.rs +++ b/program-libs/token-interface/tests/token/spl_compat.rs @@ -7,8 +7,8 @@ use light_compressed_account::Pubkey; use light_token_interface::state::{ - token::{Token, TokenConfig, ZToken, ZTokenMut, BASE_TOKEN_ACCOUNT_SIZE}, extensions::ExtensionStructConfig, + token::{Token, TokenConfig, ZToken, ZTokenMut, BASE_TOKEN_ACCOUNT_SIZE}, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyAtMut, ZeroCopyNew}; @@ -399,8 +399,8 @@ fn test_account_type_compatibility_with_spl_parsing() { #[test] fn test_pausable_extension_partial_eq() { use light_token_interface::state::{ - token::AccountState as CtokenAccountState, extensions::{ExtensionStruct, PausableAccountExtension}, + token::AccountState as CtokenAccountState, }; let config = TokenConfig { diff --git a/program-libs/token-interface/tests/token/top_up.rs b/program-libs/token-interface/tests/token/top_up.rs index 4c5feffbcd..548d6fb74e 100644 --- a/program-libs/token-interface/tests/token/top_up.rs +++ b/program-libs/token-interface/tests/token/top_up.rs @@ -2,8 +2,8 @@ use light_compressed_account::Pubkey; use light_token_interface::state::{ - top_up_lamports_from_slice, Token, TokenConfig, CompressibleExtensionConfig, - CompressionInfoConfig, ExtensionStructConfig, + top_up_lamports_from_slice, CompressibleExtensionConfig, CompressionInfoConfig, + ExtensionStructConfig, Token, TokenConfig, }; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyNew}; diff --git a/program-libs/token-interface/tests/token/zero_copy_new.rs b/program-libs/token-interface/tests/token/zero_copy_new.rs index dfb9c26cfd..cdc82db555 100644 --- a/program-libs/token-interface/tests/token/zero_copy_new.rs +++ b/program-libs/token-interface/tests/token/zero_copy_new.rs @@ -7,11 +7,10 @@ use light_compressed_account::Pubkey; use light_token_interface::state::{ + extensions::{ExtensionStruct, ExtensionStructConfig, PausableAccountExtension}, token::{ - AccountState, Token, TokenConfig, ACCOUNT_TYPE_TOKEN_ACCOUNT, - BASE_TOKEN_ACCOUNT_SIZE, + AccountState, Token, TokenConfig, ACCOUNT_TYPE_TOKEN_ACCOUNT, BASE_TOKEN_ACCOUNT_SIZE, }, - extensions::{ExtensionStruct, ExtensionStructConfig, PausableAccountExtension}, }; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyNew}; diff --git a/program-libs/token-interface/tests/token_data.rs b/program-libs/token-interface/tests/token_data.rs index 7e4ccf952a..e59f90809c 100644 --- a/program-libs/token-interface/tests/token_data.rs +++ b/program-libs/token-interface/tests/token_data.rs @@ -1,8 +1,8 @@ #![cfg(feature = "poseidon")] use light_compressed_account::{hash_to_bn254_field_size_be, Pubkey}; -use light_token_interface::state::{CompressedTokenAccountState, TokenData}; use light_hasher::HasherError; +use light_token_interface::state::{CompressedTokenAccountState, TokenData}; use num_bigint::BigUint; use rand::Rng; diff --git a/program-tests/compressed-token-test/Cargo.toml b/program-tests/compressed-token-test/Cargo.toml index be8b18dd88..3caadd3c53 100644 --- a/program-tests/compressed-token-test/Cargo.toml +++ b/program-tests/compressed-token-test/Cargo.toml @@ -46,7 +46,7 @@ serial_test = { workspace = true } light-token-interface = { workspace = true } light-token-client = { workspace = true } light-compressible = { workspace = true } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } spl-token-2022 = { workspace = true } spl-pod = { workspace = true } light-zero-copy = { workspace = true , features = ["std", "derive", "mut"]} diff --git a/program-tests/compressed-token-test/tests/compress_only/all.rs b/program-tests/compressed-token-test/tests/compress_only/all.rs index 0bd7307fde..3731aa63f8 100644 --- a/program-tests/compressed-token-test/tests/compress_only/all.rs +++ b/program-tests/compressed-token-test/tests/compress_only/all.rs @@ -3,10 +3,10 @@ //! This module tests the full compress -> decompress cycle with all extensions enabled. use borsh::BorshDeserialize; +use light_program_test::program_test::TestRpc; use light_token_interface::state::{ - AccountState, Token, ExtensionStruct, ACCOUNT_TYPE_TOKEN_ACCOUNT, + AccountState, ExtensionStruct, Token, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; -use light_program_test::program_test::TestRpc; use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -20,20 +20,20 @@ async fn test_compress_and_close_ctoken_with_extensions() { #[allow(unused_imports)] use light_client::indexer::CompressedTokenAccount; use light_client::indexer::Indexer; + use light_test_utils::mint_2022::{create_token_22_account, mint_spl_tokens_22}; + use light_token_client::instructions::transfer2::{ + create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, + }; use light_token_interface::{ instructions::extensions::{ CompressedOnlyExtensionInstructionData, ExtensionInstructionData, }, state::TokenDataVersion, }; - use light_ctoken_sdk::{ - ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, + use light_token_sdk::{ + ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, spl_interface::find_spl_interface_pda_with_index, }; - use light_test_utils::mint_2022::{create_token_22_account, mint_spl_tokens_22}; - use light_token_client::instructions::transfer2::{ - create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, - }; let mut context = setup_extensions_test(ALL_EXTENSIONS).await.unwrap(); let payer = context.payer.insecure_clone(); @@ -58,7 +58,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { let ctoken_account = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc @@ -88,7 +88,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { // 3. Transfer tokens to CToken using hot path (required for mints with restricted extensions) let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -178,7 +178,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { let decompress_dest_keypair = Keypair::new(); let decompress_dest_account = decompress_dest_keypair.pubkey(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), decompress_dest_account, mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs index 233458af88..065df67ecc 100644 --- a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs +++ b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs @@ -4,17 +4,6 @@ //! decompressed to the exact same ATA pubkey that was originally compressed. use light_client::indexer::Indexer; -use light_token_interface::{ - instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, - state::{ExtensionStruct, TokenDataVersion}, -}; -use light_ctoken_sdk::{ - ctoken::{ - derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount, CreateCTokenAccount, - TransferSplToCtoken, - }, - spl_interface::find_spl_interface_pda_with_index, -}; use light_program_test::{ program_test::TestRpc, utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, }; @@ -28,6 +17,17 @@ use light_test_utils::{ use light_token_client::instructions::transfer2::{ create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, }; +use light_token_interface::{ + instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, + state::{ExtensionStruct, TokenDataVersion}, +}; +use light_token_sdk::{ + ctoken::{ + derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount, CreateTokenAccount, + TransferSplToToken, + }, + spl_interface::find_spl_interface_pda_with_index, +}; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; use spl_token_2022::extension::ExtensionType; @@ -76,7 +76,7 @@ async fn setup_ata_compressed_token( // Create ATA with compression_only=true let owner = Keypair::new(); - let (ata_pubkey, ata_bump) = derive_ctoken_ata(&owner.pubkey(), &mint_pubkey); + let (ata_pubkey, ata_bump) = derive_token_ata(&owner.pubkey(), &mint_pubkey); let create_ata_ix = CreateAssociatedCTokenAccount::new(payer.pubkey(), owner.pubkey(), mint_pubkey) @@ -107,7 +107,7 @@ async fn setup_ata_compressed_token( let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -345,7 +345,7 @@ async fn test_ata_decompress_to_different_ata_fails() { let mint2_pubkey = mint2_keypair.pubkey(); // Create ATA for same owner but different mint - let (ata2_pubkey, _ata2_bump) = derive_ctoken_ata(&context.owner.pubkey(), &mint2_pubkey); + let (ata2_pubkey, _ata2_bump) = derive_token_ata(&context.owner.pubkey(), &mint2_pubkey); let create_ata2_ix = CreateAssociatedCTokenAccount::new( context.payer.pubkey(), @@ -420,7 +420,7 @@ async fn test_ata_decompress_to_non_ata_fails() { // Create a regular (non-ATA) CToken account with same owner let regular_account_keypair = Keypair::new(); - let create_regular_ix = CreateCTokenAccount::new( + let create_regular_ix = CreateTokenAccount::new( context.payer.pubkey(), regular_account_keypair.pubkey(), context.mint_pubkey, @@ -790,6 +790,7 @@ async fn test_decompress_skips_delegate_if_destination_has_delegate() { async fn test_ata_decompress_with_mismatched_amount_fails() { use borsh::BorshSerialize; use light_compressed_account::compressed_account::PackedMerkleContext; + use light_sdk::instruction::PackedAccounts; use light_token_interface::{ instructions::transfer2::{ CompressedTokenInstructionDataTransfer2, Compression, CompressionMode, @@ -797,10 +798,9 @@ async fn test_ata_decompress_with_mismatched_amount_fails() { }, TRANSFER2, }; - use light_ctoken_sdk::compressed_token::transfer2::account_metas::{ + use light_token_sdk::compressed_token::transfer2::account_metas::{ get_transfer2_instruction_account_metas, Transfer2AccountsMetaConfig, }; - use light_sdk::instruction::PackedAccounts; use solana_sdk::instruction::Instruction; let mut context = setup_ata_compressed_token(&[ExtensionType::Pausable], None, false) @@ -1012,7 +1012,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { // Setup wallet owner and derive ATA let wallet = Keypair::new(); - let (ata_pubkey, ata_bump) = derive_ctoken_ata(&wallet.pubkey(), &mint_pubkey); + let (ata_pubkey, ata_bump) = derive_token_ata(&wallet.pubkey(), &mint_pubkey); let amount1 = 100_000_000u64; let amount2 = 200_000_000u64; @@ -1049,7 +1049,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix1 = TransferSplToCtoken { + let transfer_ix1 = TransferSplToToken { amount: amount1, spl_interface_pda_bump, decimals: 9, @@ -1104,7 +1104,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { .unwrap(); // Transfer tokens from SPL to ATA - let transfer_ix2 = TransferSplToCtoken { + let transfer_ix2 = TransferSplToToken { amount: amount2, spl_interface_pda_bump, decimals: 9, @@ -1343,7 +1343,7 @@ async fn test_non_ata_compress_only_decompress() { let ctoken_account = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc @@ -1377,7 +1377,7 @@ async fn test_non_ata_compress_only_decompress() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -1438,7 +1438,7 @@ async fn test_non_ata_compress_only_decompress() { // Create new CToken account with SAME owner for decompress let new_account_keypair = Keypair::new(); - let create_new_ix = CreateCTokenAccount::new( + let create_new_ix = CreateTokenAccount::new( payer.pubkey(), new_account_keypair.pubkey(), mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs index 78d00e0f81..9e35301ce2 100644 --- a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs +++ b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs @@ -5,14 +5,6 @@ //! - Spec #14: CompressedOnly inputs must decompress complete account (no change output) use light_client::indexer::Indexer; -use light_token_interface::{ - instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, - state::TokenDataVersion, -}; -use light_ctoken_sdk::{ - ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, - spl_interface::find_spl_interface_pda_with_index, -}; use light_program_test::{ program_test::{LightProgramTest, TestRpc}, utils::assert::assert_rpc_error, @@ -25,6 +17,14 @@ use light_test_utils::mint_2022::{ use light_token_client::instructions::transfer2::{ create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, }; +use light_token_interface::{ + instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, + state::TokenDataVersion, +}; +use light_token_sdk::{ + ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + spl_interface::find_spl_interface_pda_with_index, +}; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; use spl_token_2022::extension::ExtensionType; @@ -68,7 +68,7 @@ async fn setup_compressed_token_for_decompress( let ctoken_account = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: rpc .test_accounts @@ -94,7 +94,7 @@ async fn setup_compressed_token_for_decompress( .any(|ext| RESTRICTED_EXTENSIONS.contains(ext)); let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -206,7 +206,7 @@ async fn test_decompress_compressed_only_rejects_partial_decompress() { let dest_keypair = Keypair::new(); let destination_pubkey = dest_keypair.pubkey(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), destination_pubkey, mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/compress_only/default_state.rs b/program-tests/compressed-token-test/tests/compress_only/default_state.rs index c95ab55a22..c3365052f3 100644 --- a/program-tests/compressed-token-test/tests/compress_only/default_state.rs +++ b/program-tests/compressed-token-test/tests/compress_only/default_state.rs @@ -4,12 +4,12 @@ //! the DefaultAccountState extension set to either Initialized or Frozen. use borsh::BorshDeserialize; -use light_token_interface::state::{AccountState, Token, ACCOUNT_TYPE_TOKEN_ACCOUNT}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{ mint_2022::{create_mint_22_with_extension_types, create_mint_22_with_frozen_default_state}, Rpc, }; +use light_token_interface::state::{AccountState, Token, ACCOUNT_TYPE_TOKEN_ACCOUNT}; use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; use spl_token_2022::extension::ExtensionType; @@ -20,7 +20,7 @@ use spl_token_2022::extension::ExtensionType; #[serial] async fn test_create_ctoken_with_frozen_default_state() { use light_token_interface::state::TokenDataVersion; - use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; + use light_token_sdk::token::{CompressibleParams, CreateTokenAccount}; let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) .await @@ -42,7 +42,7 @@ async fn test_create_ctoken_with_frozen_default_state() { let account_pubkey = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, payer.pubkey()) + CreateTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, payer.pubkey()) .with_compressible(CompressibleParams { compressible_config: rpc .test_accounts @@ -108,7 +108,7 @@ async fn test_create_ctoken_with_frozen_default_state() { #[serial] async fn test_create_ctoken_with_initialized_default_state() { use light_token_interface::state::TokenDataVersion; - use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; + use light_token_sdk::token::{CompressibleParams, CreateTokenAccount}; let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) .await @@ -135,7 +135,7 @@ async fn test_create_ctoken_with_initialized_default_state() { let account_pubkey = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, payer.pubkey()) + CreateTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, payer.pubkey()) .with_compressible(CompressibleParams { compressible_config: rpc .test_accounts diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs index e123e7f3fc..f70123c153 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs @@ -8,14 +8,6 @@ use anchor_spl::token_2022::spl_token_2022; use light_client::indexer::Indexer; -use light_token_interface::{ - instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, - state::TokenDataVersion, -}; -use light_ctoken_sdk::{ - ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, - spl_interface::find_spl_interface_pda_with_index, -}; use light_program_test::{ program_test::{LightProgramTest, TestRpc}, utils::assert::assert_rpc_error, @@ -28,6 +20,14 @@ use light_test_utils::mint_2022::{ use light_token_client::instructions::transfer2::{ create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, }; +use light_token_interface::{ + instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, + state::TokenDataVersion, +}; +use light_token_sdk::{ + ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + spl_interface::find_spl_interface_pda_with_index, +}; use serial_test::serial; use solana_sdk::{program_pack::Pack, pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -103,7 +103,7 @@ async fn setup_compressed_token_for_decompress( let ctoken_account = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: rpc .test_accounts @@ -130,7 +130,7 @@ async fn setup_compressed_token_for_decompress( .any(|ext| RESTRICTED_EXTENSIONS.contains(ext)); let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -188,7 +188,7 @@ async fn test_decompress_owner_mismatch() { let dest_keypair = Keypair::new(); let destination_pubkey = dest_keypair.pubkey(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), destination_pubkey, mint_pubkey, @@ -265,7 +265,7 @@ async fn test_decompress_non_zero_amount() { let dest_keypair = Keypair::new(); let destination_pubkey = dest_keypair.pubkey(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), destination_pubkey, mint_pubkey, @@ -361,7 +361,7 @@ async fn test_decompress_has_delegate() { let dest_keypair = Keypair::new(); let destination_pubkey = dest_keypair.pubkey(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), destination_pubkey, mint_pubkey, @@ -462,7 +462,7 @@ async fn test_decompress_non_zero_delegated_amount() { let dest_keypair = Keypair::new(); let destination_pubkey = dest_keypair.pubkey(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), destination_pubkey, mint_pubkey, @@ -548,7 +548,7 @@ async fn test_decompress_has_close_authority() { let dest_keypair = Keypair::new(); let destination_pubkey = dest_keypair.pubkey(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), destination_pubkey, mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs index 6f81250b68..3f193ef022 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs @@ -9,16 +9,6 @@ use anchor_lang::{system_program, InstructionData, ToAccountMetas}; use light_client::indexer::Indexer; -use light_token_interface::{ - find_spl_interface_pda_with_index, - instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, - state::TokenDataVersion, -}; -use light_ctoken_sdk::{ - constants::CPI_AUTHORITY_PDA, - ctoken::{CompressibleParams, CreateCTokenAccount, TransferCTokenToSpl, TransferSplToCtoken}, - spl_interface::find_spl_interface_pda_with_index as sdk_find_spl_interface_pda, -}; use light_program_test::{ program_test::{LightProgramTest, TestRpc}, utils::assert::assert_rpc_error, @@ -30,6 +20,16 @@ use light_test_utils::mint_2022::{ use light_token_client::instructions::transfer2::{ create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, }; +use light_token_interface::{ + find_spl_interface_pda_with_index, + instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, + state::TokenDataVersion, +}; +use light_token_sdk::{ + constants::CPI_AUTHORITY_PDA, + ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken, TransferTokenToSpl}, + spl_interface::find_spl_interface_pda_with_index as sdk_find_spl_interface_pda, +}; use serial_test::serial; use solana_sdk::{instruction::Instruction, pubkey::Pubkey, signature::Keypair, signer::Signer}; use spl_token_2022::{ @@ -264,7 +264,7 @@ async fn setup_ctoken_for_bypass_test( let ctoken_account = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc @@ -295,7 +295,7 @@ async fn setup_ctoken_for_bypass_test( let (spl_interface_pda, spl_interface_pda_bump) = sdk_find_spl_interface_pda(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -348,7 +348,7 @@ async fn test_ctoken_to_spl_bypasses_non_zero_fee() { let (spl_interface_pda, spl_interface_pda_bump) = sdk_find_spl_interface_pda(&mint_pubkey, 0, true); - let transfer_ix = TransferCTokenToSpl { + let transfer_ix = TransferTokenToSpl { source_ctoken_account: ctoken_account, destination_spl_token_account: spl_dest, amount: 100_000_000, @@ -518,7 +518,7 @@ async fn test_decompress_bypasses_non_zero_fee() { let dest_account = dest_keypair.pubkey(); let create_dest_ix = - CreateCTokenAccount::new(payer.pubkey(), dest_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), dest_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc @@ -625,7 +625,7 @@ async fn test_decompress_bypasses_non_nil_hook() { let dest_account = dest_keypair.pubkey(); let create_dest_ix = - CreateCTokenAccount::new(payer.pubkey(), dest_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), dest_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc diff --git a/program-tests/compressed-token-test/tests/compress_only/mod.rs b/program-tests/compressed-token-test/tests/compress_only/mod.rs index 43fee1b8ea..276947122c 100644 --- a/program-tests/compressed-token-test/tests/compress_only/mod.rs +++ b/program-tests/compressed-token-test/tests/compress_only/mod.rs @@ -4,7 +4,6 @@ //! with Token-2022 mints that have restricted extensions. use borsh::BorshDeserialize; -use light_token_interface::state::{AccountState, Token, ExtensionStruct}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; pub use light_test_utils::{mint_2022::ALL_EXTENSIONS, Rpc}; use light_test_utils::{ @@ -14,6 +13,7 @@ use light_test_utils::{ }, RpcError, }; +use light_token_interface::state::{AccountState, ExtensionStruct, Token}; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; pub use spl_token_2022::extension::ExtensionType; @@ -154,6 +154,9 @@ pub async fn run_compress_and_close_extension_test( config: CompressAndCloseTestConfig, ) -> Result<(), RpcError> { use light_client::indexer::Indexer; + use light_token_client::instructions::transfer2::{ + create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, + }; use light_token_interface::{ instructions::extensions::{ CompressedOnlyExtensionInstructionData, ExtensionInstructionData, @@ -162,13 +165,10 @@ pub async fn run_compress_and_close_extension_test( CompressedOnlyExtension, CompressedTokenAccountState, TokenData, TokenDataVersion, }, }; - use light_ctoken_sdk::{ - ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, + use light_token_sdk::{ + ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, spl_interface::find_spl_interface_pda_with_index, }; - use light_token_client::instructions::transfer2::{ - create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, - }; let mut context = setup_extensions_test(config.extensions).await?; let has_restricted_extensions = config @@ -198,7 +198,7 @@ pub async fn run_compress_and_close_extension_test( let ctoken_account = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc @@ -229,7 +229,7 @@ pub async fn run_compress_and_close_extension_test( let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted_extensions); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -326,7 +326,7 @@ pub async fn run_compress_and_close_extension_test( let decompress_dest_keypair = Keypair::new(); let decompress_dest_account = decompress_dest_keypair.pubkey(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), decompress_dest_account, mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs b/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs index b5aa3e2f4c..598ba020a0 100644 --- a/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs +++ b/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs @@ -4,12 +4,12 @@ //! when the mint has restricted extensions (Pausable, PermanentDelegate, TransferFeeConfig, //! TransferHook, DefaultAccountState). -use light_token_interface::state::TokenDataVersion; -use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; use light_program_test::{ program_test::LightProgramTest, utils::assert::assert_rpc_error, ProgramTestConfig, Rpc, }; use light_test_utils::mint_2022::create_mint_22_with_extension_types; +use light_token_interface::state::TokenDataVersion; +use light_token_sdk::token::{CompressibleParams, CreateTokenAccount}; use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; use spl_token_2022::extension::ExtensionType; @@ -34,7 +34,7 @@ async fn test_compression_only_required_for_extensions(extensions: &[ExtensionTy let token_account_keypair = Keypair::new(); let token_account_pubkey = token_account_keypair.pubkey(); - let create_ix = CreateCTokenAccount::new( + let create_ix = CreateTokenAccount::new( payer.pubkey(), token_account_pubkey, mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs index 379e367b0b..54351ab1c6 100644 --- a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs +++ b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs @@ -5,17 +5,6 @@ use borsh::BorshDeserialize; use light_client::indexer::Indexer; -use light_token_interface::{ - instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, - state::{ - Token, CompressedOnlyExtension, CompressedTokenAccountState, ExtensionStruct, TokenData, - TokenDataVersion, - }, -}; -use light_ctoken_sdk::{ - ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, - spl_interface::find_spl_interface_pda_with_index, -}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use light_test_utils::{ mint_2022::{create_mint_22_with_extension_types, create_token_22_account, mint_spl_tokens_22}, @@ -24,6 +13,17 @@ use light_test_utils::{ use light_token_client::instructions::transfer2::{ create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, }; +use light_token_interface::{ + instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, + state::{ + CompressedOnlyExtension, CompressedTokenAccountState, ExtensionStruct, Token, TokenData, + TokenDataVersion, + }, +}; +use light_token_sdk::{ + ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + spl_interface::find_spl_interface_pda_with_index, +}; use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; use spl_token_2022::extension::ExtensionType; @@ -57,7 +57,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError let ctoken_account = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: rpc .test_accounts @@ -79,7 +79,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError // 4. Transfer tokens to CToken let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); // true = restricted - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -173,7 +173,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError let decompress_dest_keypair = Keypair::new(); let decompress_dest_account = decompress_dest_keypair.pubkey(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), decompress_dest_account, mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs b/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs index cc2b8fcde2..d3d336e47e 100644 --- a/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs +++ b/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs @@ -340,10 +340,10 @@ async fn test_revoke_fails() { // ============================================================================ use anchor_lang::AnchorDeserialize; -use light_token_interface::state::{Token, TokenDataVersion}; -use light_ctoken_sdk::ctoken::{ApproveCToken, CreateCTokenAccount, RevokeCToken}; use light_program_test::program_test::TestRpc; use light_test_utils::RpcError; +use light_token_interface::state::{Token, TokenDataVersion}; +use light_token_sdk::token::{ApproveToken, CreateTokenAccount, RevokeToken}; use solana_sdk::program_pack::Pack; use super::extensions::setup_extensions_test; @@ -371,7 +371,7 @@ async fn test_approve_revoke_compressible() -> Result<(), RpcError> { let account_pubkey = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc @@ -431,7 +431,7 @@ async fn test_approve_revoke_compressible() -> Result<(), RpcError> { // 3. Approve 10 tokens to delegate let approve_amount = 10u64; - let approve_ix = ApproveCToken { + let approve_ix = ApproveToken { token_account: account_pubkey, delegate: delegate.pubkey(), owner: owner.pubkey(), @@ -457,7 +457,7 @@ async fn test_approve_revoke_compressible() -> Result<(), RpcError> { .await; // 5. Revoke delegation - let revoke_ix = RevokeCToken { + let revoke_ix = RevokeToken { token_account: account_pubkey, owner: owner.pubkey(), } diff --git a/program-tests/compressed-token-test/tests/ctoken/burn.rs b/program-tests/compressed-token-test/tests/ctoken/burn.rs index 847365b6ec..6eba8b62c6 100644 --- a/program-tests/compressed-token-test/tests/ctoken/burn.rs +++ b/program-tests/compressed-token-test/tests/ctoken/burn.rs @@ -16,16 +16,16 @@ //! This is different from approve/revoke which only modify the CToken account. //! //! **Note**: Max top-up exceeded test requires compressible accounts with time warp. -//! For comprehensive max_top_up testing, see sdk-tests/sdk-ctoken-test/tests/test_burn.rs -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, - ctoken::{derive_ctoken_ata, BurnCToken, CTokenMintTo, CreateAssociatedCTokenAccount}, -}; +//! For comprehensive max_top_up testing, see sdk-tests/sdk-light-token-test/tests/test_burn.rs use light_program_test::{ program_test::TestRpc, utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, }; use light_test_utils::assert_ctoken_burn::assert_ctoken_burn; use light_token_client::instructions::mint_action::DecompressMintParams; +use light_token_sdk::{ + compressed_token::create_compressed_mint::find_cmint_address, + token::{derive_token_ata, BurnToken, CreateAssociatedTokenAccount, TokenMintTo}, +}; use super::shared::*; @@ -42,7 +42,7 @@ async fn test_burn_success_cases() { let burn_amount = 50u64; // Burn 50 tokens - let burn_ix = BurnCToken { + let burn_ix = BurnToken { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: burn_amount, @@ -73,7 +73,7 @@ async fn test_burn_success_cases() { let burn_amount = 100u64; // Burn all 100 tokens - let burn_ix = BurnCToken { + let burn_ix = BurnToken { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: burn_amount, @@ -123,7 +123,7 @@ async fn test_burn_fails() { let (other_cmint_pda, _) = find_cmint_address(&other_mint_seed.pubkey()); // Try to burn with wrong mint - let burn_ix = BurnCToken { + let burn_ix = BurnToken { source: ctx.ctoken_account, cmint: other_cmint_pda, // Wrong mint amount: 50, @@ -153,7 +153,7 @@ async fn test_burn_fails() { let non_existent = Pubkey::new_unique(); - let burn_ix = BurnCToken { + let burn_ix = BurnToken { source: non_existent, cmint: ctx.cmint_pda, amount: 50, @@ -199,7 +199,7 @@ async fn test_burn_fails() { ctx.rpc .set_account(wrong_owner_account.pubkey(), account_with_wrong_owner); - let burn_ix = BurnCToken { + let burn_ix = BurnToken { source: wrong_owner_account.pubkey(), cmint: ctx.cmint_pda, amount: 50, @@ -229,7 +229,7 @@ async fn test_burn_fails() { let mut ctx = setup_burn_test().await; // Try to burn more than balance (100 tokens) - let burn_ix = BurnCToken { + let burn_ix = BurnToken { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 200, // More than 100 balance @@ -264,7 +264,7 @@ async fn test_burn_fails() { .await .unwrap(); - let burn_ix = BurnCToken { + let burn_ix = BurnToken { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 50, @@ -292,7 +292,7 @@ async fn test_burn_fails() { // Note: This requires compressible accounts that need top-up after time warp. // The current setup creates non-compressible accounts, so max_top_up test // would need additional setup. For comprehensive max_top_up testing, see - // sdk-tests/sdk-ctoken-test/tests/test_burn.rs + // sdk-tests/sdk-light-token-test/tests/test_burn.rs } // ============================================================================ @@ -329,10 +329,10 @@ async fn setup_burn_test() -> BurnTestContext { let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); // Step 1: Create CToken ATA for owner - let (ctoken_ata, _) = derive_ctoken_ata(&owner_keypair.pubkey(), &cmint_pda); + let (ctoken_ata, _) = derive_token_ata(&owner_keypair.pubkey(), &cmint_pda); let create_ata_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), owner_keypair.pubkey(), cmint_pda) + CreateAssociatedTokenAccount::new(payer.pubkey(), owner_keypair.pubkey(), cmint_pda) .instruction() .unwrap(); @@ -365,7 +365,7 @@ async fn setup_burn_test() -> BurnTestContext { .unwrap(); // Step 3: Mint 100 tokens to the CToken account - let mint_ix = CTokenMintTo { + let mint_ix = TokenMintTo { cmint: cmint_pda, destination: ctoken_ata, amount: 100, @@ -397,7 +397,7 @@ async fn setup_burn_test() -> BurnTestContext { // Burn Checked Tests // ============================================================================ -use light_ctoken_sdk::ctoken::BurnCTokenChecked; +use light_token_sdk::token::BurnTokenChecked; /// MintDecimalsMismatch error code (SplMintDecimalsMismatch = 6166) const MINT_DECIMALS_MISMATCH: u32 = 6166; @@ -409,7 +409,7 @@ async fn test_burn_checked_success() { let burn_amount = 50u64; // Burn 50 tokens with correct decimals (8) - let burn_ix = BurnCTokenChecked { + let burn_ix = BurnTokenChecked { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: burn_amount, @@ -441,7 +441,7 @@ async fn test_burn_checked_wrong_decimals() { let mut ctx = setup_burn_test().await; // Try to burn with wrong decimals (7 instead of 8) - let burn_ix = BurnCTokenChecked { + let burn_ix = BurnTokenChecked { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 50, diff --git a/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs b/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs index 81f21773cb..1dbb017dd0 100644 --- a/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs +++ b/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs @@ -163,9 +163,9 @@ async fn test_compress_and_close_owner_scenarios() { .await; // Set token balance on ATA - use light_ctoken_sdk::ctoken::derive_ctoken_ata; + use light_token_sdk::token::derive_token_ata; let (ata_pubkey, _bump) = - derive_ctoken_ata(&context.owner_keypair.pubkey(), &context.mint_pubkey); + derive_token_ata(&context.owner_keypair.pubkey(), &context.mint_pubkey); let mut ata_account = context.rpc.get_account(ata_pubkey).await.unwrap().unwrap(); @@ -546,7 +546,7 @@ async fn test_compressible_account_with_custom_rent_payer_close_with_compression compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, token_account_pubkey, context.mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/ctoken/create.rs b/program-tests/compressed-token-test/tests/ctoken/create.rs index aa17d802c7..b70bdbafb5 100644 --- a/program-tests/compressed-token-test/tests/ctoken/create.rs +++ b/program-tests/compressed-token-test/tests/ctoken/create.rs @@ -262,7 +262,7 @@ async fn test_create_compressible_token_account_failing() { compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( poor_payer_pubkey, token_account_pubkey.pubkey(), context.mint_pubkey, @@ -317,7 +317,7 @@ async fn test_create_compressible_token_account_failing() { compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, token_account_pubkey, context.mint_pubkey, @@ -368,7 +368,7 @@ async fn test_create_compressible_token_account_failing() { compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, context.token_account_keypair.pubkey(), context.mint_pubkey, @@ -440,7 +440,7 @@ async fn test_create_compressible_token_account_failing() { compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, context.token_account_keypair.pubkey(), context.mint_pubkey, @@ -484,7 +484,7 @@ async fn test_create_compressible_token_account_failing() { compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, context.token_account_keypair.pubkey(), context.mint_pubkey, @@ -628,7 +628,7 @@ async fn test_create_compressible_token_account_failing() { compression_only: true, // Required for restricted extensions }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, context.token_account_keypair.pubkey(), t22_token_account, // Token account, not mint! @@ -671,7 +671,7 @@ async fn test_create_compressible_token_account_failing() { compression_only: false, }; - let create_ix = CreateCTokenAccount::new( + let create_ix = CreateTokenAccount::new( payer_pubkey, context.token_account_keypair.pubkey(), context.mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/ctoken/create_ata.rs b/program-tests/compressed-token-test/tests/ctoken/create_ata.rs index 2cfd5caf72..adaac35556 100644 --- a/program-tests/compressed-token-test/tests/ctoken/create_ata.rs +++ b/program-tests/compressed-token-test/tests/ctoken/create_ata.rs @@ -168,7 +168,7 @@ async fn test_create_compressible_ata() { compression_only: true, }; - let create_ata_ix = CreateAssociatedCTokenAccount::new( + let create_ata_ix = CreateAssociatedTokenAccount::new( payer_pubkey, owner_and_mint, // Owner == Mint owner_and_mint, // Mint == Owner @@ -184,7 +184,7 @@ async fn test_create_compressible_ata() { .unwrap(); // Verify ATA was created at the expected address - let (expected_ata, _) = derive_ctoken_ata(&owner_and_mint, &owner_and_mint); + let (expected_ata, _) = derive_token_ata(&owner_and_mint, &owner_and_mint); let account = context.rpc.get_account(expected_ata).await.unwrap(); assert!( account.is_some(), @@ -388,7 +388,7 @@ async fn test_create_ata_failing() { compression_only: true, }; - let create_ata_ix = CreateAssociatedCTokenAccount::new( + let create_ata_ix = CreateAssociatedTokenAccount::new( poor_payer_pubkey, new_owner.pubkey(), context.mint_pubkey, @@ -420,7 +420,7 @@ async fn test_create_ata_failing() { // Use different mint for this test context.mint_pubkey = solana_sdk::pubkey::Pubkey::new_unique(); let (ata_pubkey, bump) = - derive_ctoken_ata(&context.owner_keypair.pubkey(), &context.mint_pubkey); + derive_token_ata(&context.owner_keypair.pubkey(), &context.mint_pubkey); // Manually build instruction data with compress_to_account_pubkey (forbidden for ATAs) let compress_to_pubkey = CompressToPubkey { @@ -441,7 +441,7 @@ async fn test_create_ata_failing() { }), }; - let mut data = vec![100]; // CreateAssociatedCTokenAccount discriminator + let mut data = vec![100]; // CreateAssociatedTokenAccount discriminator instruction_data.serialize(&mut data).unwrap(); // Account order: mint, payer, ata, system_program, config, rent_sponsor @@ -491,7 +491,7 @@ async fn test_create_ata_failing() { // Use different mint for this test context.mint_pubkey = solana_sdk::pubkey::Pubkey::new_unique(); let (ata_pubkey, correct_bump) = - derive_ctoken_ata(&context.owner_keypair.pubkey(), &context.mint_pubkey); + derive_token_ata(&context.owner_keypair.pubkey(), &context.mint_pubkey); // Manually build instruction data with WRONG bump let wrong_bump = if correct_bump == 255 { @@ -513,7 +513,7 @@ async fn test_create_ata_failing() { }), }; - let mut data = vec![100]; // CreateAssociatedCTokenAccount discriminator + let mut data = vec![100]; // CreateAssociatedTokenAccount discriminator instruction_data.serialize(&mut data).unwrap(); // Account order: owner, mint, payer, ata, system_program, config, rent_sponsor @@ -577,7 +577,7 @@ async fn test_create_ata_failing() { compression_only: true, }; - let create_ata_ix = CreateAssociatedCTokenAccount::new( + let create_ata_ix = CreateAssociatedTokenAccount::new( payer_pubkey, context.owner_keypair.pubkey(), context.mint_pubkey, @@ -647,7 +647,7 @@ async fn test_create_ata_failing() { compression_only: true, }; - let create_ata_ix = CreateAssociatedCTokenAccount::new( + let create_ata_ix = CreateAssociatedTokenAccount::new( payer_pubkey, context.owner_keypair.pubkey(), context.mint_pubkey, @@ -686,7 +686,7 @@ async fn test_create_ata_failing() { compression_only: true, }; - let create_ata_ix = CreateAssociatedCTokenAccount::new( + let create_ata_ix = CreateAssociatedTokenAccount::new( payer_pubkey, context.owner_keypair.pubkey(), context.mint_pubkey, @@ -721,7 +721,7 @@ async fn test_create_ata_failing() { // Get the correct PDA and bump let (_correct_ata_pubkey, correct_bump) = - derive_ctoken_ata(&context.owner_keypair.pubkey(), &context.mint_pubkey); + derive_token_ata(&context.owner_keypair.pubkey(), &context.mint_pubkey); // Create an arbitrary keypair (NOT the correct PDA) let fake_ata_keypair = solana_sdk::signature::Keypair::new(); @@ -734,7 +734,7 @@ async fn test_create_ata_failing() { compressible_config: None, }; - let mut data = vec![100]; // CreateAssociatedCTokenAccount discriminator + let mut data = vec![100]; // CreateAssociatedTokenAccount discriminator instruction_data.serialize(&mut data).unwrap(); // Account order: owner, mint, payer, ata (fake!), system_program, compressible_config, rent_sponsor @@ -778,8 +778,8 @@ async fn test_create_ata_failing() { // Error: 6115 (MissingCompressibleConfig) { use anchor_lang::prelude::borsh::BorshSerialize; - use light_token_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; use light_test_utils::mint_2022::create_mint_22_with_extension_types; + use light_token_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; use solana_sdk::instruction::Instruction; use spl_token_2022::extension::ExtensionType; @@ -799,7 +799,7 @@ async fn test_create_ata_failing() { let owner = solana_sdk::pubkey::Pubkey::new_unique(); // Derive ATA address - let (ata_pubkey, bump) = derive_ctoken_ata(&owner, &mint_with_restricted_ext); + let (ata_pubkey, bump) = derive_token_ata(&owner, &mint_with_restricted_ext); // Build instruction data with compressible_config: None (non-compressible) let instruction_data = CreateAssociatedTokenAccountInstructionData { @@ -807,7 +807,7 @@ async fn test_create_ata_failing() { compressible_config: None, // Non-compressible! }; - let mut data = vec![100]; // CreateAssociatedCTokenAccount discriminator + let mut data = vec![100]; // CreateAssociatedTokenAccount discriminator instruction_data.serialize(&mut data).unwrap(); // Account order: owner, mint, payer, ata, system_program @@ -878,7 +878,7 @@ async fn test_create_ata_failing() { compression_only: true, // Required for restricted extensions }; - let create_ata_ix = CreateAssociatedCTokenAccount::new( + let create_ata_ix = CreateAssociatedTokenAccount::new( payer_pubkey, owner, t22_token_account, // Token account, not mint! @@ -955,9 +955,9 @@ async fn test_ata_multiple_mints_same_owner() { assert_ne!(ata2, ata3, "ATA for mint2 and mint3 should be different"); // Verify each ATA is derived correctly for its mint - let (expected_ata1, _) = derive_ctoken_ata(&owner, &mint1); - let (expected_ata2, _) = derive_ctoken_ata(&owner, &mint2); - let (expected_ata3, _) = derive_ctoken_ata(&owner, &mint3); + let (expected_ata1, _) = derive_token_ata(&owner, &mint1); + let (expected_ata2, _) = derive_token_ata(&owner, &mint2); + let (expected_ata3, _) = derive_token_ata(&owner, &mint3); assert_eq!(ata1, expected_ata1, "ATA1 should match expected derivation"); assert_eq!(ata2, expected_ata2, "ATA2 should match expected derivation"); @@ -999,7 +999,7 @@ async fn test_ata_multiple_owners_same_mint() { compression_only: true, }; - let create_ata_ix1 = CreateAssociatedCTokenAccount::new(payer_pubkey, owner1, mint) + let create_ata_ix1 = CreateAssociatedTokenAccount::new(payer_pubkey, owner1, mint) .with_compressible(compressible_params.clone()) .instruction() .unwrap(); @@ -1010,7 +1010,7 @@ async fn test_ata_multiple_owners_same_mint() { .await .unwrap(); - let (ata1, _) = derive_ctoken_ata(&owner1, &mint); + let (ata1, _) = derive_token_ata(&owner1, &mint); // Assert ATA1 was created correctly assert_create_associated_token_account( @@ -1022,7 +1022,7 @@ async fn test_ata_multiple_owners_same_mint() { ) .await; - let create_ata_ix2 = CreateAssociatedCTokenAccount::new(payer_pubkey, owner2, mint) + let create_ata_ix2 = CreateAssociatedTokenAccount::new(payer_pubkey, owner2, mint) .with_compressible(compressible_params.clone()) .instruction() .unwrap(); @@ -1033,7 +1033,7 @@ async fn test_ata_multiple_owners_same_mint() { .await .unwrap(); - let (ata2, _) = derive_ctoken_ata(&owner2, &mint); + let (ata2, _) = derive_token_ata(&owner2, &mint); // Assert ATA2 was created correctly assert_create_associated_token_account( @@ -1045,7 +1045,7 @@ async fn test_ata_multiple_owners_same_mint() { ) .await; - let create_ata_ix3 = CreateAssociatedCTokenAccount::new(payer_pubkey, owner3, mint) + let create_ata_ix3 = CreateAssociatedTokenAccount::new(payer_pubkey, owner3, mint) .with_compressible(compressible_params) .instruction() .unwrap(); @@ -1056,7 +1056,7 @@ async fn test_ata_multiple_owners_same_mint() { .await .unwrap(); - let (ata3, _) = derive_ctoken_ata(&owner3, &mint); + let (ata3, _) = derive_token_ata(&owner3, &mint); // Assert ATA3 was created correctly assert_create_associated_token_account( @@ -1074,9 +1074,9 @@ async fn test_ata_multiple_owners_same_mint() { assert_ne!(ata2, ata3, "ATA for owner2 and owner3 should be different"); // Verify each ATA is derived correctly for its owner - let (expected_ata1, _) = derive_ctoken_ata(&owner1, &mint); - let (expected_ata2, _) = derive_ctoken_ata(&owner2, &mint); - let (expected_ata3, _) = derive_ctoken_ata(&owner3, &mint); + let (expected_ata1, _) = derive_token_ata(&owner1, &mint); + let (expected_ata2, _) = derive_token_ata(&owner2, &mint); + let (expected_ata3, _) = derive_token_ata(&owner3, &mint); assert_eq!(ata1, expected_ata1, "ATA1 should match expected derivation"); assert_eq!(ata2, expected_ata2, "ATA2 should match expected derivation"); diff --git a/program-tests/compressed-token-test/tests/ctoken/create_ata2.rs b/program-tests/compressed-token-test/tests/ctoken/create_ata2.rs index 236f85cd5f..ec04b8d4f4 100644 --- a/program-tests/compressed-token-test/tests/ctoken/create_ata2.rs +++ b/program-tests/compressed-token-test/tests/ctoken/create_ata2.rs @@ -11,7 +11,7 @@ async fn create_and_assert_ata2( let payer_pubkey = context.payer.pubkey(); let owner_pubkey = context.owner_keypair.pubkey(); - let (ata_pubkey, bump) = derive_ctoken_ata(&owner_pubkey, &context.mint_pubkey); + let (ata_pubkey, bump) = derive_token_ata(&owner_pubkey, &context.mint_pubkey); let create_ata_ix = if let Some(compressible) = compressible_data.as_ref() { let compressible_params = CompressibleParams { @@ -25,7 +25,7 @@ async fn create_and_assert_ata2( }; let mut builder = - CreateAssociatedCTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) + CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) .with_compressible(compressible_params); if idempotent { @@ -35,7 +35,7 @@ async fn create_and_assert_ata2( builder.instruction().unwrap() } else { // Create non-compressible account - let mut builder = CreateAssociatedCTokenAccount { + let mut builder = CreateAssociatedTokenAccount { idempotent: false, bump, payer: payer_pubkey, @@ -161,13 +161,12 @@ async fn test_create_ata2_idempotent() { calculate_token_account_size, CompressibleExtensionConfig, CompressionInfoConfig, ExtensionStructConfig, }; - let expected_size = - calculate_token_account_size(Some(&[ExtensionStructConfig::Compressible( - CompressibleExtensionConfig { - info: CompressionInfoConfig { rent_config: () }, - }, - )])) - .unwrap(); + let expected_size = calculate_token_account_size(Some(&[ExtensionStructConfig::Compressible( + CompressibleExtensionConfig { + info: CompressionInfoConfig { rent_config: () }, + }, + )])) + .unwrap(); assert_eq!( account.data.len(), diff --git a/program-tests/compressed-token-test/tests/ctoken/extensions.rs b/program-tests/compressed-token-test/tests/ctoken/extensions.rs index d2bbedee93..b57b95c7cf 100644 --- a/program-tests/compressed-token-test/tests/ctoken/extensions.rs +++ b/program-tests/compressed-token-test/tests/ctoken/extensions.rs @@ -3,10 +3,6 @@ //! This module tests the creation and verification of Token 2022 mints //! with all supported extensions. -use light_token_interface::state::{ - ExtensionStruct, PausableAccountExtension, PermanentDelegateAccountExtension, - TransferFeeAccountExtension, TransferHookAccountExtension, ACCOUNT_TYPE_TOKEN_ACCOUNT, -}; use light_program_test::{utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig}; use light_test_utils::{ mint_2022::{ @@ -18,6 +14,10 @@ use light_test_utils::{ use light_token_client::instructions::transfer2::{ create_generic_transfer2_instruction, CompressInput, Transfer2InstructionType, }; +use light_token_interface::state::{ + ExtensionStruct, PausableAccountExtension, PermanentDelegateAccountExtension, + TransferFeeAccountExtension, TransferHookAccountExtension, ACCOUNT_TYPE_TOKEN_ACCOUNT, +}; use serial_test::serial; use solana_sdk::{ native_token::LAMPORTS_PER_SOL, pubkey::Pubkey, signature::Keypair, signer::Signer, @@ -80,9 +80,9 @@ async fn test_setup_mint_22_with_all_extensions() { #[serial] async fn test_mint_and_compress_with_extensions() { use light_token_interface::state::TokenDataVersion; - use light_ctoken_sdk::{ - ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, + use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, }; let mut context = setup_extensions_test().await.unwrap(); @@ -111,7 +111,7 @@ async fn test_mint_and_compress_with_extensions() { // 3. Create CToken account with extensions (destination for hot path transfer) let owner = Keypair::new(); let account_keypair = Keypair::new(); - let create_ix = CreateCTokenAccount::new( + let create_ix = CreateTokenAccount::new( payer.pubkey(), account_keypair.pubkey(), mint_pubkey, @@ -149,7 +149,7 @@ async fn test_mint_and_compress_with_extensions() { // Use restricted=true because this mint has restricted extensions (PermanentDelegate, etc.) let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: transfer_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -199,11 +199,11 @@ async fn test_mint_and_compress_with_extensions() { #[tokio::test] #[serial] async fn test_create_ctoken_with_extensions() { - use light_token_interface::state::TokenDataVersion; - use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; use light_test_utils::assert_create_token_account::{ assert_create_token_account, CompressibleData, }; + use light_token_interface::state::TokenDataVersion; + use light_token_sdk::token::{CompressibleParams, CreateTokenAccount}; let mut context = setup_extensions_test().await.unwrap(); let payer = context.payer.insecure_clone(); @@ -230,7 +230,7 @@ async fn test_create_ctoken_with_extensions() { .compression_authority_pda; let create_ix = - CreateCTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, payer.pubkey()) + CreateTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, payer.pubkey()) .with_compressible(CompressibleParams { compressible_config, rent_sponsor, @@ -285,9 +285,9 @@ async fn test_transfer_with_permanent_delegate() { use anchor_lang::prelude::AccountMeta; use anchor_spl::token_2022::spl_token_2022; use light_token_interface::state::TokenDataVersion; - use light_ctoken_sdk::{ - ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, + use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, }; use solana_sdk::{instruction::Instruction, program_pack::Pack}; @@ -315,7 +315,7 @@ async fn test_transfer_with_permanent_delegate() { let account_a_keypair = Keypair::new(); let account_a_pubkey = account_a_keypair.pubkey(); - let create_a_ix = CreateCTokenAccount::new( + let create_a_ix = CreateTokenAccount::new( payer.pubkey(), account_a_pubkey, mint_pubkey, @@ -354,7 +354,7 @@ async fn test_transfer_with_permanent_delegate() { let account_b_keypair = Keypair::new(); let account_b_pubkey = account_b_keypair.pubkey(); - let create_b_ix = CreateCTokenAccount::new( + let create_b_ix = CreateTokenAccount::new( payer.pubkey(), account_b_pubkey, mint_pubkey, @@ -394,7 +394,7 @@ async fn test_transfer_with_permanent_delegate() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_spl_to_ctoken_ix = TransferSplToCtoken { + let transfer_spl_to_ctoken_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -486,9 +486,9 @@ async fn test_transfer_with_owner_authority() { use anchor_spl::token_2022::spl_token_2022; use borsh::BorshDeserialize; use light_token_interface::state::{AccountState, Token, TokenDataVersion}; - use light_ctoken_sdk::{ - ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, + use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, }; use solana_sdk::{instruction::Instruction, program_pack::Pack}; @@ -520,7 +520,7 @@ async fn test_transfer_with_owner_authority() { let account_a_keypair = Keypair::new(); let account_a_pubkey = account_a_keypair.pubkey(); - let create_a_ix = CreateCTokenAccount::new( + let create_a_ix = CreateTokenAccount::new( payer.pubkey(), account_a_pubkey, mint_pubkey, @@ -559,7 +559,7 @@ async fn test_transfer_with_owner_authority() { let account_b_keypair = Keypair::new(); let account_b_pubkey = account_b_keypair.pubkey(); - let create_b_ix = CreateCTokenAccount::new( + let create_b_ix = CreateTokenAccount::new( payer.pubkey(), account_b_pubkey, mint_pubkey, @@ -622,7 +622,7 @@ async fn test_transfer_with_owner_authority() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_spl_to_ctoken_ix = TransferSplToCtoken { + let transfer_spl_to_ctoken_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, diff --git a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs b/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs index 2d392a92af..05318701df 100644 --- a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs +++ b/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs @@ -2,17 +2,12 @@ //! //! This module tests extension validation for operations that FAIL with invalid state: //! 1. CTokenTransfer(Checked) - transfers between CToken accounts -//! 2. SPL → CToken (TransferSplToCtoken) - entering via Compress mode +//! 2. SPL → CToken (TransferSplToToken) - entering via Compress mode //! -//! Note: CToken → SPL (TransferCTokenToSpl) is a BYPASS operation and is tested +//! Note: CToken → SPL (TransferTokenToSpl) is a BYPASS operation and is tested //! in compress_only/invalid_extension_state.rs. It succeeds with invalid extension //! state because it exits compressed state without creating new compressed accounts. -use light_token_interface::state::TokenDataVersion; -use light_ctoken_sdk::{ - ctoken::{CompressibleParams, CreateCTokenAccount, TransferCTokenChecked, TransferSplToCtoken}, - spl_interface::find_spl_interface_pda_with_index, -}; use light_program_test::utils::assert::assert_rpc_error; use light_test_utils::{ mint_2022::{ @@ -21,6 +16,11 @@ use light_test_utils::{ }, Rpc, }; +use light_token_interface::state::TokenDataVersion; +use light_token_sdk::{ + spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferSplToToken, TransferTokenChecked}, +}; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -63,7 +63,7 @@ async fn setup_ctoken_accounts_for_transfer( // Create source CToken account let account_a_keypair = Keypair::new(); let account_a_pubkey = account_a_keypair.pubkey(); - let create_a_ix = CreateCTokenAccount::new( + let create_a_ix = CreateTokenAccount::new( payer.pubkey(), account_a_pubkey, mint_pubkey, @@ -102,7 +102,7 @@ async fn setup_ctoken_accounts_for_transfer( // Create destination CToken account let account_b_keypair = Keypair::new(); let account_b_pubkey = account_b_keypair.pubkey(); - let create_b_ix = CreateCTokenAccount::new( + let create_b_ix = CreateTokenAccount::new( payer.pubkey(), account_b_pubkey, mint_pubkey, @@ -142,7 +142,7 @@ async fn setup_ctoken_accounts_for_transfer( let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_spl_to_ctoken_ix = TransferSplToCtoken { + let transfer_spl_to_ctoken_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -188,7 +188,7 @@ async fn test_ctoken_transfer_fails_when_mint_paused() { pause_mint(&mut context.rpc, &mint_pubkey).await; // Attempt transfer - should fail with MintPaused - let transfer_ix = TransferCTokenChecked { + let transfer_ix = TransferTokenChecked { source, mint: mint_pubkey, destination, @@ -235,7 +235,7 @@ async fn test_ctoken_transfer_fails_with_non_zero_transfer_fee() { set_mint_transfer_fee(&mut context.rpc, &mint_pubkey, 100, 1000).await; // Attempt transfer - should fail with NonZeroTransferFeeNotSupported - let transfer_ix = TransferCTokenChecked { + let transfer_ix = TransferTokenChecked { source, mint: mint_pubkey, destination, @@ -283,7 +283,7 @@ async fn test_ctoken_transfer_fails_with_non_nil_transfer_hook() { set_mint_transfer_hook(&mut context.rpc, &mint_pubkey, dummy_hook_program).await; // Attempt transfer - should fail with TransferHookNotSupported - let transfer_ix = TransferCTokenChecked { + let transfer_ix = TransferTokenChecked { source, mint: mint_pubkey, destination, @@ -309,7 +309,7 @@ async fn test_ctoken_transfer_fails_with_non_nil_transfer_hook() { } // ============================================================================ -// SPL → CToken Transfer Tests (TransferSplToCtoken) +// SPL → CToken Transfer Tests (TransferSplToToken) // These should FAIL when extension state is invalid (entering compressed state) // ============================================================================ @@ -340,7 +340,7 @@ async fn setup_spl_to_ctoken_accounts( let ctoken_keypair = Keypair::new(); let ctoken_pubkey = ctoken_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), ctoken_pubkey, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), ctoken_pubkey, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc @@ -390,7 +390,7 @@ async fn test_spl_to_ctoken_fails_when_mint_paused() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: 100_000_000, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -432,7 +432,7 @@ async fn test_spl_to_ctoken_fails_with_non_zero_transfer_fee() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: 100_000_000, spl_interface_pda_bump, source_spl_token_account: spl_account, diff --git a/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs b/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs index e7e018ae2b..294abf8a12 100644 --- a/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs +++ b/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs @@ -4,14 +4,14 @@ //! for both basic mints and Token-2022 mints with extensions. use anchor_lang::AnchorDeserialize; -use light_token_interface::state::{AccountState, Token, TokenDataVersion}; -use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount, FreezeCToken, ThawCToken}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{ assert_ctoken_freeze_thaw::{assert_ctoken_freeze, assert_ctoken_thaw}, spl::create_mint_helper, Rpc, RpcError, }; +use light_token_interface::state::{AccountState, Token, TokenDataVersion}; +use light_token_sdk::token::{CompressibleParams, CreateTokenAccount, FreezeToken, ThawToken}; use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -46,7 +46,7 @@ async fn test_freeze_thaw_with_basic_mint() -> Result<(), RpcError> { compression_only: false, }; - let create_ix = CreateCTokenAccount::new( + let create_ix = CreateTokenAccount::new( payer.pubkey(), token_account_pubkey, mint_pubkey, @@ -74,7 +74,7 @@ async fn test_freeze_thaw_with_basic_mint() -> Result<(), RpcError> { ); // 3. Freeze the account - let freeze_ix = FreezeCToken { + let freeze_ix = FreezeToken { token_account: token_account_pubkey, mint: mint_pubkey, freeze_authority: payer.pubkey(), @@ -89,7 +89,7 @@ async fn test_freeze_thaw_with_basic_mint() -> Result<(), RpcError> { assert_ctoken_freeze(&mut rpc, token_account_pubkey).await; // 5. Thaw the account - let thaw_ix = ThawCToken { + let thaw_ix = ThawToken { token_account: token_account_pubkey, mint: mint_pubkey, freeze_authority: payer.pubkey(), @@ -122,7 +122,7 @@ async fn test_freeze_thaw_with_extensions() -> Result<(), RpcError> { let account_pubkey = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), account_pubkey, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc @@ -170,7 +170,7 @@ async fn test_freeze_thaw_with_extensions() -> Result<(), RpcError> { ); // 2. Freeze the account - let freeze_ix = FreezeCToken { + let freeze_ix = FreezeToken { token_account: account_pubkey, mint: mint_pubkey, freeze_authority: payer.pubkey(), @@ -187,7 +187,7 @@ async fn test_freeze_thaw_with_extensions() -> Result<(), RpcError> { assert_ctoken_freeze(&mut context.rpc, account_pubkey).await; // 4. Thaw the account - let thaw_ix = ThawCToken { + let thaw_ix = ThawToken { token_account: account_pubkey, mint: mint_pubkey, freeze_authority: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/ctoken/functional.rs b/program-tests/compressed-token-test/tests/ctoken/functional.rs index 35bed84705..aae658a0d1 100644 --- a/program-tests/compressed-token-test/tests/ctoken/functional.rs +++ b/program-tests/compressed-token-test/tests/ctoken/functional.rs @@ -22,7 +22,7 @@ async fn test_spl_sdk_compatible_account_lifecycle() -> Result<(), RpcError> { compression_only: false, }; - let create_ix = CreateCTokenAccount::new( + let create_ix = CreateTokenAccount::new( payer_pubkey, token_account_pubkey, context.mint_pubkey, @@ -71,7 +71,7 @@ async fn test_spl_sdk_compatible_account_lifecycle() -> Result<(), RpcError> { let destination_pubkey = destination_keypair.pubkey(); // Close account using SPL SDK compatible instruction - let close_account_ix = CloseCTokenAccount::new( + let close_account_ix = CloseTokenAccount::new( light_compressed_token::ID, token_account_pubkey, destination_pubkey, @@ -156,7 +156,7 @@ async fn test_compressible_account_with_compression_authority_lifecycle() { compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, token_account_pubkey, context.mint_pubkey, @@ -302,7 +302,7 @@ async fn test_compressible_account_with_compression_authority_lifecycle() { .unwrap(); // Close compressible account using owner - let close_account_ix = CloseCTokenAccount::new( + let close_account_ix = CloseTokenAccount::new( light_compressed_token::ID, token_account_pubkey, destination.pubkey(), // destination for user funds diff --git a/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs b/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs index 49203ee490..663d672c76 100644 --- a/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs +++ b/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs @@ -1,7 +1,7 @@ -use light_ctoken_sdk::ctoken::{ +use light_test_utils::assert_create_token_account::assert_create_associated_token_account; +use light_token_sdk::token::{ CloseCTokenAccount, CompressibleParams, CreateAssociatedCTokenAccount, }; -use light_test_utils::assert_create_token_account::assert_create_associated_token_account; use super::shared::*; @@ -119,7 +119,7 @@ async fn test_associated_token_account_operations() { // Test closing compressible ATA let (compressible_ata_pubkey, _) = - derive_ctoken_ata(&compressible_owner_pubkey, &context.mint_pubkey); + derive_token_ata(&compressible_owner_pubkey, &context.mint_pubkey); // Create a separate destination account let destination = Keypair::new(); @@ -274,7 +274,7 @@ async fn test_create_ata_with_prefunded_lamports() { let owner_pubkey = context.owner_keypair.pubkey(); // Derive ATA address - let (ata, bump) = derive_ctoken_ata(&owner_pubkey, &context.mint_pubkey); + let (ata, bump) = derive_token_ata(&owner_pubkey, &context.mint_pubkey); // Pre-fund the ATA address with lamports (simulating attacker donation DoS attempt) let prefund_amount = 1_000; // 1000 lamports @@ -401,7 +401,7 @@ async fn test_create_token_account_with_prefunded_lamports() { compression_only: false, // Must be false for non-restricted mints (non-ATA accounts) }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, token_account_pubkey, context.mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/ctoken/shared.rs b/program-tests/compressed-token-test/tests/ctoken/shared.rs index 082a445e55..48cd99e15b 100644 --- a/program-tests/compressed-token-test/tests/ctoken/shared.rs +++ b/program-tests/compressed-token-test/tests/ctoken/shared.rs @@ -1,9 +1,5 @@ // Re-export all necessary imports for test modules pub use light_compressible::rent::{RentConfig, SLOTS_PER_EPOCH}; -pub use light_ctoken_sdk::ctoken::{ - derive_ctoken_ata, ApproveCToken, CloseCTokenAccount, CompressibleParams, - CreateAssociatedCTokenAccount, CreateCTokenAccount, RevokeCToken, -}; pub use light_program_test::{ forester::compress_and_close_forester, program_test::TestRpc, LightProgramTest, ProgramTestConfig, @@ -21,6 +17,10 @@ pub use light_test_utils::{ pub use light_token_client::{ actions::transfer2::compress, instructions::transfer2::CompressInput, }; +pub use light_token_sdk::token::{ + derive_token_ata, ApproveToken, CloseTokenAccount, CompressibleParams, + CreateAssociatedTokenAccount, CreateTokenAccount, RevokeToken, +}; pub use serial_test::serial; pub use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; /// Shared test context for account operations @@ -98,7 +98,7 @@ pub async fn create_and_assert_token_account( compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, token_account_pubkey, context.mint_pubkey, @@ -154,7 +154,7 @@ pub async fn create_and_assert_token_account_fails( compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, token_account_pubkey, context.mint_pubkey, @@ -232,7 +232,7 @@ pub async fn create_non_compressible_token_account( compression_only: false, }; - let create_ix = CreateCTokenAccount::new( + let create_ix = CreateTokenAccount::new( payer_pubkey, token_account_pubkey, context.mint_pubkey, @@ -302,7 +302,7 @@ pub async fn close_and_assert_token_account( .expect("CToken should have Compressible extension"); let rent_sponsor = Pubkey::from(compressible.info.rent_sponsor); - let close_ix = CloseCTokenAccount { + let close_ix = CloseTokenAccount { token_program: light_compressed_token::ID, account: token_account_pubkey, destination, @@ -349,7 +349,7 @@ pub async fn close_and_assert_token_account_fails( let payer_pubkey = context.payer.pubkey(); let token_account_pubkey = context.token_account_keypair.pubkey(); - let mut close_ix = CloseCTokenAccount { + let mut close_ix = CloseTokenAccount { token_program: light_compressed_token::ID, account: token_account_pubkey, destination, @@ -386,7 +386,7 @@ pub async fn create_and_assert_ata( let owner_pubkey = context.owner_keypair.pubkey(); // Derive ATA address - let (ata_pubkey, bump) = derive_ctoken_ata(&owner_pubkey, &context.mint_pubkey); + let (ata_pubkey, bump) = derive_token_ata(&owner_pubkey, &context.mint_pubkey); // Build instruction based on whether it's compressible let create_ata_ix = if let Some(compressible) = compressible_data.as_ref() { @@ -401,7 +401,7 @@ pub async fn create_and_assert_ata( }; let mut builder = - CreateAssociatedCTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) + CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) .with_compressible(compressible_params); if idempotent { @@ -411,7 +411,7 @@ pub async fn create_and_assert_ata( builder.instruction().unwrap() } else { // Create account with default compressible params (ATAs use default_ata) - let mut builder = CreateAssociatedCTokenAccount { + let mut builder = CreateAssociatedTokenAccount { idempotent: false, bump, payer: payer_pubkey, @@ -477,7 +477,7 @@ pub async fn create_and_assert_ata_fails( }; let mut builder = - CreateAssociatedCTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) + CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) .with_compressible(compressible_params); if idempotent { @@ -656,12 +656,12 @@ pub async fn compress_and_close_forester_with_invalid_output( use anchor_lang::{InstructionData, ToAccountMetas}; use light_compressible::config::CompressibleConfig; - use light_token_interface::state::Token; use light_registry::{ accounts::CompressAndCloseContext as CompressAndCloseAccounts, instruction::CompressAndClose, utils::get_forester_epoch_pda_from_authority, }; use light_sdk::instruction::PackedAccounts; + use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; use solana_sdk::instruction::Instruction; @@ -739,7 +739,7 @@ pub async fn compress_and_close_forester_with_invalid_output( }; // Add system accounts - use light_ctoken_sdk::compressed_token::compress_and_close::CompressAndCloseAccounts as CTokenCompressAndCloseAccounts; + use light_token_sdk::compressed_token::compress_and_close::CompressAndCloseAccounts as CTokenCompressAndCloseAccounts; let config = CTokenCompressAndCloseAccounts { compressed_token_program: compressed_token_program_id, cpi_authority_pda: Pubkey::find_program_address( @@ -894,8 +894,8 @@ pub async fn approve_and_assert( ) { println!("Approve initiated for: {}", name); - // Use light-ctoken-sdk - let approve_ix = ApproveCToken { + // Use light-token-sdk + let approve_ix = ApproveToken { token_account: context.token_account_keypair.pubkey(), delegate, owner: context.owner_keypair.pubkey(), @@ -939,7 +939,7 @@ pub async fn approve_and_assert_fails( println!("Approve (expecting failure) initiated for: {}", name); // Build using SDK, then modify if needed for max_top_up - let mut instruction = ApproveCToken { + let mut instruction = ApproveToken { token_account, delegate, owner: authority.pubkey(), @@ -969,8 +969,8 @@ pub async fn approve_and_assert_fails( pub async fn revoke_and_assert(context: &mut AccountTestContext, name: &str) { println!("Revoke initiated for: {}", name); - // Use light-ctoken-sdk - let revoke_ix = RevokeCToken { + // Use light-token-sdk + let revoke_ix = RevokeToken { token_account: context.token_account_keypair.pubkey(), owner: context.owner_keypair.pubkey(), } @@ -1003,7 +1003,7 @@ pub async fn revoke_and_assert_fails( println!("Revoke (expecting failure) initiated for: {}", name); // Build using SDK, then modify if needed for max_top_up - let mut instruction = RevokeCToken { + let mut instruction = RevokeToken { token_account, owner: authority.pubkey(), } @@ -1101,4 +1101,4 @@ pub async fn setup_account_test_with_spl_mint( } // Note: Token-2022 mint setup is more complex and requires additional handling. -// Tests for Token-2022 mints are covered in sdk-tests/sdk-ctoken-test/tests/test_transfer_checked.rs +// Tests for Token-2022 mints are covered in sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs diff --git a/program-tests/compressed-token-test/tests/ctoken/spl_instruction_compat.rs b/program-tests/compressed-token-test/tests/ctoken/spl_instruction_compat.rs index c1be0813c9..e98c8c3ded 100644 --- a/program-tests/compressed-token-test/tests/ctoken/spl_instruction_compat.rs +++ b/program-tests/compressed-token-test/tests/ctoken/spl_instruction_compat.rs @@ -424,9 +424,9 @@ async fn test_spl_instruction_compatibility() { #[serial] #[allow(deprecated)] async fn test_spl_instruction_compatibility_with_cmint() { - use light_ctoken_sdk::compressed_token::create_compressed_mint::find_cmint_address; use light_program_test::ProgramTestConfig; use light_token_client::instructions::mint_action::DecompressMintParams; + use light_token_sdk::compressed_token::create_compressed_mint::find_cmint_address; // Set up test environment let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) diff --git a/program-tests/compressed-token-test/tests/ctoken/transfer.rs b/program-tests/compressed-token-test/tests/ctoken/transfer.rs index bac0cd44cf..74a147c69c 100644 --- a/program-tests/compressed-token-test/tests/ctoken/transfer.rs +++ b/program-tests/compressed-token-test/tests/ctoken/transfer.rs @@ -585,7 +585,7 @@ async fn test_ctoken_transfer_max_top_up_exceeded() { // Transfer Checked Helper Functions // ============================================================================ -use light_ctoken_sdk::ctoken::TransferCTokenChecked; +use light_token_sdk::token::TransferTokenChecked; /// Setup context with two token accounts for transfer_checked tests using a real SPL Token mint async fn setup_transfer_checked_test_with_spl_mint( @@ -617,7 +617,7 @@ async fn setup_transfer_checked_test_with_spl_mint( compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, source_pubkey, context.mint_pubkey, @@ -651,7 +651,7 @@ async fn setup_transfer_checked_test_with_spl_mint( compression_only: false, }; - let create_token_account_ix = CreateCTokenAccount::new( + let create_token_account_ix = CreateTokenAccount::new( payer_pubkey, destination_pubkey, context.mint_pubkey, @@ -720,7 +720,7 @@ async fn transfer_checked_and_assert( let payer_pubkey = context.payer.pubkey(); - let transfer_ix = TransferCTokenChecked { + let transfer_ix = TransferTokenChecked { source, mint, destination, @@ -761,7 +761,7 @@ async fn transfer_checked_and_assert_fails( let payer_pubkey = context.payer.pubkey(); - let transfer_ix = TransferCTokenChecked { + let transfer_ix = TransferTokenChecked { source, mint, destination, @@ -808,7 +808,7 @@ async fn test_ctoken_transfer_checked_with_spl_mint() { .await; } -// Note: Token-2022 mint tests are covered in sdk-tests/sdk-ctoken-test/tests/test_transfer_checked.rs +// Note: Token-2022 mint tests are covered in sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs // The T22 mint requires additional setup (extensions, token pool, etc.) that is handled there. #[tokio::test] @@ -933,7 +933,7 @@ async fn test_ctoken_transfer_checked_max_top_up_exceeded() { let owner_keypair = context.owner_keypair.insecure_clone(); let payer_pubkey = context.payer.pubkey(); - let transfer_ix = TransferCTokenChecked { + let transfer_ix = TransferTokenChecked { source, mint, destination, diff --git a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs b/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs index 1a5cf50270..8c42b141c1 100644 --- a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs +++ b/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs @@ -4,20 +4,20 @@ //! TransferFee, TransferHook) cannot use CTokenTransfer and must use CTokenTransferChecked. use anchor_spl::token_2022::spl_token_2022; -use light_token_interface::state::TokenDataVersion; -use light_ctoken_sdk::{ - ctoken::{ - CompressibleParams, CreateCTokenAccount, TransferCToken, TransferCTokenChecked, - TransferSplToCtoken, - }, - spl_interface::find_spl_interface_pda_with_index, -}; use light_program_test::utils::assert::assert_rpc_error; use light_test_utils::{ assert_ctoken_transfer::assert_ctoken_transfer, mint_2022::{create_token_22_account, mint_spl_tokens_22}, Rpc, }; +use light_token_interface::state::TokenDataVersion; +use light_token_sdk::{ + spl_interface::find_spl_interface_pda_with_index, + token::{ + CompressibleParams, CreateTokenAccount, TransferSplToToken, TransferToken, + TransferTokenChecked, + }, +}; use serial_test::serial; use solana_sdk::{native_token::LAMPORTS_PER_SOL, signature::Keypair, signer::Signer}; @@ -57,7 +57,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { let account_a_keypair = Keypair::new(); let account_a_pubkey = account_a_keypair.pubkey(); - let create_a_ix = CreateCTokenAccount::new( + let create_a_ix = CreateTokenAccount::new( payer.pubkey(), account_a_pubkey, mint_pubkey, @@ -96,7 +96,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { let account_b_keypair = Keypair::new(); let account_b_pubkey = account_b_keypair.pubkey(); - let create_b_ix = CreateCTokenAccount::new( + let create_b_ix = CreateTokenAccount::new( payer.pubkey(), account_b_pubkey, mint_pubkey, @@ -136,7 +136,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_spl_to_ctoken_ix = TransferSplToCtoken { + let transfer_spl_to_ctoken_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -160,7 +160,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { // Step 4: Try CTokenTransfer (discriminator 3) - should FAIL with MintRequiredForTransfer (6128) let transfer_amount = 500_000_000u64; - let transfer_ix = TransferCToken { + let transfer_ix = TransferToken { source: account_a_pubkey, destination: account_b_pubkey, amount: transfer_amount, @@ -181,7 +181,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { println!("CTokenTransfer correctly rejected with MintRequiredForTransfer (6128)"); // Step 5: Use CTokenTransferChecked (discriminator 12) - should SUCCEED - let transfer_checked_ix = TransferCTokenChecked { + let transfer_checked_ix = TransferTokenChecked { source: account_a_pubkey, mint: mint_pubkey, destination: account_b_pubkey, diff --git a/program-tests/compressed-token-test/tests/freeze/compress_only.rs b/program-tests/compressed-token-test/tests/freeze/compress_only.rs index 6e5be329eb..019a3e0e9b 100644 --- a/program-tests/compressed-token-test/tests/freeze/compress_only.rs +++ b/program-tests/compressed-token-test/tests/freeze/compress_only.rs @@ -7,15 +7,6 @@ use light_client::indexer::{CompressedTokenAccount, Indexer}; use light_compressed_token::freeze::sdk::{ create_instruction, CreateInstructionInputs as FreezeInputs, }; -use light_token_interface::{ - instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, - state::TokenDataVersion, -}; -use light_ctoken_sdk::{ - compat::{AccountState, TokenDataWithMerkleContext}, - ctoken::{CompressibleParams, CreateCTokenAccount, TransferSplToCtoken}, - spl_interface::find_spl_interface_pda_with_index, -}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use light_test_utils::{ conversions::sdk_to_program_token_data, @@ -28,6 +19,15 @@ use light_test_utils::{ use light_token_client::instructions::transfer2::{ create_generic_transfer2_instruction, DecompressInput, Transfer2InstructionType, }; +use light_token_interface::{ + instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, + state::TokenDataVersion, +}; +use light_token_sdk::{ + compat::{AccountState, TokenDataWithMerkleContext}, + ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + spl_interface::find_spl_interface_pda_with_index, +}; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; use spl_token_2022::extension::ExtensionType; @@ -185,7 +185,7 @@ async fn run_freeze_thaw_compressed_only_test( let ctoken_account = account_keypair.pubkey(); let create_ix = - CreateCTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) + CreateTokenAccount::new(payer.pubkey(), ctoken_account, mint_pubkey, owner.pubkey()) .with_compressible(CompressibleParams { compressible_config: context .rpc @@ -217,7 +217,7 @@ async fn run_freeze_thaw_compressed_only_test( .any(|ext| RESTRICTED_EXTENSIONS.contains(ext)); let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToCtoken { + let transfer_ix = TransferSplToToken { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -331,7 +331,7 @@ async fn run_freeze_thaw_compressed_only_test( // 11. Create destination CToken account for decompress let dest_account_keypair = Keypair::new(); - let create_dest_ix = CreateCTokenAccount::new( + let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), dest_account_keypair.pubkey(), mint_pubkey, diff --git a/program-tests/compressed-token-test/tests/freeze/functional.rs b/program-tests/compressed-token-test/tests/freeze/functional.rs index 6ae6be2b35..c8bf027e3b 100644 --- a/program-tests/compressed-token-test/tests/freeze/functional.rs +++ b/program-tests/compressed-token-test/tests/freeze/functional.rs @@ -7,8 +7,6 @@ use light_client::indexer::{CompressedTokenAccount, Indexer}; use light_compressed_token::freeze::sdk::{ create_instruction, CreateInstructionInputs as FreezeInputs, }; -use light_token_interface::state::TokenDataVersion; -use light_ctoken_sdk::compat::{AccountState, TokenDataWithMerkleContext}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_prover_client::prover::spawn_prover; use light_test_utils::{ @@ -16,6 +14,8 @@ use light_test_utils::{ spl::create_mint_22_helper, Rpc, RpcError, }; use light_token_client::actions::transfer2::{compress_with_version, decompress}; +use light_token_interface::state::TokenDataVersion; +use light_token_sdk::compat::{AccountState, TokenDataWithMerkleContext}; use serial_test::serial; use solana_sdk::{program_pack::Pack, pubkey::Pubkey, signature::Keypair, signer::Signer}; diff --git a/program-tests/compressed-token-test/tests/mint/burn.rs b/program-tests/compressed-token-test/tests/mint/burn.rs index 1f946ac144..18133081e6 100644 --- a/program-tests/compressed-token-test/tests/mint/burn.rs +++ b/program-tests/compressed-token-test/tests/mint/burn.rs @@ -1,11 +1,11 @@ -use light_token_interface::instructions::mint_action::Recipient; -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, - ctoken::{derive_ctoken_ata, BurnCToken, CreateAssociatedCTokenAccount}, -}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{assert_ctoken_burn::assert_ctoken_burn, Rpc}; use light_token_client::instructions::mint_action::DecompressMintParams; +use light_token_interface::instructions::mint_action::Recipient; +use light_token_sdk::{ + compressed_token::create_compressed_mint::find_cmint_address, + token::{derive_token_ata, BurnToken, CreateAssociatedTokenAccount}, +}; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -40,10 +40,10 @@ async fn setup_burn_test(mint_amount: u64) -> BurnTestContext { let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); // Step 1: Create CToken ATA for owner first (needed before minting) - let (ctoken_ata, _) = derive_ctoken_ata(&owner_keypair.pubkey(), &cmint_pda); + let (ctoken_ata, _) = derive_token_ata(&owner_keypair.pubkey(), &cmint_pda); let create_ata_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), owner_keypair.pubkey(), cmint_pda) + CreateAssociatedTokenAccount::new(payer.pubkey(), owner_keypair.pubkey(), cmint_pda) .instruction() .unwrap(); @@ -94,7 +94,7 @@ async fn test_ctoken_burn() { let mut ctx = setup_burn_test(1000).await; // First burn: 500 tokens (half) - let burn_ix_1 = BurnCToken { + let burn_ix_1 = BurnToken { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 500, @@ -116,7 +116,7 @@ async fn test_ctoken_burn() { assert_ctoken_burn(&mut ctx.rpc, ctx.ctoken_account, ctx.cmint_pda, 500).await; // Second burn: 500 tokens (remaining half) - let burn_ix_2 = BurnCToken { + let burn_ix_2 = BurnToken { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 500, diff --git a/program-tests/compressed-token-test/tests/mint/cpi_context.rs b/program-tests/compressed-token-test/tests/mint/cpi_context.rs index e90d30d7f4..53dafe0510 100644 --- a/program-tests/compressed-token-test/tests/mint/cpi_context.rs +++ b/program-tests/compressed-token-test/tests/mint/cpi_context.rs @@ -2,6 +2,8 @@ use anchor_lang::InstructionData; use compressed_token_test::ID as WRAPPER_PROGRAM_ID; use light_client::indexer::Indexer; use light_compressed_account::instruction_data::traits::LightInstructionData; +use light_program_test::{utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig}; +use light_test_utils::Rpc; use light_token_interface::{ instructions::mint_action::{ CompressedMintInstructionData, CompressedMintWithContext, CpiContext, DecompressMintAction, @@ -10,15 +12,13 @@ use light_token_interface::{ state::CompressedMintMetadata, CMINT_ADDRESS_TREE, LIGHT_TOKEN_PROGRAM_ID, }; -use light_ctoken_sdk::compressed_token::{ +use light_token_sdk::compressed_token::{ create_compressed_mint::{derive_cmint_compressed_address, find_cmint_address}, mint_action::{ get_mint_action_instruction_account_metas_cpi_write, MintActionMetaConfig, MintActionMetaConfigCpiWrite, }, }; -use light_program_test::{utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig}; -use light_test_utils::Rpc; use light_verifier::CompressedProof; use serial_test::serial; use solana_sdk::{ diff --git a/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs b/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs index d4546c5271..6fe75f09ec 100644 --- a/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs +++ b/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs @@ -1,10 +1,10 @@ -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, - ctoken::{derive_ctoken_ata, CTokenMintTo, CreateAssociatedCTokenAccount}, -}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{assert_ctoken_mint_to::assert_ctoken_mint_to, Rpc}; use light_token_client::instructions::mint_action::DecompressMintParams; +use light_token_sdk::{ + compressed_token::create_compressed_mint::find_cmint_address, + token::{derive_token_ata, CreateAssociatedTokenAccount, TokenMintTo}, +}; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -38,10 +38,10 @@ async fn setup_mint_to_test() -> MintToTestContext { let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); // Step 1: Create CToken ATA for owner first - let (ctoken_ata, _) = derive_ctoken_ata(&owner_keypair.pubkey(), &cmint_pda); + let (ctoken_ata, _) = derive_token_ata(&owner_keypair.pubkey(), &cmint_pda); let create_ata_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), owner_keypair.pubkey(), cmint_pda) + CreateAssociatedTokenAccount::new(payer.pubkey(), owner_keypair.pubkey(), cmint_pda) .instruction() .unwrap(); @@ -49,7 +49,7 @@ async fn setup_mint_to_test() -> MintToTestContext { .await .unwrap(); - // Step 2: Create compressed mint + CMint (no recipients - we'll mint via CTokenMintTo) + // Step 2: Create compressed mint + CMint (no recipients - we'll mint via TokenMintTo) light_token_client::actions::mint_action_comprehensive( &mut rpc, &mint_seed, @@ -89,7 +89,7 @@ async fn test_ctoken_mint_to() { let mut ctx = setup_mint_to_test().await; // First mint: 500 tokens - let mint_ix_1 = CTokenMintTo { + let mint_ix_1 = TokenMintTo { cmint: ctx.cmint_pda, destination: ctx.ctoken_account, amount: 500, @@ -111,7 +111,7 @@ async fn test_ctoken_mint_to() { assert_ctoken_mint_to(&mut ctx.rpc, ctx.ctoken_account, ctx.cmint_pda, 500).await; // Second mint: 500 tokens - let mint_ix_2 = CTokenMintTo { + let mint_ix_2 = TokenMintTo { cmint: ctx.cmint_pda, destination: ctx.ctoken_account, amount: 500, @@ -153,7 +153,7 @@ async fn test_ctoken_mint_to() { // MintTo Checked Tests // ============================================================================ -use light_ctoken_sdk::ctoken::CTokenMintToChecked; +use light_token_sdk::token::TokenMintToChecked; #[tokio::test] #[serial] @@ -161,7 +161,7 @@ async fn test_ctoken_mint_to_checked_success() { let mut ctx = setup_mint_to_test().await; // Mint 500 tokens with correct decimals (8) - let mint_ix = CTokenMintToChecked { + let mint_ix = TokenMintToChecked { cmint: ctx.cmint_pda, destination: ctx.ctoken_account, amount: 500, @@ -203,7 +203,7 @@ async fn test_ctoken_mint_to_checked_wrong_decimals() { let mut ctx = setup_mint_to_test().await; // Try to mint with wrong decimals (7 instead of 8) - let mint_ix = CTokenMintToChecked { + let mint_ix = TokenMintToChecked { cmint: ctx.cmint_pda, destination: ctx.ctoken_account, amount: 500, diff --git a/program-tests/compressed-token-test/tests/mint/edge_cases.rs b/program-tests/compressed-token-test/tests/mint/edge_cases.rs index cb58e4d3c2..3930c34e02 100644 --- a/program-tests/compressed-token-test/tests/mint/edge_cases.rs +++ b/program-tests/compressed-token-test/tests/mint/edge_cases.rs @@ -1,14 +1,5 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::indexer::Indexer; -use light_token_interface::state::{ - extensions::AdditionalMetadata, CompressedMint, TokenDataVersion, -}; -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, - ctoken::{CompressibleParams, CreateAssociatedCTokenAccount}, -}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{ assert_mint_action::assert_mint_action, mint_assert::assert_compressed_mint_account, Rpc, @@ -17,6 +8,15 @@ use light_token_client::{ actions::create_mint, instructions::mint_action::{MintActionType, MintToRecipient}, }; +use light_token_interface::state::{ + extensions::AdditionalMetadata, CompressedMint, TokenDataVersion, +}; +use light_token_sdk::{ + compressed_token::create_compressed_mint::{ + derive_cmint_compressed_address, find_cmint_address, + }, + token::{CompressibleParams, CreateAssociatedTokenAccount}, +}; use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -163,7 +163,7 @@ async fn functional_all_in_one_instruction() { }; let create_compressible_ata_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda) + CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda) .with_compressible(compressible_params) .instruction() .unwrap(); @@ -184,11 +184,7 @@ async fn functional_all_in_one_instruction() { }, // 2. MintToCToken - mint to decompressed account MintActionType::MintToCToken { - account: light_ctoken_sdk::ctoken::derive_ctoken_ata( - &recipient.pubkey(), - &spl_mint_pda, - ) - .0, + account: light_token_sdk::token::derive_token_ata(&recipient.pubkey(), &spl_mint_pda).0, amount: 2000u64, }, // 3. UpdateMintAuthority diff --git a/program-tests/compressed-token-test/tests/mint/failing.rs b/program-tests/compressed-token-test/tests/mint/failing.rs index 0dc6bdd64b..e2c2017e80 100644 --- a/program-tests/compressed-token-test/tests/mint/failing.rs +++ b/program-tests/compressed-token-test/tests/mint/failing.rs @@ -2,13 +2,6 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::indexer::Indexer; -use light_token_interface::state::{extensions::AdditionalMetadata, CompressedMint}; -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, - ctoken::{CompressibleParams, CreateAssociatedCTokenAccount}, -}; use light_program_test::{utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig}; use light_test_utils::{ assert_mint_action::assert_mint_action, mint_assert::assert_compressed_mint_account, Rpc, @@ -17,6 +10,13 @@ use light_token_client::{ actions::create_mint, instructions::mint_action::{MintActionType, MintToRecipient}, }; +use light_token_interface::state::{extensions::AdditionalMetadata, CompressedMint}; +use light_token_sdk::{ + compressed_token::create_compressed_mint::{ + derive_cmint_compressed_address, find_cmint_address, + }, + token::{CompressibleParams, CreateAssociatedTokenAccount}, +}; use serial_test::serial; use solana_sdk::{ instruction::{AccountMeta, Instruction}, @@ -406,7 +406,7 @@ async fn functional_and_failing_tests() { let recipient = Keypair::new(); let create_ata_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda) + CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda) .instruction() .unwrap(); @@ -461,7 +461,7 @@ async fn functional_and_failing_tests() { let recipient2 = Keypair::new(); let create_ata_ix2 = - CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient2.pubkey(), spl_mint_pda) + CreateAssociatedTokenAccount::new(payer.pubkey(), recipient2.pubkey(), spl_mint_pda) .instruction() .unwrap(); @@ -470,7 +470,7 @@ async fn functional_and_failing_tests() { .unwrap(); let recipient_ata = - light_ctoken_sdk::ctoken::derive_ctoken_ata(&recipient2.pubkey(), &spl_mint_pda).0; + light_token_sdk::token::derive_token_ata(&recipient2.pubkey(), &spl_mint_pda).0; // Try to mint with valid NEW authority (since we updated it) let result = light_token_client::actions::mint_action_comprehensive( @@ -820,7 +820,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { state::TokenDataVersion, LIGHT_TOKEN_PROGRAM_ID, }; - use light_ctoken_sdk::compressed_token::{ + use light_token_sdk::compressed_token::{ create_compressed_mint::derive_cmint_compressed_address, mint_action::MintActionMetaConfig, }; @@ -874,7 +874,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { }; let create_ata_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda) + CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda) .with_compressible(compressible_params) .instruction() .unwrap(); @@ -883,8 +883,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { .await .unwrap(); - let ctoken_ata = - light_ctoken_sdk::ctoken::derive_ctoken_ata(&recipient.pubkey(), &spl_mint_pda).0; + let ctoken_ata = light_token_sdk::token::derive_token_ata(&recipient.pubkey(), &spl_mint_pda).0; // 3. Build MintToCToken instruction with max_top_up = 1 (too low) // Get current compressed mint state @@ -1026,9 +1025,9 @@ async fn test_create_mint_non_signer_mint_signer() { #[serial] async fn test_compress_and_close_cmint_must_be_only_action() { use light_compressible::rent::SLOTS_PER_EPOCH; - use light_ctoken_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address; use light_program_test::program_test::TestRpc; use light_token_client::instructions::mint_action::DecompressMintParams; + use light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address; let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) .await diff --git a/program-tests/compressed-token-test/tests/mint/functional.rs b/program-tests/compressed-token-test/tests/mint/functional.rs index 53a0840c4f..f6babf9671 100644 --- a/program-tests/compressed-token-test/tests/mint/functional.rs +++ b/program-tests/compressed-token-test/tests/mint/functional.rs @@ -1,22 +1,6 @@ use anchor_lang::{prelude::borsh::BorshDeserialize, solana_program::program_pack::Pack}; use light_client::indexer::Indexer; use light_compressible::{compression_info::CompressionInfo, rent::SLOTS_PER_EPOCH}; -use light_token_interface::{ - instructions::{ - extensions::token_metadata::TokenMetadataInstructionData, mint_action::Recipient, - }, - state::{ - extensions::AdditionalMetadata, BaseMint, CompressedMint, CompressedMintMetadata, - TokenDataVersion, ACCOUNT_TYPE_MINT, - }, - COMPRESSED_MINT_SEED, -}; -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, - ctoken::{derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount}, -}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use light_test_utils::{ assert_ctoken_transfer::assert_ctoken_transfer, @@ -39,6 +23,22 @@ use light_token_client::{ }, }, }; +use light_token_interface::{ + instructions::{ + extensions::token_metadata::TokenMetadataInstructionData, mint_action::Recipient, + }, + state::{ + extensions::AdditionalMetadata, BaseMint, CompressedMint, CompressedMintMetadata, + TokenDataVersion, ACCOUNT_TYPE_MINT, + }, + COMPRESSED_MINT_SEED, +}; +use light_token_sdk::{ + compressed_token::create_compressed_mint::{ + derive_cmint_compressed_address, find_cmint_address, + }, + token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, +}; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -216,8 +216,8 @@ async fn test_create_compressed_mint() { // 5. Decompress compressed tokens to ctokens // Create non-compressible token associated token account for decompression - let (ctoken_ata_pubkey, bump) = derive_ctoken_ata(&new_recipient, &spl_mint_pda); - let create_ata_instruction = CreateAssociatedCTokenAccount { + let (ctoken_ata_pubkey, bump) = derive_token_ata(&new_recipient, &spl_mint_pda); + let create_ata_instruction = CreateAssociatedTokenAccount { idempotent: false, bump, payer: payer.pubkey(), @@ -418,13 +418,13 @@ async fn test_create_compressed_mint() { let compress_from_spl_recipient = Keypair::new(); // Create SPL token account for compression source - let (compress_source_ata, _) = derive_ctoken_ata(&new_recipient, &spl_mint_pda); + let (compress_source_ata, _) = derive_token_ata(&new_recipient, &spl_mint_pda); // This already exists from our previous test // Create non-compressible SPL token account for decompression destination let (decompress_dest_ata, decompress_bump) = - derive_ctoken_ata(&decompress_recipient.pubkey(), &spl_mint_pda); - let create_decompress_ata_instruction = CreateAssociatedCTokenAccount { + derive_token_ata(&decompress_recipient.pubkey(), &spl_mint_pda); + let create_decompress_ata_instruction = CreateAssociatedTokenAccount { idempotent: false, bump: decompress_bump, payer: payer.pubkey(), @@ -690,7 +690,7 @@ async fn test_ctoken_transfer() { let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); // Create compressed token ATA for recipient - let (recipient_ata, _) = derive_ctoken_ata(&recipient_keypair.pubkey(), &spl_mint_pda); + let (recipient_ata, _) = derive_token_ata(&recipient_keypair.pubkey(), &spl_mint_pda); let compressible_params = CompressibleParams { compressible_config: rpc .test_accounts @@ -704,14 +704,11 @@ async fn test_ctoken_transfer() { compression_only: true, }; - let create_ata_instruction = CreateAssociatedCTokenAccount::new( - payer.pubkey(), - recipient_keypair.pubkey(), - spl_mint_pda, - ) - .with_compressible(compressible_params) - .instruction() - .unwrap(); + let create_ata_instruction = + CreateAssociatedTokenAccount::new(payer.pubkey(), recipient_keypair.pubkey(), spl_mint_pda) + .with_compressible(compressible_params) + .instruction() + .unwrap(); rpc.create_and_send_transaction(&[create_ata_instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); @@ -765,13 +762,13 @@ async fn test_ctoken_transfer() { // === CREATE SECOND RECIPIENT FOR TRANSFER TEST === let second_recipient_keypair = Keypair::new(); let (second_recipient_ata, second_recipient_ata_bump) = - derive_ctoken_ata(&second_recipient_keypair.pubkey(), &spl_mint_pda); + derive_token_ata(&second_recipient_keypair.pubkey(), &spl_mint_pda); rpc.airdrop_lamports(&second_recipient_keypair.pubkey(), 10_000_000_000) .await .unwrap(); - let create_second_ata_instruction = CreateAssociatedCTokenAccount { + let create_second_ata_instruction = CreateAssociatedTokenAccount { idempotent: false, bump: second_recipient_ata_bump, payer: payer.pubkey(), @@ -1053,7 +1050,7 @@ async fn test_create_compressed_mint_with_token_metadata() { &light_compressed_token::ID, ); let compressed_mint_address = - light_ctoken_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address( + light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address( &mint_seed.pubkey(), &address_tree_pubkey, ); diff --git a/program-tests/compressed-token-test/tests/mint/random.rs b/program-tests/compressed-token-test/tests/mint/random.rs index 6b22343ec4..dbb61cbbdc 100644 --- a/program-tests/compressed-token-test/tests/mint/random.rs +++ b/program-tests/compressed-token-test/tests/mint/random.rs @@ -1,13 +1,6 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_batched_merkle_tree::initialize_state_tree::InitStateTreeAccountsInstructionData; use light_client::indexer::Indexer; -use light_token_interface::state::{extensions::AdditionalMetadata, CompressedMint}; -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, - ctoken::CreateAssociatedCTokenAccount, -}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{ assert_mint_action::assert_mint_action, mint_assert::assert_compressed_mint_account, Rpc, @@ -16,6 +9,13 @@ use light_token_client::{ actions::create_mint, instructions::mint_action::{MintActionType, MintToRecipient}, }; +use light_token_interface::state::{extensions::AdditionalMetadata, CompressedMint}; +use light_token_sdk::{ + compressed_token::create_compressed_mint::{ + derive_cmint_compressed_address, find_cmint_address, + }, + token::CreateAssociatedTokenAccount, +}; use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -131,7 +131,7 @@ async fn test_random_mint_action() { for _ in 0..5 { let recipient = Keypair::new(); let create_ata_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda) + CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda) .instruction() .unwrap(); @@ -139,7 +139,7 @@ async fn test_random_mint_action() { .await .unwrap(); - let ata = light_ctoken_sdk::ctoken::derive_ctoken_ata(&recipient.pubkey(), &spl_mint_pda).0; + let ata = light_token_sdk::token::derive_token_ata(&recipient.pubkey(), &spl_mint_pda).0; ctoken_atas.push(ata); } diff --git a/program-tests/compressed-token-test/tests/token_pool.rs b/program-tests/compressed-token-test/tests/token_pool.rs index fd65411630..59b41cc46f 100644 --- a/program-tests/compressed-token-test/tests/token_pool.rs +++ b/program-tests/compressed-token-test/tests/token_pool.rs @@ -11,15 +11,15 @@ use light_compressed_token::{ mint_sdk::create_create_token_pool_instruction, process_transfer::get_cpi_authority_pda, spl_compression::check_spl_token_pool_derivation_with_index, ErrorCode, }; -use light_token_interface::{ - find_spl_interface_pda, find_spl_interface_pda_with_index, has_restricted_extensions, -}; -use light_ctoken_sdk::spl_interface::CreateSplInterfacePda; use light_program_test::{utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig}; use light_test_utils::{ spl::{create_additional_token_pools, create_mint_22_helper, create_mint_helper}, Rpc, RpcError, }; +use light_token_interface::{ + find_spl_interface_pda, find_spl_interface_pda_with_index, has_restricted_extensions, +}; +use light_token_sdk::spl_interface::CreateSplInterfacePda; use serial_test::serial; use solana_sdk::{ instruction::Instruction, diff --git a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs index f02bc53fea..285220d1b8 100644 --- a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs @@ -35,10 +35,15 @@ // 1. create and mint to one ctoken compressed account // +use light_program_test::{ + utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, Rpc, +}; +use light_sdk::instruction::PackedAccounts; +use light_test_utils::RpcError; use light_token_interface::{ instructions::mint_action::Recipient, state::TokenDataVersion, TokenError, }; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::{ create_compressed_mint::find_cmint_address, transfer2::{ @@ -47,14 +52,9 @@ use light_ctoken_sdk::{ }, CTokenAccount2, }, - ctoken::{derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount}, + ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, ValidityProof, }; -use light_program_test::{ - utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, Rpc, -}; -use light_sdk::instruction::PackedAccounts; -use light_test_utils::RpcError; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; // ============================================================================ // Test Setup @@ -89,7 +89,7 @@ async fn setup_compression_test(token_amount: u64) -> Result Result<(), RpcError> { // Derive mint and ATA addresses let (mint, _) = find_cmint_address(&mint_seed.pubkey()); - let (ctoken_ata, _) = derive_ctoken_ata(&owner.pubkey(), &mint); + let (ctoken_ata, _) = derive_token_ata(&owner.pubkey(), &mint); // Create compressible CToken ATA with pre_pay_num_epochs = 0 (NO prepaid rent) // This means any write operation will require immediate rent top-up diff --git a/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs b/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs index baba769d27..4023ce3ef3 100644 --- a/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs @@ -29,7 +29,16 @@ // 5.3. recipient out of bounds use anchor_spl::token_2022::spl_token_2022; -use light_ctoken_sdk::{ +use light_program_test::{utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig}; +use light_sdk::instruction::PackedAccounts; +use light_test_utils::{ + airdrop_lamports, + spl::{ + create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, + }, + Rpc, RpcError, +}; +use light_token_sdk::{ compressed_token::{ transfer2::{ account_metas::Transfer2AccountsMetaConfig, create_transfer2_instruction, @@ -37,19 +46,10 @@ use light_ctoken_sdk::{ }, CTokenAccount2, }, - ctoken::{derive_ctoken_ata, CreateAssociatedCTokenAccount}, + ctoken::{derive_token_ata, CreateAssociatedCTokenAccount}, spl_interface::find_spl_interface_pda_with_index, ValidityProof, }; -use light_program_test::{utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig}; -use light_sdk::instruction::PackedAccounts; -use light_test_utils::{ - airdrop_lamports, - spl::{ - create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, - }, - Rpc, RpcError, -}; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; use spl_pod::bytemuck::pod_from_bytes; use spl_token_2022::{error::TokenError, pod::PodAccount}; @@ -111,7 +111,7 @@ async fn setup_spl_compression_test( rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await?; - let ctoken_ata = derive_ctoken_ata(&recipient.pubkey(), &mint).0; + let ctoken_ata = derive_token_ata(&recipient.pubkey(), &mint).0; // Get output queue for compression (for system_accounts_offset calculation only) let output_queue = rpc diff --git a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs index 5f003bc7f8..37e8cb1933 100644 --- a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs @@ -32,11 +32,16 @@ // use light_client::indexer::{CompressedTokenAccount, Indexer}; +use light_program_test::{ + utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, Rpc, +}; +use light_sdk::instruction::PackedAccounts; +use light_test_utils::RpcError; use light_token_interface::{ instructions::{mint_action::Recipient, transfer2::MultiInputTokenDataWithContext}, state::TokenDataVersion, }; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::{ create_compressed_mint::find_cmint_address, transfer2::{ @@ -45,14 +50,9 @@ use light_ctoken_sdk::{ }, CTokenAccount2, }, - ctoken::{derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount}, + ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, ValidityProof, }; -use light_program_test::{ - utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, Rpc, -}; -use light_sdk::instruction::PackedAccounts; -use light_test_utils::RpcError; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; // ============================================================================ @@ -89,7 +89,7 @@ async fn setup_decompression_test( // Derive mint and ATA addresses let (mint, _) = find_cmint_address(&mint_seed.pubkey()); - let (ctoken_ata, _) = derive_ctoken_ata(&owner.pubkey(), &mint); + let (ctoken_ata, _) = derive_token_ata(&owner.pubkey(), &mint); // Create compressible CToken ATA for owner (recipient of decompression) let compressible_params = CompressibleParams { diff --git a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs index cb6e0f565f..993afab3fa 100644 --- a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs @@ -43,17 +43,17 @@ // // ============================================================================ -use light_token_interface::instructions::{mint_action::Recipient, transfer2::Compression}; -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, - ctoken::{derive_ctoken_ata, CreateAssociatedCTokenAccount}, - ValidityProof, -}; use light_program_test::{ utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, Rpc, }; use light_sdk::instruction::PackedAccounts; use light_test_utils::{airdrop_lamports, RpcError}; +use light_token_interface::instructions::{mint_action::Recipient, transfer2::Compression}; +use light_token_sdk::{ + compressed_token::create_compressed_mint::find_cmint_address, + ctoken::{derive_token_ata, CreateAssociatedCTokenAccount}, + ValidityProof, +}; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; // ============================================================================ @@ -102,8 +102,8 @@ async fn setup_no_system_program_cpi_test( // Create compressed mint seed let mint_seed = Keypair::new(); let (mint, _) = find_cmint_address(&mint_seed.pubkey()); - let (source_ata, _) = derive_ctoken_ata(&owner.pubkey(), &mint); - let (recipient_ata, _) = derive_ctoken_ata(&recipient.pubkey(), &mint); + let (source_ata, _) = derive_token_ata(&owner.pubkey(), &mint); + let (recipient_ata, _) = derive_token_ata(&recipient.pubkey(), &mint); // Create CToken ATA for owner (source) let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) @@ -708,8 +708,8 @@ async fn test_too_many_mints() { // Create new mint seed let mint_seed = Keypair::new(); let (mint, _) = find_cmint_address(&mint_seed.pubkey()); - let (source_ata, _) = derive_ctoken_ata(&context.owner.pubkey(), &mint); - let (recipient_ata, _) = derive_ctoken_ata(&context.recipient.pubkey(), &mint); + let (source_ata, _) = derive_token_ata(&context.owner.pubkey(), &mint); + let (recipient_ata, _) = derive_token_ata(&context.recipient.pubkey(), &mint); // Create source ATA let instruction = CreateAssociatedCTokenAccount::new( diff --git a/program-tests/compressed-token-test/tests/transfer2/shared.rs b/program-tests/compressed-token-test/tests/transfer2/shared.rs index f4203a3846..09be15f9d1 100644 --- a/program-tests/compressed-token-test/tests/transfer2/shared.rs +++ b/program-tests/compressed-token-test/tests/transfer2/shared.rs @@ -2,14 +2,6 @@ use std::collections::HashMap; use anchor_lang::AnchorDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; -use light_token_interface::{ - instructions::{mint_action::Recipient, transfer2::CompressedTokenInstructionDataTransfer2}, - state::TokenDataVersion, -}; -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, - ctoken::{CompressibleParams, CreateAssociatedCTokenAccount}, -}; use light_program_test::{indexer::TestIndexerExtensions, LightProgramTest, ProgramTestConfig}; use light_test_utils::{ airdrop_lamports, @@ -29,6 +21,14 @@ use light_token_client::{ }, }, }; +use light_token_interface::{ + instructions::{mint_action::Recipient, transfer2::CompressedTokenInstructionDataTransfer2}, + state::TokenDataVersion, +}; +use light_token_sdk::{ + compressed_token::create_compressed_mint::find_cmint_address, + ctoken::{CompressibleParams, CreateAssociatedCTokenAccount}, +}; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer, transaction::Transaction}; // ============================================================================ @@ -444,7 +444,7 @@ impl TestContext { .unwrap_or(&false); // Create CToken ATA (compressible or regular based on requirements) - let (ata, bump) = light_ctoken_sdk::ctoken::derive_ctoken_ata(&signer.pubkey(), &mint); + let (ata, bump) = light_token_sdk::token::derive_token_ata(&signer.pubkey(), &mint); let create_ata_ix = if is_compressible { println!( @@ -494,7 +494,7 @@ impl TestContext { // Get the compressed mint address let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - light_ctoken_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address( + light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address( &mint_seed.pubkey(), &address_tree_pubkey, ); diff --git a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs index 2bffda8ade..d880e52d22 100644 --- a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs +++ b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs @@ -1,11 +1,21 @@ use anchor_lang::prelude::{AccountMeta, ProgramError}; // Re-export all necessary imports for test modules pub use anchor_spl::token_2022::spl_token_2022; +use light_program_test::utils::assert::assert_rpc_error; +pub use light_program_test::{LightProgramTest, ProgramTestConfig}; +pub use light_test_utils::{ + airdrop_lamports, + spl::{ + create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, + }, + Rpc, RpcError, +}; +pub use light_token_client::actions::transfer2::{self}; use light_token_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; -pub use light_ctoken_sdk::ctoken::{ - derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount, +pub use light_token_sdk::token::{ + derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount, }; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::{ transfer2::{ create_transfer2_instruction, Transfer2AccountsMetaConfig, Transfer2Config, @@ -16,16 +26,6 @@ use light_ctoken_sdk::{ spl_interface::find_spl_interface_pda_with_index, ValidityProof, }; -use light_program_test::utils::assert::assert_rpc_error; -pub use light_program_test::{LightProgramTest, ProgramTestConfig}; -pub use light_test_utils::{ - airdrop_lamports, - spl::{ - create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, - }, - Rpc, RpcError, -}; -pub use light_token_client::actions::transfer2::{self}; use solana_sdk::pubkey::Pubkey; pub use solana_sdk::{instruction::Instruction, signature::Keypair, signer::Signer}; pub use spl_token_2022::pod::PodAccount; @@ -78,7 +78,7 @@ async fn test_spl_to_ctoken_transfer() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let associated_token_account = derive_ctoken_ata(&recipient.pubkey(), &mint).0; + let associated_token_account = derive_token_ata(&recipient.pubkey(), &mint).0; // Get initial SPL token balance let spl_account_data = rpc @@ -243,7 +243,7 @@ async fn test_failing_ctoken_to_spl_with_compress_and_close() { .unwrap(); // Create compressible token ATA for recipient (ATAs require compression_only=true) - let (associated_token_account, bump) = derive_ctoken_ata(&recipient.pubkey(), &mint); + let (associated_token_account, bump) = derive_token_ata(&recipient.pubkey(), &mint); let instruction = CreateAssociatedCTokenAccount { idempotent: false, bump, diff --git a/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs b/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs index 8a3cc5ae56..59ca09d704 100644 --- a/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs @@ -5,11 +5,17 @@ // ============================================================================ use light_client::indexer::{CompressedTokenAccount, Indexer}; +use light_program_test::{ + utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, Rpc, +}; +use light_sdk::instruction::PackedAccounts; +use light_test_utils::{airdrop_lamports, RpcError}; +use light_token_client::actions::{create_mint, mint_to_compressed, transfer2::approve}; use light_token_interface::{ instructions::{mint_action::Recipient, transfer2::MultiInputTokenDataWithContext}, state::TokenDataVersion, }; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::{ transfer2::{ account_metas::Transfer2AccountsMetaConfig, create_transfer2_instruction, @@ -19,12 +25,6 @@ use light_ctoken_sdk::{ }, ValidityProof, }; -use light_program_test::{ - utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, Rpc, -}; -use light_sdk::instruction::PackedAccounts; -use light_test_utils::{airdrop_lamports, RpcError}; -use light_token_client::actions::{create_mint, mint_to_compressed, transfer2::approve}; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; // ============================================================================ // Test Setup @@ -72,7 +72,7 @@ async fn setup_transfer_test( ) .await?; - let mint = light_ctoken_sdk::compressed_token::create_compressed_mint::find_cmint_address( + let mint = light_token_sdk::compressed_token::create_compressed_mint::find_cmint_address( &mint_seed.pubkey(), ) .0; @@ -683,7 +683,7 @@ async fn setup_transfer_test_with_delegate( ) .await?; - let mint = light_ctoken_sdk::compressed_token::create_compressed_mint::find_cmint_address( + let mint = light_token_sdk::compressed_token::create_compressed_mint::find_cmint_address( &mint_seed.pubkey(), ) .0; diff --git a/program-tests/compressed-token-test/tests/v1.rs b/program-tests/compressed-token-test/tests/v1.rs index 2da8c5de6e..94ed30cfb2 100644 --- a/program-tests/compressed-token-test/tests/v1.rs +++ b/program-tests/compressed-token-test/tests/v1.rs @@ -37,7 +37,6 @@ use light_compressed_token::{ }, ErrorCode, TokenData, }; -use light_ctoken_sdk::compat::{AccountState, TokenDataWithMerkleContext}; use light_program_test::{ accounts::{test_accounts::TestAccounts, test_keypairs::TestKeypairs}, indexer::{TestIndexer, TestIndexerExtensions}, @@ -61,6 +60,7 @@ use light_test_utils::{ }, LightClient, Rpc, RpcError, }; +use light_token_sdk::compat::{AccountState, TokenDataWithMerkleContext}; use rand::{seq::SliceRandom, thread_rng, Rng}; use serial_test::serial; #[allow(deprecated)] @@ -5099,7 +5099,7 @@ async fn batch_compress_with_batched_tree() { .into(); assert_eq!(recipient_compressed_token_accounts.len(), 1); let recipient_compressed_token_account = &recipient_compressed_token_accounts[0]; - let expected_token_data = light_ctoken_sdk::compat::TokenData { + let expected_token_data = light_token_sdk::compat::TokenData { mint, owner: recipients[i as usize], amount: (i + 1), @@ -5166,7 +5166,7 @@ async fn batch_compress_with_batched_tree() { .into(); assert_eq!(recipient_compressed_token_accounts.len(), 1); let recipient_compressed_token_account = &recipient_compressed_token_accounts[0]; - let expected_token_data = light_ctoken_sdk::compat::TokenData { + let expected_token_data = light_token_sdk::compat::TokenData { mint, owner: *recipient, amount, diff --git a/program-tests/registry-test/Cargo.toml b/program-tests/registry-test/Cargo.toml index cd94fdd881..bddc0a4c2b 100644 --- a/program-tests/registry-test/Cargo.toml +++ b/program-tests/registry-test/Cargo.toml @@ -37,7 +37,7 @@ solana-sdk = { workspace = true } serial_test = { workspace = true } light-batched-merkle-tree = { workspace = true } light-account-checks = { workspace = true } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } light-compressible = { workspace = true } light-token-client = { workspace = true } light-token-interface = { workspace = true } diff --git a/program-tests/registry-test/tests/compressible.rs b/program-tests/registry-test/tests/compressible.rs index 75b80528da..976d372a02 100644 --- a/program-tests/registry-test/tests/compressible.rs +++ b/program-tests/registry-test/tests/compressible.rs @@ -10,20 +10,12 @@ use light_compressible::{ use light_token_interface::state::{extensions::ExtensionStruct, Token}; /// Extract CompressionInfo from Token's Compressible extension -fn get_ctoken_compression_info(ctoken: &Token) -> Option { - ctoken - .extensions - .as_ref()? - .iter() - .find_map(|ext| match ext { - ExtensionStruct::Compressible(comp) => Some(comp.info), - _ => None, - }) +fn get_token_compression_info(token: &Token) -> Option { + token.extensions.as_ref()?.iter().find_map(|ext| match ext { + ExtensionStruct::Compressible(comp) => Some(comp.info), + _ => None, + }) } -use light_ctoken_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, - ctoken::{derive_ctoken_ata, CTokenMintTo, CompressibleParams, CreateAssociatedCTokenAccount}, -}; use light_program_test::{ forester::claim_forester, program_test::TestRpc, utils::assert::assert_rpc_error, LightProgramTest, ProgramTestConfig, @@ -42,6 +34,10 @@ use light_token_client::{ }, instructions::mint_action::{DecompressMintParams, NewMint}, }; +use light_token_sdk::{ + compressed_token::create_compressed_mint::find_cmint_address, + token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount, TokenMintTo}, +}; use solana_sdk::{ instruction::Instruction, pubkey::Pubkey, @@ -502,7 +498,7 @@ async fn test_pause_compressible_config_with_valid_authority() -> Result<(), Rpc // Test 1: Cannot create new token accounts with paused config let compressible_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), payer.pubkey(), Pubkey::new_unique()) + CreateAssociatedTokenAccount::new(payer.pubkey(), payer.pubkey(), Pubkey::new_unique()) .with_compressible(CompressibleParams::default_ata()) .instruction() .map_err(|e| { @@ -623,7 +619,7 @@ async fn test_unpause_compressible_config_with_valid_authority() -> Result<(), R // Verify cannot create account while paused let compressible_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), payer.pubkey(), Pubkey::new_unique()) + CreateAssociatedTokenAccount::new(payer.pubkey(), payer.pubkey(), Pubkey::new_unique()) .with_compressible(CompressibleParams::default_ata()) .instruction() .map_err(|e| { @@ -670,7 +666,7 @@ async fn test_unpause_compressible_config_with_valid_authority() -> Result<(), R }; let compressible_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), payer.pubkey(), Pubkey::new_unique()) + CreateAssociatedTokenAccount::new(payer.pubkey(), payer.pubkey(), Pubkey::new_unique()) .with_compressible(compressible_params) .instruction() .map_err(|e| { @@ -760,7 +756,7 @@ async fn test_deprecate_compressible_config_with_valid_authority() -> Result<(), }; let compressible_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), token_account_keypair.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), token_account_keypair.pubkey(), mint) .with_compressible(compressible_params) .instruction() .map_err(|e| { @@ -808,7 +804,7 @@ async fn test_deprecate_compressible_config_with_valid_authority() -> Result<(), }; let compressible_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), token_account_keypair2.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), token_account_keypair2.pubkey(), mint) .with_compressible(compressible_params) .instruction() .map_err(|e| { @@ -853,7 +849,7 @@ async fn test_deprecate_compressible_config_with_valid_authority() -> Result<(), // Test 3: CAN claim rent with deprecated config let forester_keypair = rpc.test_accounts.protocol.forester.insecure_clone(); - let (ata_pubkey, _) = derive_ctoken_ata(&token_account_keypair.pubkey(), &mint); + let (ata_pubkey, _) = derive_token_ata(&token_account_keypair.pubkey(), &mint); // Claim from the account we created earlier let claim_result = claim_forester(&mut rpc, &[ata_pubkey], &forester_keypair, &payer).await; @@ -1130,11 +1126,11 @@ async fn assert_not_compressible( .get_minimum_balance_for_rent_exemption(account.data.len()) .await?; - let ctoken = Token::deserialize(&mut account.data.as_slice()) + let token = Token::deserialize(&mut account.data.as_slice()) .map_err(|e| RpcError::AssertRpcError(format!("Failed to deserialize Token: {:?}", e)))?; // Get CompressionInfo from the Compressible extension - let compression_info = get_ctoken_compression_info(&ctoken).ok_or_else(|| { + let compression_info = get_token_compression_info(&token).ok_or_else(|| { RpcError::AssertRpcError("Token should have Compressible extension".to_string()) })?; let current_slot = rpc.get_slot().await?; @@ -1236,8 +1232,8 @@ async fn assert_not_compressible_cmint( Ok(()) } -/// Helper function to mint tokens to a CToken account using CTokenMintTo instruction -async fn mint_to_ctoken( +/// Helper function to mint tokens to a CToken account using TokenMintTo instruction +async fn mint_to_token( rpc: &mut R, cmint: Pubkey, destination: Pubkey, @@ -1245,7 +1241,7 @@ async fn mint_to_ctoken( mint_authority: &Keypair, payer: &Keypair, ) -> Result { - let ix = CTokenMintTo { + let ix = TokenMintTo { cmint, destination, amount, @@ -1254,10 +1250,7 @@ async fn mint_to_ctoken( } .instruction() .map_err(|e| { - RpcError::CustomError(format!( - "Failed to create CTokenMintTo instruction: {:?}", - e - )) + RpcError::CustomError(format!("Failed to create TokenMintTo instruction: {:?}", e)) })?; rpc.create_and_send_transaction(&[ix], &payer.pubkey(), &[payer, mint_authority]) @@ -1353,9 +1346,9 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { .await .unwrap(); - // Mint initial tokens to Account A via CTokenMintTo (this also writes to the CMint, triggering top-up) + // Mint initial tokens to Account A via TokenMintTo (this also writes to the CMint, triggering top-up) let transfer_amount = 1_000_000u64; - mint_to_ctoken( + mint_to_token( &mut rpc, cmint_pda, account_a, @@ -1366,12 +1359,12 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { .await?; let account_a_data = rpc.get_account(account_a).await?.unwrap(); - let ctoken_a = Token::deserialize(&mut account_a_data.data.as_slice()) + let token_a = Token::deserialize(&mut account_a_data.data.as_slice()) .map_err(|e| RpcError::AssertRpcError(format!("Failed to deserialize Token: {:?}", e)))?; // CompressionInfo is accessed via the Compressible extension let compression = - get_ctoken_compression_info(&ctoken_a).expect("Token should have Compressible extension"); + get_token_compression_info(&token_a).expect("Token should have Compressible extension"); let rent_config = compression.rent_config; let account_size = account_a_data.data.len() as u64; @@ -1387,11 +1380,11 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { // Get initial slot and last_claimed_slot from both accounts let initial_slot = rpc.get_slot().await?; - let get_last_claimed_slot_ctoken = |account_data: &[u8]| -> Result { - let ctoken = Token::deserialize(&mut &account_data[..]).map_err(|e| { + let get_last_claimed_slot_token = |account_data: &[u8]| -> Result { + let token = Token::deserialize(&mut &account_data[..]).map_err(|e| { RpcError::AssertRpcError(format!("Failed to deserialize Token: {:?}", e)) })?; - let compression = get_ctoken_compression_info(&ctoken).ok_or_else(|| { + let compression = get_token_compression_info(&token).ok_or_else(|| { RpcError::AssertRpcError("Token should have Compressible extension".to_string()) })?; Ok(compression.last_claimed_slot) @@ -1407,9 +1400,9 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { }; let initial_last_claimed_a = - get_last_claimed_slot_ctoken(&rpc.get_account(account_a).await?.unwrap().data)?; + get_last_claimed_slot_token(&rpc.get_account(account_a).await?.unwrap().data)?; let initial_last_claimed_b = - get_last_claimed_slot_ctoken(&rpc.get_account(account_b).await?.unwrap().data)?; + get_last_claimed_slot_token(&rpc.get_account(account_b).await?.unwrap().data)?; let initial_last_claimed_cmint = get_last_claimed_slot_cmint(&rpc.get_account(cmint_pda).await?.unwrap().data)?; @@ -1470,7 +1463,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { // Mint 0 tokens every 10 iterations (once per epoch) to trigger CMint write_top_up // This keeps the CMint funded through its write_top_up mechanism - mint_to_ctoken(&mut rpc, cmint_pda, dest, 0, &mint_authority, &payer).await?; + mint_to_token(&mut rpc, cmint_pda, dest, 0, &mint_authority, &payer).await?; // Advance by 1/10 of an epoch (630 slots) let advance_slots = SLOTS_PER_EPOCH / 10; // 630 slots @@ -1498,9 +1491,9 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { // Get final last_claimed_slot from all accounts (CToken A, CToken B, CMint) let final_last_claimed_a = - get_last_claimed_slot_ctoken(&rpc.get_account(account_a).await?.unwrap().data)?; + get_last_claimed_slot_token(&rpc.get_account(account_a).await?.unwrap().data)?; let final_last_claimed_b = - get_last_claimed_slot_ctoken(&rpc.get_account(account_b).await?.unwrap().data)?; + get_last_claimed_slot_token(&rpc.get_account(account_b).await?.unwrap().data)?; let final_last_claimed_cmint = get_last_claimed_slot_cmint(&rpc.get_account(cmint_pda).await?.unwrap().data)?; @@ -1593,19 +1586,19 @@ async fn test_claim_from_cmint_account() -> Result<(), RpcError> { } #[tokio::test] -async fn test_claim_mixed_ctoken_and_cmint() -> Result<(), RpcError> { +async fn test_claim_mixed_token_and_cmint() -> Result<(), RpcError> { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) .await .unwrap(); let payer = rpc.get_payer().insecure_clone(); // Create CToken account with prepaid rent - let ctoken_owner = Keypair::new(); + let token_owner = Keypair::new(); let mint = Pubkey::new_unique(); - let ctoken_pubkey = create_compressible_token_account( + let token_pubkey = create_compressible_token_account( &mut rpc, CreateCompressibleTokenAccountInputs { - owner: ctoken_owner.pubkey(), + owner: token_owner.pubkey(), mint, num_prepaid_epochs: 5, payer: &payer, @@ -1655,7 +1648,7 @@ async fn test_claim_mixed_ctoken_and_cmint() -> Result<(), RpcError> { let forester_keypair = rpc.test_accounts.protocol.forester.insecure_clone(); claim_forester( &mut rpc, - &[ctoken_pubkey, cmint_pda], + &[token_pubkey, cmint_pda], &forester_keypair, &payer, ) @@ -1666,7 +1659,7 @@ async fn test_claim_mixed_ctoken_and_cmint() -> Result<(), RpcError> { let config = rpc.test_accounts.funding_pool_config; assert_claim( &mut rpc, - &[ctoken_pubkey, cmint_pda], + &[token_pubkey, cmint_pda], config.rent_sponsor_pda, config.compression_authority_pda, ) diff --git a/program-tests/system-cpi-test/Cargo.toml b/program-tests/system-cpi-test/Cargo.toml index 7d575c83c4..f470f74f97 100644 --- a/program-tests/system-cpi-test/Cargo.toml +++ b/program-tests/system-cpi-test/Cargo.toml @@ -24,7 +24,7 @@ default = ["custom-heap"] anchor-lang = { workspace = true } anchor-spl = { workspace = true } light-compressed-token = { workspace = true, features = ["cpi"] } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } light-system-program-anchor = { workspace = true, features = ["cpi"] } light-registry = { workspace = true, features = ["cpi"] } account-compression = { workspace = true, features = ["cpi"] } diff --git a/program-tests/system-cpi-test/tests/test.rs b/program-tests/system-cpi-test/tests/test.rs index 7f013d6c4b..9252a4cffc 100644 --- a/program-tests/system-cpi-test/tests/test.rs +++ b/program-tests/system-cpi-test/tests/test.rs @@ -18,7 +18,6 @@ use light_compressed_account::{ TreeType, }; use light_compressed_token::process_transfer::InputTokenDataWithContext; -use light_ctoken_sdk::compat::{AccountState, TokenDataWithMerkleContext}; use light_hasher::{Hasher, Poseidon}; use light_merkle_tree_metadata::errors::MerkleTreeMetadataError; use light_program_test::{ @@ -39,6 +38,7 @@ use light_test_utils::{ }, Rpc, RpcError, }; +use light_token_sdk::compat::{AccountState, TokenDataWithMerkleContext}; use light_verifier::VerifierError; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer, transaction::Transaction}; diff --git a/program-tests/utils/Cargo.toml b/program-tests/utils/Cargo.toml index 311508882a..f64af481e0 100644 --- a/program-tests/utils/Cargo.toml +++ b/program-tests/utils/Cargo.toml @@ -51,6 +51,6 @@ light-sparse-merkle-tree = { workspace = true } solana-banks-client = { workspace = true } light-zero-copy = { workspace = true } base64 = { workspace = true } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } light-token-client = { workspace = true } light-compressible = { workspace = true } diff --git a/program-tests/utils/src/assert_claim.rs b/program-tests/utils/src/assert_claim.rs index e5f103859f..470f3ac96d 100644 --- a/program-tests/utils/src/assert_claim.rs +++ b/program-tests/utils/src/assert_claim.rs @@ -1,8 +1,8 @@ use light_client::rpc::Rpc; +use light_program_test::LightProgramTest; use light_token_interface::state::{ - Token, CompressedMint, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, + CompressedMint, Token, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; -use light_program_test::LightProgramTest; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyAtMut}; use solana_sdk::{clock::Clock, pubkey::Pubkey}; diff --git a/program-tests/utils/src/assert_close_token_account.rs b/program-tests/utils/src/assert_close_token_account.rs index 8a2221e6df..81774cdb02 100644 --- a/program-tests/utils/src/assert_close_token_account.rs +++ b/program-tests/utils/src/assert_close_token_account.rs @@ -1,7 +1,7 @@ use light_client::rpc::Rpc; use light_compressible::rent::AccountRentState; -use light_token_interface::state::token::Token; use light_program_test::LightProgramTest; +use light_token_interface::state::token::Token; use light_zero_copy::traits::ZeroCopyAt; use solana_sdk::{pubkey::Pubkey, signer::Signer}; diff --git a/program-tests/utils/src/assert_create_token_account.rs b/program-tests/utils/src/assert_create_token_account.rs index e1da0539bc..fa04a54cf1 100644 --- a/program-tests/utils/src/assert_create_token_account.rs +++ b/program-tests/utils/src/assert_create_token_account.rs @@ -1,15 +1,15 @@ use light_client::rpc::Rpc; use light_compressible::{compression_info::CompressionInfo, rent::RentConfig}; +use light_program_test::LightProgramTest; use light_token_interface::{ state::{ - token::Token, extensions::CompressibleExtension, AccountState, ExtensionStruct, + extensions::CompressibleExtension, token::Token, AccountState, ExtensionStruct, PausableAccountExtension, PermanentDelegateAccountExtension, TransferFeeAccountExtension, TransferHookAccountExtension, ACCOUNT_TYPE_TOKEN_ACCOUNT, }, BASE_TOKEN_ACCOUNT_SIZE, }; -use light_ctoken_sdk::ctoken::derive_ctoken_ata; -use light_program_test::LightProgramTest; +use light_token_sdk::token::derive_token_ata; use light_zero_copy::traits::ZeroCopyAt; use solana_sdk::{program_pack::Pack, pubkey::Pubkey}; use spl_token_2022::{ @@ -404,7 +404,7 @@ pub async fn assert_create_associated_token_account( expected_extensions: Option>, ) { // Derive the associated token account address - let (ata_pubkey, _bump) = derive_ctoken_ata(&owner_pubkey, &mint_pubkey); + let (ata_pubkey, _bump) = derive_token_ata(&owner_pubkey, &mint_pubkey); // Verify the account exists at the derived address let account = rpc diff --git a/program-tests/utils/src/assert_ctoken_approve_revoke.rs b/program-tests/utils/src/assert_ctoken_approve_revoke.rs index 51002e36ed..dd579dba72 100644 --- a/program-tests/utils/src/assert_ctoken_approve_revoke.rs +++ b/program-tests/utils/src/assert_ctoken_approve_revoke.rs @@ -6,8 +6,8 @@ use anchor_lang::AnchorDeserialize; use light_client::rpc::Rpc; -use light_token_interface::state::Token; use light_program_test::LightProgramTest; +use light_token_interface::state::Token; use solana_sdk::pubkey::Pubkey; /// Assert that a CToken approve operation was successful. @@ -41,8 +41,8 @@ pub async fn assert_ctoken_approve( // Parse pre and post CToken states let pre_ctoken = Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = Token::deserialize(&mut &post_account.data[..]) - .expect("Failed to deserialize post CToken"); + let post_ctoken = + Token::deserialize(&mut &post_account.data[..]).expect("Failed to deserialize post CToken"); // Build expected by modifying only the changed fields from pre-state let expected_ctoken = Token { @@ -82,8 +82,8 @@ pub async fn assert_ctoken_revoke(rpc: &mut LightProgramTest, token_account: Pub // Parse pre and post CToken states let pre_ctoken = Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = Token::deserialize(&mut &post_account.data[..]) - .expect("Failed to deserialize post CToken"); + let post_ctoken = + Token::deserialize(&mut &post_account.data[..]).expect("Failed to deserialize post CToken"); // Build expected by modifying only the changed fields from pre-state let expected_ctoken = Token { diff --git a/program-tests/utils/src/assert_ctoken_burn.rs b/program-tests/utils/src/assert_ctoken_burn.rs index c6d473cf6d..10f3fd2b69 100644 --- a/program-tests/utils/src/assert_ctoken_burn.rs +++ b/program-tests/utils/src/assert_ctoken_burn.rs @@ -1,8 +1,8 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::rpc::Rpc; use light_compressible::compression_info::CompressionInfo; -use light_token_interface::state::{extensions::ExtensionStruct, Token, CompressedMint}; use light_program_test::LightProgramTest; +use light_token_interface::state::{extensions::ExtensionStruct, CompressedMint, Token}; use solana_sdk::pubkey::Pubkey; /// Extract CompressionInfo from CToken's Compressible extension diff --git a/program-tests/utils/src/assert_ctoken_freeze_thaw.rs b/program-tests/utils/src/assert_ctoken_freeze_thaw.rs index 23fbab5270..c4e28896ce 100644 --- a/program-tests/utils/src/assert_ctoken_freeze_thaw.rs +++ b/program-tests/utils/src/assert_ctoken_freeze_thaw.rs @@ -6,8 +6,8 @@ use anchor_lang::AnchorDeserialize; use light_client::rpc::Rpc; -use light_token_interface::state::{AccountState, Token}; use light_program_test::LightProgramTest; +use light_token_interface::state::{AccountState, Token}; use solana_sdk::pubkey::Pubkey; /// Assert that a CToken freeze operation was successful. @@ -34,8 +34,8 @@ pub async fn assert_ctoken_freeze(rpc: &mut LightProgramTest, token_account: Pub // Parse pre and post CToken states let pre_ctoken = Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = Token::deserialize(&mut &post_account.data[..]) - .expect("Failed to deserialize post CToken"); + let post_ctoken = + Token::deserialize(&mut &post_account.data[..]).expect("Failed to deserialize post CToken"); // Build expected by modifying only the changed fields from pre-state let expected_ctoken = Token { @@ -73,8 +73,8 @@ pub async fn assert_ctoken_thaw(rpc: &mut LightProgramTest, token_account: Pubke // Parse pre and post CToken states let pre_ctoken = Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = Token::deserialize(&mut &post_account.data[..]) - .expect("Failed to deserialize post CToken"); + let post_ctoken = + Token::deserialize(&mut &post_account.data[..]).expect("Failed to deserialize post CToken"); // Build expected by modifying only the changed fields from pre-state let expected_ctoken = Token { diff --git a/program-tests/utils/src/assert_ctoken_mint_to.rs b/program-tests/utils/src/assert_ctoken_mint_to.rs index 6551802a75..74dd8c3387 100644 --- a/program-tests/utils/src/assert_ctoken_mint_to.rs +++ b/program-tests/utils/src/assert_ctoken_mint_to.rs @@ -1,8 +1,8 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::rpc::Rpc; use light_compressible::compression_info::CompressionInfo; -use light_token_interface::state::{extensions::ExtensionStruct, Token, CompressedMint}; use light_program_test::LightProgramTest; +use light_token_interface::state::{extensions::ExtensionStruct, CompressedMint, Token}; use solana_sdk::pubkey::Pubkey; /// Extract CompressionInfo from CToken's Compressible extension diff --git a/program-tests/utils/src/assert_ctoken_transfer.rs b/program-tests/utils/src/assert_ctoken_transfer.rs index d1595cfbf9..ddb7e81ce0 100644 --- a/program-tests/utils/src/assert_ctoken_transfer.rs +++ b/program-tests/utils/src/assert_ctoken_transfer.rs @@ -1,7 +1,7 @@ use anchor_spl::token_2022::spl_token_2022::{self, solana_program::program_pack::Pack}; use light_client::rpc::Rpc; -use light_token_interface::state::Token; use light_program_test::LightProgramTest; +use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; use solana_sdk::pubkey::Pubkey; diff --git a/program-tests/utils/src/assert_metadata.rs b/program-tests/utils/src/assert_metadata.rs index 8a0366e4d8..6ad366dece 100644 --- a/program-tests/utils/src/assert_metadata.rs +++ b/program-tests/utils/src/assert_metadata.rs @@ -3,11 +3,11 @@ use light_client::{ indexer::{CompressedAccount, Indexer}, rpc::{Rpc, RpcError}, }; +use light_hasher::{sha256::Sha256BE, Hasher, HasherError}; use light_token_interface::state::{ extensions::{AdditionalMetadata, ExtensionStruct, TokenMetadata}, CompressedMint, }; -use light_hasher::{sha256::Sha256BE, Hasher, HasherError}; use solana_sdk::{pubkey::Pubkey, signature::Signature}; /// Expected metadata state for comprehensive testing diff --git a/program-tests/utils/src/assert_mint_action.rs b/program-tests/utils/src/assert_mint_action.rs index 7435ad9c51..90a6e03770 100644 --- a/program-tests/utils/src/assert_mint_action.rs +++ b/program-tests/utils/src/assert_mint_action.rs @@ -4,11 +4,11 @@ use anchor_lang::prelude::borsh::BorshDeserialize; use light_client::indexer::Indexer; use light_compressed_account::compressed_account::CompressedAccountData; use light_compressible::compression_info::CompressionInfo; -use light_token_interface::state::{ - extensions::AdditionalMetadata, Token, CompressedMint, ExtensionStruct, -}; use light_program_test::{LightProgramTest, Rpc}; use light_token_client::instructions::mint_action::MintActionType; +use light_token_interface::state::{ + extensions::AdditionalMetadata, CompressedMint, ExtensionStruct, Token, +}; use solana_sdk::pubkey::Pubkey; /// Extract CompressionInfo from CToken's Compressible extension diff --git a/program-tests/utils/src/assert_mint_to_compressed.rs b/program-tests/utils/src/assert_mint_to_compressed.rs index 979738e8a2..a432fb8d1b 100644 --- a/program-tests/utils/src/assert_mint_to_compressed.rs +++ b/program-tests/utils/src/assert_mint_to_compressed.rs @@ -8,7 +8,7 @@ use light_compressed_token::instructions::create_token_pool::find_token_pool_pda use light_token_interface::{ instructions::mint_action::Recipient, state::CompressedMint, LIGHT_TOKEN_PROGRAM_ID, }; -use light_ctoken_sdk::compressed_token::create_compressed_mint::derive_cmint_from_spl_mint; +use light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_from_spl_mint; use solana_sdk::{program_pack::Pack, pubkey::Pubkey}; pub async fn assert_mint_to_compressed( @@ -51,12 +51,12 @@ pub async fn assert_mint_to_compressed( }); // Create expected token data - let expected_token_data = light_ctoken_sdk::compat::TokenData { + let expected_token_data = light_token_sdk::compat::TokenData { mint: spl_mint_pda, owner: recipient_pubkey, amount: recipient.amount, delegate: None, - state: light_ctoken_sdk::compat::AccountState::Initialized, + state: light_token_sdk::compat::AccountState::Initialized, tlv: None, }; diff --git a/program-tests/utils/src/assert_token_tx.rs b/program-tests/utils/src/assert_token_tx.rs index 22a8a53cda..0d13b2c1f2 100644 --- a/program-tests/utils/src/assert_token_tx.rs +++ b/program-tests/utils/src/assert_token_tx.rs @@ -2,9 +2,9 @@ use anchor_lang::AnchorSerialize; use light_client::{indexer::Indexer, rpc::Rpc}; use light_compressed_account::compressed_account::CompressedAccountWithMerkleContext; use light_compressed_token::process_transfer::{get_cpi_authority_pda, TokenTransferOutputData}; -use light_ctoken_sdk::compat::TokenDataWithMerkleContext; use light_event::event::PublicTransactionEvent; use light_program_test::indexer::TestIndexerExtensions; +use light_token_sdk::compat::TokenDataWithMerkleContext; use solana_sdk::{program_pack::Pack, pubkey::Pubkey}; use crate::assert_compressed_tx::{ diff --git a/program-tests/utils/src/assert_transfer2.rs b/program-tests/utils/src/assert_transfer2.rs index 068f41264e..82e62952a2 100644 --- a/program-tests/utils/src/assert_transfer2.rs +++ b/program-tests/utils/src/assert_transfer2.rs @@ -2,11 +2,11 @@ use std::collections::HashMap; use anchor_spl::token_2022::spl_token_2022; use light_client::{indexer::Indexer, rpc::Rpc}; -use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_program_test::LightProgramTest; use light_token_client::instructions::transfer2::{ CompressInput, DecompressInput, Transfer2InstructionType, TransferInput, }; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use solana_sdk::{program_pack::Pack, pubkey::Pubkey}; use crate::{ @@ -89,12 +89,12 @@ pub async fn assert_transfer2_with_delegate( }; // Get mint from the source compressed token account - let expected_recipient_token_data = light_ctoken_sdk::compat::TokenData { + let expected_recipient_token_data = light_token_sdk::compat::TokenData { mint: source_mint, owner: transfer_input.to, amount: transfer_input.amount, delegate: None, - state: light_ctoken_sdk::compat::AccountState::Initialized, + state: light_token_sdk::compat::AccountState::Initialized, tlv: None, }; @@ -157,12 +157,12 @@ pub async fn assert_transfer2_with_delegate( None // No delegate to preserve }; - let expected_change_token = light_ctoken_sdk::compat::TokenData { + let expected_change_token = light_token_sdk::compat::TokenData { mint: source_mint, owner: source_owner, amount: change_amount, delegate: expected_delegate, - state: light_ctoken_sdk::compat::AccountState::Initialized, + state: light_token_sdk::compat::AccountState::Initialized, tlv: None, }; @@ -216,12 +216,12 @@ pub async fn assert_transfer2_with_delegate( None // Default to None if no authority specified }; - let expected_change_token = light_ctoken_sdk::compat::TokenData { + let expected_change_token = light_token_sdk::compat::TokenData { mint: source_mint, owner: source_owner, amount: change_amount, delegate: expected_delegate, - state: light_ctoken_sdk::compat::AccountState::Initialized, + state: light_token_sdk::compat::AccountState::Initialized, tlv: None, }; @@ -278,12 +278,12 @@ pub async fn assert_transfer2_with_delegate( .value .items; - let expected_change_token = light_ctoken_sdk::compat::TokenData { + let expected_change_token = light_token_sdk::compat::TokenData { mint: source_mint, owner: source_owner, amount: change_amount, delegate: Some(approve_input.delegate), - state: light_ctoken_sdk::compat::AccountState::Initialized, + state: light_token_sdk::compat::AccountState::Initialized, tlv: None, }; @@ -336,12 +336,12 @@ pub async fn assert_transfer2_with_delegate( .map(|accounts| accounts.iter().map(|a| a.token.amount).sum::()) .unwrap_or(0); - let expected_recipient_token_data = light_ctoken_sdk::compat::TokenData { + let expected_recipient_token_data = light_token_sdk::compat::TokenData { mint: compress_input.mint, owner: compress_input.to, amount: compress_input.amount + compressed_input_amount, delegate: None, - state: light_ctoken_sdk::compat::AccountState::Initialized, + state: light_token_sdk::compat::AccountState::Initialized, tlv: None, }; recipient_accounts.iter().for_each(|account| { @@ -451,9 +451,9 @@ pub async fn assert_transfer2_with_delegate( let is_frozen = pre_token_account.state == spl_token_2022::state::AccountState::Frozen; let expected_state = if is_frozen { - light_ctoken_sdk::compat::AccountState::Frozen + light_token_sdk::compat::AccountState::Frozen } else { - light_ctoken_sdk::compat::AccountState::Initialized + light_token_sdk::compat::AccountState::Initialized }; // Delegate is preserved from the original account @@ -488,7 +488,7 @@ pub async fn assert_transfer2_with_delegate( }; // Build expected token data for single assert comparison - let expected_token = light_ctoken_sdk::compat::TokenData { + let expected_token = light_token_sdk::compat::TokenData { mint: expected_mint, owner: expected_owner, amount: expected_amount, diff --git a/program-tests/utils/src/conversions.rs b/program-tests/utils/src/conversions.rs index bdff8659a4..38d6195181 100644 --- a/program-tests/utils/src/conversions.rs +++ b/program-tests/utils/src/conversions.rs @@ -83,26 +83,26 @@ use light_token_interface::state::{CompressedTokenAccountState, TokenData as Pro // } pub fn sdk_to_program_account_state( - sdk_state: light_ctoken_sdk::compat::AccountState, + sdk_state: light_token_sdk::compat::AccountState, ) -> CompressedTokenAccountState { match sdk_state { - light_ctoken_sdk::compat::AccountState::Initialized => { + light_token_sdk::compat::AccountState::Initialized => { CompressedTokenAccountState::Initialized } - light_ctoken_sdk::compat::AccountState::Frozen => CompressedTokenAccountState::Frozen, + light_token_sdk::compat::AccountState::Frozen => CompressedTokenAccountState::Frozen, } } -pub fn program_to_sdk_account_state(program_state: u8) -> light_ctoken_sdk::compat::AccountState { +pub fn program_to_sdk_account_state(program_state: u8) -> light_token_sdk::compat::AccountState { match program_state { - 0 => light_ctoken_sdk::compat::AccountState::Initialized, - 1 => light_ctoken_sdk::compat::AccountState::Frozen, + 0 => light_token_sdk::compat::AccountState::Initialized, + 1 => light_token_sdk::compat::AccountState::Frozen, _ => panic!("program_to_sdk_account_state: invalid account state"), } } pub fn sdk_to_program_token_data( - sdk_token: light_ctoken_sdk::compat::TokenData, + sdk_token: light_token_sdk::compat::TokenData, ) -> ProgramTokenData { ProgramTokenData { mint: sdk_token.mint.into(), @@ -116,8 +116,8 @@ pub fn sdk_to_program_token_data( pub fn program_to_sdk_token_data( program_token: ProgramTokenData, -) -> light_ctoken_sdk::compat::TokenData { - light_ctoken_sdk::compat::TokenData { +) -> light_token_sdk::compat::TokenData { + light_token_sdk::compat::TokenData { mint: program_token.mint.into(), owner: program_token.owner.into(), amount: program_token.amount, diff --git a/program-tests/utils/src/e2e_test_env.rs b/program-tests/utils/src/e2e_test_env.rs index 4025598554..6aefb38f94 100644 --- a/program-tests/utils/src/e2e_test_env.rs +++ b/program-tests/utils/src/e2e_test_env.rs @@ -120,7 +120,6 @@ use light_compressed_account::{ TreeType, }; use light_compressed_token::process_transfer::transfer_sdk::to_account_metas; -use light_ctoken_sdk::compat::{AccountState, TokenDataWithMerkleContext}; use light_hasher::{bigint::bigint_to_be_bytes_array, Poseidon}; use light_indexed_merkle_tree::{ array::IndexedArray, reference::IndexedMerkleTree, HIGHEST_ADDRESS_PLUS_ONE, @@ -155,6 +154,7 @@ use light_sdk::{ use light_sparse_merkle_tree::{ changelog::ChangelogEntry, indexed_changelog::IndexedChangelogEntry, SparseMerkleTree, }; +use light_token_sdk::compat::{AccountState, TokenDataWithMerkleContext}; use log::info; use num_bigint::{BigUint, RandBigInt}; use num_traits::Num; diff --git a/program-tests/utils/src/mint_2022.rs b/program-tests/utils/src/mint_2022.rs index b5ddff19e1..28d22ee040 100644 --- a/program-tests/utils/src/mint_2022.rs +++ b/program-tests/utils/src/mint_2022.rs @@ -6,7 +6,7 @@ use forester_utils::instructions::create_account::create_account_instruction; use light_client::rpc::Rpc; use light_token_interface::RESTRICTED_EXTENSION_TYPES; -use light_ctoken_sdk::spl_interface::{find_spl_interface_pda, CreateSplInterfacePda}; +use light_token_sdk::spl_interface::{find_spl_interface_pda, CreateSplInterfacePda}; use solana_sdk::{ instruction::Instruction, pubkey::Pubkey, diff --git a/program-tests/utils/src/spl.rs b/program-tests/utils/src/spl.rs index 5405a2cc41..a075c10cc3 100644 --- a/program-tests/utils/src/spl.rs +++ b/program-tests/utils/src/spl.rs @@ -28,10 +28,10 @@ use light_compressed_token::{ process_compress_spl_token_account::sdk::create_compress_spl_token_account_instruction, process_transfer::{transfer_sdk::create_transfer_instruction, TokenTransferOutputData}, }; -use light_token_interface::state::{CompressedTokenAccountState, TokenData}; -use light_ctoken_sdk::compat::TokenDataWithMerkleContext; use light_hasher::Poseidon; use light_program_test::{indexer::TestIndexerExtensions, program_test::TestRpc}; +use light_token_interface::state::{CompressedTokenAccountState, TokenData}; +use light_token_sdk::compat::TokenDataWithMerkleContext; use solana_banks_client::BanksClientError; use solana_sdk::{ instruction::Instruction, diff --git a/programs/compressed-token/anchor/src/process_transfer.rs b/programs/compressed-token/anchor/src/process_transfer.rs index 27477708e6..5cc8f31a78 100644 --- a/programs/compressed-token/anchor/src/process_transfer.rs +++ b/programs/compressed-token/anchor/src/process_transfer.rs @@ -11,11 +11,11 @@ use light_compressed_account::{ }, pubkey::AsPubkey, }; +use light_heap::{bench_sbf_end, bench_sbf_start}; +use light_system_program::account_traits::{InvokeAccounts, SignerAccounts}; use light_token_interface::state::{ CompressedTokenAccountState, ExtensionStruct, TokenData, TokenDataVersion, }; -use light_heap::{bench_sbf_end, bench_sbf_start}; -use light_system_program::account_traits::{InvokeAccounts, SignerAccounts}; use light_zero_copy::num_trait::ZeroCopyNumTrait; use crate::{ diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs b/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs index 7586153f4a..2f33cafb16 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs @@ -2,11 +2,11 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressible::config::CompressibleConfig; +use light_program_profiler::profile; use light_token_interface::{ instructions::mint_action::{ZAction, ZMintActionCompressedInstructionData}, CMINT_ADDRESS_TREE, }; -use light_program_profiler::profile; use light_zero_copy::U16; use pinocchio::{account_info::AccountInfo, pubkey::Pubkey}; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/compress_and_close_cmint.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/compress_and_close_cmint.rs index cc136a082c..3c2d8d330a 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/compress_and_close_cmint.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/compress_and_close_cmint.rs @@ -1,9 +1,9 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; +use light_program_profiler::profile; use light_token_interface::{ instructions::mint_action::ZCompressAndCloseCMintAction, state::CompressedMint, }; -use light_program_profiler::profile; use pinocchio::{ pubkey::pubkey_eq, sysvars::{clock::Clock, Sysvar}, diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs index b0365e088f..7672464c42 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/create_mint.rs @@ -1,11 +1,11 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_compressed_account::instruction_data::with_readonly::ZInstructionDataInvokeCpiWithReadOnlyMut; +use light_program_profiler::profile; use light_token_interface::{ instructions::mint_action::ZMintActionCompressedInstructionData, CMINT_ADDRESS_TREE, COMPRESSED_MINT_SEED, }; -use light_program_profiler::profile; use pinocchio::pubkey::pubkey_eq; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs index 3f3eb30474..a46f03c26e 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs @@ -2,10 +2,10 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_array_map::pubkey_eq; use light_compressible::compression_info::CompressionInfo; +use light_program_profiler::profile; use light_token_interface::{ instructions::mint_action::ZDecompressMintAction, state::CompressedMint, COMPRESSED_MINT_SEED, }; -use light_program_profiler::profile; use pinocchio::{ account_info::AccountInfo, instruction::Seed, diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to.rs index 287f6c5fe6..cdf372d35a 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to.rs @@ -1,12 +1,12 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_compressed_account::Pubkey; +use light_program_profiler::profile; +use light_sdk_pinocchio::instruction::ZOutputCompressedAccountWithPackedContextMut; use light_token_interface::{ hash_cache::HashCache, instructions::mint_action::ZMintToCompressedAction, state::CompressedMint, }; -use light_program_profiler::profile; -use light_sdk_pinocchio::instruction::ZOutputCompressedAccountWithPackedContextMut; use crate::{ compressed_token::mint_action::{accounts::MintActionAccounts, check_authority}, diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs index f1f1bd2820..475ed4cf1d 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs @@ -2,10 +2,8 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::Pubkey; -use light_token_interface::{ - instructions::mint_action::ZMintToTokenAction, state::CompressedMint, -}; use light_program_profiler::profile; +use light_token_interface::{instructions::mint_action::ZMintToTokenAction, state::CompressedMint}; use pinocchio::account_info::AccountInfo; use crate::compressed_token::{ diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs index 255f6da876..b245286df7 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs @@ -3,13 +3,13 @@ use anchor_lang::prelude::ProgramError; use arrayvec::ArrayVec; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::instruction_data::data::ZOutputCompressedAccountWithPackedContextMut; +use light_program_profiler::profile; use light_token_interface::{ hash_cache::HashCache, instructions::mint_action::{ZAction, ZMintActionCompressedInstructionData}, state::CompressedMint, TokenError, }; -use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/update_metadata.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/update_metadata.rs index d9b43f764a..592319f676 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/update_metadata.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/update_metadata.rs @@ -1,13 +1,13 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_compressed_account::Pubkey; +use light_program_profiler::profile; use light_token_interface::{ instructions::mint_action::{ ZRemoveMetadataKeyAction, ZUpdateMetadataAuthorityAction, ZUpdateMetadataFieldAction, }, state::{CompressedMint, ExtensionStruct, TokenMetadata}, }; -use light_program_profiler::profile; use spl_pod::solana_msg::msg; use crate::compressed_token::mint_action::check_authority; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/mint_input.rs b/programs/compressed-token/program/src/compressed_token/mint_action/mint_input.rs index 0a69bee2ef..7d03d9d96d 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/mint_input.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/mint_input.rs @@ -1,10 +1,10 @@ use anchor_lang::solana_program::program_error::ProgramError; use borsh::BorshSerialize; use light_compressed_account::instruction_data::with_readonly::ZInAccountMut; -use light_token_interface::state::CompressedMint; use light_hasher::{sha256::Sha256BE, Hasher}; use light_program_profiler::profile; use light_sdk::instruction::PackedMerkleContext; +use light_token_interface::state::CompressedMint; use light_zero_copy::U16; use crate::{ diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/mint_output.rs b/programs/compressed-token/program/src/compressed_token/mint_action/mint_output.rs index b4536898ef..0840bad7a1 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/mint_output.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/mint_output.rs @@ -3,12 +3,12 @@ use anchor_lang::prelude::ProgramError; use borsh::BorshSerialize; use light_compressed_account::instruction_data::data::ZOutputCompressedAccountWithPackedContextMut; use light_compressible::rent::get_rent_exemption_lamports; +use light_hasher::{sha256::Sha256BE, Hasher}; +use light_program_profiler::profile; use light_token_interface::{ hash_cache::HashCache, instructions::mint_action::ZMintActionCompressedInstructionData, state::CompressedMint, }; -use light_hasher::{sha256::Sha256BE, Hasher}; -use light_program_profiler::profile; use pinocchio::sysvars::{clock::Clock, Sysvar}; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/processor.rs b/programs/compressed-token/program/src/compressed_token/mint_action/processor.rs index b8d6783c15..eb0ec33f5f 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/processor.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/processor.rs @@ -1,11 +1,11 @@ use anchor_compressed_token::{is_idempotent_early_exit, ErrorCode}; use anchor_lang::prelude::ProgramError; use light_compressed_account::instruction_data::with_readonly::InstructionDataInvokeCpiWithReadOnly; +use light_sdk::instruction::PackedMerkleContext; use light_token_interface::{ hash_cache::HashCache, instructions::mint_action::MintActionCompressedInstructionData, state::CompressedMint, TokenError, }; -use light_sdk::instruction::PackedMerkleContext; use light_zero_copy::{traits::ZeroCopyAt, ZeroCopyNew}; use pinocchio::account_info::AccountInfo; diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/queue_indices.rs b/programs/compressed-token/program/src/compressed_token/mint_action/queue_indices.rs index d1b66aca7f..6d1b82bc9e 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/queue_indices.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/queue_indices.rs @@ -1,6 +1,6 @@ use anchor_compressed_token::ErrorCode; -use light_token_interface::instructions::mint_action::ZCpiContext; use light_program_profiler::profile; +use light_token_interface::instructions::mint_action::ZCpiContext; #[derive(Debug, PartialEq)] pub struct QueueIndices { diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/zero_copy_config.rs b/programs/compressed-token/program/src/compressed_token/mint_action/zero_copy_config.rs index 2c04319bcf..a7c1767bf1 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/zero_copy_config.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/zero_copy_config.rs @@ -1,11 +1,11 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_compressed_account::instruction_data::with_readonly::InstructionDataInvokeCpiWithReadOnlyConfig; +use light_program_profiler::profile; use light_token_interface::{ instructions::mint_action::{ZAction, ZMintActionCompressedInstructionData}, state::{CompressedMint, CompressedMintConfig}, }; -use light_program_profiler::profile; use spl_pod::solana_msg::msg; use tinyvec::ArrayVec; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/check_extensions.rs b/programs/compressed-token/program/src/compressed_token/transfer2/check_extensions.rs index 22068c42a9..083489c32b 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/check_extensions.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/check_extensions.rs @@ -2,13 +2,13 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_array_map::ArrayMap; +use light_program_profiler::profile; use light_token_interface::{ instructions::{ extensions::ZExtensionInstructionData, transfer2::ZCompressedTokenInstructionDataTransfer2, }, state::TokenDataVersion, }; -use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_and_close.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_and_close.rs index ba8b8533a3..c42c5dface 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_and_close.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_and_close.rs @@ -2,15 +2,15 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use bitvec::prelude::*; use light_account_checks::{checks::check_signer, packed_accounts::ProgramPackedAccounts}; +use light_program_profiler::profile; use light_token_interface::{ instructions::{ extensions::ZExtensionInstructionData, transfer2::{ZCompression, ZCompressionMode, ZMultiTokenTransferOutputData}, }, - state::{TokenDataVersion, ZTokenMut, ZExtensionStructMut}, + state::{TokenDataVersion, ZExtensionStructMut, ZTokenMut}, TokenError, }; -use light_program_profiler::profile; use pinocchio::{ account_info::AccountInfo, pubkey::{pubkey_eq, Pubkey}, diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_or_decompress_ctokens.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_or_decompress_ctokens.rs index 0d5d11b992..81503fccfb 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_or_decompress_ctokens.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/compress_or_decompress_ctokens.rs @@ -1,12 +1,12 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::checks::check_owner; +use light_program_profiler::profile; use light_token_interface::{ instructions::transfer2::ZCompressionMode, state::{Token, ZTokenMut}, TokenError, }; -use light_program_profiler::profile; use light_zero_copy::traits::ZeroCopyAtMut; use pinocchio::pubkey::pubkey_eq; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/decompress.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/decompress.rs index c5be0be89b..a38fcaefaf 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/decompress.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/decompress.rs @@ -3,7 +3,7 @@ use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::Pubkey; use light_token_interface::{ instructions::extensions::{find_compressed_only, ZCompressedOnlyExtensionInstructionData}, - state::{ZTokenMut, ZExtensionStructMut}, + state::{ZExtensionStructMut, ZTokenMut}, TokenError, }; use pinocchio::{account_info::AccountInfo, pubkey::pubkey_eq}; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/mod.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/mod.rs index c63366ed6d..90cd013e95 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/mod.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/mod.rs @@ -1,8 +1,8 @@ use light_account_checks::packed_accounts::ProgramPackedAccounts; +use light_program_profiler::profile; use light_token_interface::instructions::transfer2::{ ZCompressedTokenInstructionDataTransfer2, ZCompression, }; -use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; use super::validate_compression_mode_fields; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/mod.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/mod.rs index 689ed028e0..07763b345a 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/mod.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/mod.rs @@ -3,13 +3,13 @@ use anchor_lang::prelude::ProgramError; use arrayvec::ArrayVec; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::pubkey::AsPubkey; +use light_program_profiler::profile; use light_token_interface::{ instructions::transfer2::{ ZCompressedTokenInstructionDataTransfer2, ZCompression, ZCompressionMode, }, TokenError, }; -use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/compression/spl.rs b/programs/compressed-token/program/src/compressed_token/transfer2/compression/spl.rs index 3e05be6988..cc34608600 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/compression/spl.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/compression/spl.rs @@ -1,12 +1,12 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; +use light_program_profiler::profile; +use light_sdk_types::CPI_AUTHORITY_PDA_SEED; use light_token_interface::{ instructions::transfer2::{ZCompression, ZCompressionMode}, is_valid_spl_interface_pda, }; -use light_program_profiler::profile; -use light_sdk_types::CPI_AUTHORITY_PDA_SEED; use pinocchio::{ account_info::AccountInfo, instruction::{AccountMeta, Seed, Signer}, diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/cpi.rs b/programs/compressed-token/program/src/compressed_token/transfer2/cpi.rs index 4a0cc850fe..79784a5190 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/cpi.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/cpi.rs @@ -1,11 +1,11 @@ use light_compressed_account::instruction_data::with_readonly::InstructionDataInvokeCpiWithReadOnlyConfig; +use light_program_profiler::profile; use light_token_interface::{ instructions::{ extensions::ZExtensionInstructionData, transfer2::ZCompressedTokenInstructionDataTransfer2, }, state::{ExtensionStructConfig, TokenData, TokenDataConfig}, }; -use light_program_profiler::profile; use light_zero_copy::ZeroCopyNew; use pinocchio::program_error::ProgramError; use tinyvec::ArrayVec; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/processor.rs b/programs/compressed-token/program/src/compressed_token/transfer2/processor.rs index 06a743c143..c049ff7b21 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/processor.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/processor.rs @@ -2,6 +2,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_array_map::ArrayMap; use light_compressed_account::instruction_data::with_readonly::InstructionDataInvokeCpiWithReadOnly; +use light_program_profiler::profile; use light_token_interface::{ hash_cache::HashCache, instructions::{ @@ -13,7 +14,6 @@ use light_token_interface::{ }, TokenError, }; -use light_program_profiler::profile; use light_zero_copy::{traits::ZeroCopyAt, ZeroCopyNew}; use pinocchio::account_info::AccountInfo; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/sum_check.rs b/programs/compressed-token/program/src/compressed_token/transfer2/sum_check.rs index 5dc2795526..90085d7982 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/sum_check.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/sum_check.rs @@ -1,10 +1,10 @@ use anchor_compressed_token::ErrorCode; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_array_map::ArrayMap; +use light_program_profiler::profile; use light_token_interface::instructions::transfer2::{ ZCompression, ZCompressionMode, ZMultiInputTokenDataWithContext, ZMultiTokenTransferOutputData, }; -use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/token_inputs.rs b/programs/compressed-token/program/src/compressed_token/transfer2/token_inputs.rs index 19aca6a0d2..2416f51153 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/token_inputs.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/token_inputs.rs @@ -1,6 +1,7 @@ use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::instruction_data::with_readonly::ZInstructionDataInvokeCpiWithReadOnlyMut; +use light_program_profiler::profile; use light_token_interface::{ hash_cache::HashCache, instructions::{ @@ -8,7 +9,6 @@ use light_token_interface::{ }, TokenError, }; -use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; use super::check_extensions::{validate_tlv_and_get_frozen, MintExtensionCache}; diff --git a/programs/compressed-token/program/src/compressed_token/transfer2/token_outputs.rs b/programs/compressed-token/program/src/compressed_token/transfer2/token_outputs.rs index b9af4eca86..a6d3b37210 100644 --- a/programs/compressed-token/program/src/compressed_token/transfer2/token_outputs.rs +++ b/programs/compressed-token/program/src/compressed_token/transfer2/token_outputs.rs @@ -1,13 +1,13 @@ use anchor_lang::prelude::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::instruction_data::with_readonly::ZInstructionDataInvokeCpiWithReadOnlyMut; +use light_program_profiler::profile; use light_token_interface::{ hash_cache::HashCache, instructions::{ extensions::ZExtensionInstructionData, transfer2::ZCompressedTokenInstructionDataTransfer2, }, }; -use light_program_profiler::profile; use pinocchio::account_info::AccountInfo; use super::check_extensions::validate_tlv_and_get_frozen; diff --git a/programs/compressed-token/program/src/compressible/claim.rs b/programs/compressed-token/program/src/compressible/claim.rs index b04d65f3a6..eca3eb5321 100644 --- a/programs/compressed-token/program/src/compressible/claim.rs +++ b/programs/compressed-token/program/src/compressible/claim.rs @@ -2,11 +2,11 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::{checks::check_owner, AccountInfoTrait, AccountIterator}; use light_compressible::{compression_info::ClaimAndUpdate, config::CompressibleConfig}; +use light_program_profiler::profile; use light_token_interface::{ - state::{Token, CompressedMint, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT}, + state::{CompressedMint, Token, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT}, TokenError, }; -use light_program_profiler::profile; use pinocchio::{account_info::AccountInfo, sysvars::Sysvar}; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/ctoken/close/processor.rs b/programs/compressed-token/program/src/ctoken/close/processor.rs index 5fb7285168..05ef6aeb0f 100644 --- a/programs/compressed-token/program/src/ctoken/close/processor.rs +++ b/programs/compressed-token/program/src/ctoken/close/processor.rs @@ -2,8 +2,8 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::{checks::check_signer, AccountInfoTrait}; use light_compressible::rent::AccountRentState; -use light_token_interface::state::{AccountState, Token, ZTokenMut}; use light_program_profiler::profile; +use light_token_interface::state::{AccountState, Token, ZTokenMut}; #[cfg(target_os = "solana")] use pinocchio::sysvars::Sysvar; use pinocchio::{account_info::AccountInfo, pubkey::pubkey_eq}; diff --git a/programs/compressed-token/program/src/ctoken/create.rs b/programs/compressed-token/program/src/ctoken/create.rs index 7d28d681e3..4da22191ce 100644 --- a/programs/compressed-token/program/src/ctoken/create.rs +++ b/programs/compressed-token/program/src/ctoken/create.rs @@ -2,8 +2,8 @@ use anchor_lang::prelude::ProgramError; use borsh::BorshDeserialize; use light_account_checks::AccountIterator; use light_compressed_account::Pubkey; -use light_token_interface::instructions::create_token_account::CreateTokenAccountInstructionData; use light_program_profiler::profile; +use light_token_interface::instructions::create_token_account::CreateTokenAccountInstructionData; use pinocchio::account_info::AccountInfo; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/ctoken/create_ata.rs b/programs/compressed-token/program/src/ctoken/create_ata.rs index d5847c6f77..a1608aa8cf 100644 --- a/programs/compressed-token/program/src/ctoken/create_ata.rs +++ b/programs/compressed-token/program/src/ctoken/create_ata.rs @@ -1,8 +1,8 @@ use anchor_lang::prelude::ProgramError; use borsh::BorshDeserialize; use light_account_checks::AccountIterator; -use light_token_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; use light_program_profiler::profile; +use light_token_interface::instructions::create_associated_token_account::CreateAssociatedTokenAccountInstructionData; use pinocchio::{account_info::AccountInfo, instruction::Seed}; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/ctoken/transfer/shared.rs b/programs/compressed-token/program/src/ctoken/transfer/shared.rs index b4e04d73f8..2a3fe235ea 100644 --- a/programs/compressed-token/program/src/ctoken/transfer/shared.rs +++ b/programs/compressed-token/program/src/ctoken/transfer/shared.rs @@ -1,10 +1,10 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; +use light_program_profiler::profile; use light_token_interface::{ state::{Token, ZExtensionStructMut}, - TokenError, MintExtensionFlags, + MintExtensionFlags, TokenError, }; -use light_program_profiler::profile; use pinocchio::{account_info::AccountInfo, pubkey::pubkey_eq}; use crate::{ diff --git a/programs/compressed-token/program/src/extensions/check_mint_extensions.rs b/programs/compressed-token/program/src/extensions/check_mint_extensions.rs index 7409a16a31..fd8de46947 100644 --- a/programs/compressed-token/program/src/extensions/check_mint_extensions.rs +++ b/programs/compressed-token/program/src/extensions/check_mint_extensions.rs @@ -1,9 +1,7 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; use light_account_checks::AccountInfoTrait; -use light_token_interface::{ - is_restricted_extension, MintExtensionFlags, ALLOWED_EXTENSION_TYPES, -}; +use light_token_interface::{is_restricted_extension, MintExtensionFlags, ALLOWED_EXTENSION_TYPES}; use pinocchio::{account_info::AccountInfo, msg, pubkey::Pubkey}; use spl_token_2022::{ extension::{ diff --git a/programs/compressed-token/program/src/extensions/mod.rs b/programs/compressed-token/program/src/extensions/mod.rs index d61076a86e..ea4c71c8d0 100644 --- a/programs/compressed-token/program/src/extensions/mod.rs +++ b/programs/compressed-token/program/src/extensions/mod.rs @@ -6,6 +6,7 @@ pub mod token_metadata; pub use check_mint_extensions::{ check_mint_extensions, has_mint_extensions, parse_mint_extensions, MintExtensionChecks, }; +use light_program_profiler::profile; // Import from light-token-interface instead of local modules use light_token_interface::{ instructions::mint_action::ZAction, @@ -20,7 +21,6 @@ pub use light_token_interface::{ is_restricted_extension, MintExtensionFlags, ALLOWED_EXTENSION_TYPES, RESTRICTED_EXTENSION_TYPES, }; -use light_program_profiler::profile; use light_zero_copy::ZeroCopyNew; use spl_pod::solana_msg::msg; diff --git a/programs/compressed-token/program/src/extensions/processor.rs b/programs/compressed-token/program/src/extensions/processor.rs index 332b88bd4f..af79b6d0f4 100644 --- a/programs/compressed-token/program/src/extensions/processor.rs +++ b/programs/compressed-token/program/src/extensions/processor.rs @@ -1,9 +1,9 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::prelude::ProgramError; +use light_program_profiler::profile; use light_token_interface::{ instructions::extensions::ZExtensionInstructionData, state::ZExtensionStructMut, }; -use light_program_profiler::profile; use crate::extensions::token_metadata::create_output_token_metadata; diff --git a/programs/compressed-token/program/src/extensions/token_metadata.rs b/programs/compressed-token/program/src/extensions/token_metadata.rs index 3b012c4af3..503340a932 100644 --- a/programs/compressed-token/program/src/extensions/token_metadata.rs +++ b/programs/compressed-token/program/src/extensions/token_metadata.rs @@ -1,10 +1,10 @@ use anchor_lang::prelude::ProgramError; use light_compressed_account::Pubkey; +use light_program_profiler::profile; use light_token_interface::{ instructions::extensions::token_metadata::ZTokenMetadataInstructionData, state::ZTokenMetadataMut, }; -use light_program_profiler::profile; #[inline(always)] #[profile] diff --git a/programs/compressed-token/program/src/lib.rs b/programs/compressed-token/program/src/lib.rs index 4bd80af46e..40498c019e 100644 --- a/programs/compressed-token/program/src/lib.rs +++ b/programs/compressed-token/program/src/lib.rs @@ -1,8 +1,8 @@ use std::mem::ManuallyDrop; use anchor_lang::solana_program::program_error::ProgramError; -use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use light_sdk::{cpi::CpiSigner, derive_light_cpi_signer}; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; use pinocchio::{account_info::AccountInfo, msg}; pub mod compressed_token; diff --git a/programs/compressed-token/program/src/shared/compressible_top_up.rs b/programs/compressed-token/program/src/shared/compressible_top_up.rs index d26fd275be..bf0abc5e80 100644 --- a/programs/compressed-token/program/src/shared/compressible_top_up.rs +++ b/programs/compressed-token/program/src/shared/compressible_top_up.rs @@ -1,10 +1,10 @@ use anchor_lang::solana_program::program_error::ProgramError; +use light_program_profiler::profile; #[cfg(target_os = "solana")] use light_token_interface::state::{ cmint_top_up_lamports_from_account_info, top_up_lamports_from_account_info_unchecked, }; use light_token_interface::TokenError; -use light_program_profiler::profile; use pinocchio::{ account_info::AccountInfo, sysvars::{clock::Clock, Sysvar}, diff --git a/programs/compressed-token/program/src/shared/cpi_bytes_size.rs b/programs/compressed-token/program/src/shared/cpi_bytes_size.rs index 52b52660e5..17a4e6d717 100644 --- a/programs/compressed-token/program/src/shared/cpi_bytes_size.rs +++ b/programs/compressed-token/program/src/shared/cpi_bytes_size.rs @@ -9,8 +9,8 @@ use light_compressed_account::{ }, }, }; -use light_token_interface::state::CompressedMint; use light_program_profiler::profile; +use light_token_interface::state::CompressedMint; use light_zero_copy::ZeroCopyNew; use pinocchio::program_error::ProgramError; use tinyvec::ArrayVec; diff --git a/programs/compressed-token/program/src/shared/initialize_ctoken_account.rs b/programs/compressed-token/program/src/shared/initialize_ctoken_account.rs index 86bf845fcf..fb802be477 100644 --- a/programs/compressed-token/program/src/shared/initialize_ctoken_account.rs +++ b/programs/compressed-token/program/src/shared/initialize_ctoken_account.rs @@ -1,15 +1,15 @@ use anchor_lang::prelude::ProgramError; use light_account_checks::AccountInfoTrait; use light_compressible::config::CompressibleConfig; +use light_program_profiler::profile; use light_token_interface::{ instructions::extensions::CompressibleExtensionInstructionData, state::{ - token::TokenConfig, AccountState, Token, CompressibleExtensionConfig, - CompressionInfoConfig, ExtensionStructConfig, ACCOUNT_TYPE_MINT, + token::TokenConfig, AccountState, CompressibleExtensionConfig, CompressionInfoConfig, + ExtensionStructConfig, Token, ACCOUNT_TYPE_MINT, }, TokenError, LIGHT_TOKEN_PROGRAM_ID, }; -use light_program_profiler::profile; use light_zero_copy::traits::ZeroCopyNew; #[cfg(target_os = "solana")] use pinocchio::sysvars::{clock::Clock, rent::Rent, Sysvar}; diff --git a/programs/compressed-token/program/src/shared/owner_validation.rs b/programs/compressed-token/program/src/shared/owner_validation.rs index aa73837aaa..e5c307367f 100644 --- a/programs/compressed-token/program/src/shared/owner_validation.rs +++ b/programs/compressed-token/program/src/shared/owner_validation.rs @@ -1,8 +1,8 @@ use anchor_compressed_token::ErrorCode; use anchor_lang::solana_program::program_error::ProgramError; use light_account_checks::checks::check_signer; -use light_token_interface::{state::ZTokenMut, LIGHT_TOKEN_PROGRAM_ID}; use light_program_profiler::profile; +use light_token_interface::{state::ZTokenMut, LIGHT_TOKEN_PROGRAM_ID}; use pinocchio::{account_info::AccountInfo, pubkey::pubkey_eq}; use crate::extensions::MintExtensionChecks; diff --git a/programs/compressed-token/program/src/shared/token_output.rs b/programs/compressed-token/program/src/shared/token_output.rs index ed59dee0cd..26e643dffb 100644 --- a/programs/compressed-token/program/src/shared/token_output.rs +++ b/programs/compressed-token/program/src/shared/token_output.rs @@ -3,6 +3,8 @@ use anchor_lang::prelude::ProgramError; use light_compressed_account::{ instruction_data::data::ZOutputCompressedAccountWithPackedContextMut, Pubkey, }; +use light_hasher::{sha256::Sha256BE, Hasher}; +use light_program_profiler::profile; use light_token_interface::{ hash_cache::HashCache, instructions::extensions::ZExtensionInstructionData, @@ -11,8 +13,6 @@ use light_token_interface::{ TokenDataVersion, }, }; -use light_hasher::{sha256::Sha256BE, Hasher}; -use light_program_profiler::profile; use light_zero_copy::{num_trait::ZeroCopyNumTrait, ZeroCopyNew}; /// 1. Set token account data diff --git a/programs/compressed-token/program/tests/mint_action.rs b/programs/compressed-token/program/tests/mint_action.rs index 4d38f45686..7a06a297cd 100644 --- a/programs/compressed-token/program/tests/mint_action.rs +++ b/programs/compressed-token/program/tests/mint_action.rs @@ -10,7 +10,7 @@ use light_token_interface::{ extensions::{token_metadata::TokenMetadataInstructionData, ExtensionInstructionData}, mint_action::{ Action, CompressedMintInstructionData, CpiContext, CreateMint, - MintActionCompressedInstructionData, MintToTokenAction, MintToCompressedAction, + MintActionCompressedInstructionData, MintToCompressedAction, MintToTokenAction, Recipient, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }, diff --git a/programs/compressed-token/program/tests/mint_validation.rs b/programs/compressed-token/program/tests/mint_validation.rs index 15ab5b01bd..91465f987d 100644 --- a/programs/compressed-token/program/tests/mint_validation.rs +++ b/programs/compressed-token/program/tests/mint_validation.rs @@ -4,7 +4,7 @@ use pinocchio::pubkey::Pubkey; const SPL_TOKEN_ID: Pubkey = spl_token::ID.to_bytes(); const SPL_TOKEN_2022_ID: Pubkey = spl_token_2022::ID.to_bytes(); -const CTOKEN_PROGRAM_ID: Pubkey = light_token_interface::LIGHT_TOKEN_PROGRAM_ID; +const LIGHT_TOKEN_PROGRAM_ID: Pubkey = light_token_interface::LIGHT_TOKEN_PROGRAM_ID; const SYSTEM_PROGRAM_ID: Pubkey = [0u8; 32]; const RANDOM_PROGRAM_ID: Pubkey = [42u8; 32]; @@ -28,7 +28,7 @@ impl Owner { match self { Owner::SplToken => &SPL_TOKEN_ID, Owner::Token2022 => &SPL_TOKEN_2022_ID, - Owner::CToken => &CTOKEN_PROGRAM_ID, + Owner::CToken => &LIGHT_TOKEN_PROGRAM_ID, Owner::SystemProgram => &SYSTEM_PROGRAM_ID, Owner::RandomProgram => &RANDOM_PROGRAM_ID, } diff --git a/programs/compressed-token/program/tests/token_input.rs b/programs/compressed-token/program/tests/token_input.rs index 191d635725..c7bcaa36a2 100644 --- a/programs/compressed-token/program/tests/token_input.rs +++ b/programs/compressed-token/program/tests/token_input.rs @@ -19,11 +19,11 @@ use light_compressed_token::{ token_input::set_input_compressed_account, }, }; +use light_sdk::instruction::PackedMerkleContext; use light_token_interface::{ hash_cache::HashCache, instructions::transfer2::MultiInputTokenDataWithContext, state::CompressedTokenAccountState, }; -use light_sdk::instruction::PackedMerkleContext; use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyNew}; use pinocchio::account_info::AccountInfo; use rand::Rng; diff --git a/programs/compressed-token/program/tests/token_output.rs b/programs/compressed-token/program/tests/token_output.rs index aa88a32472..1c54b14255 100644 --- a/programs/compressed-token/program/tests/token_output.rs +++ b/programs/compressed-token/program/tests/token_output.rs @@ -19,6 +19,7 @@ use light_compressed_token::{ token_output::set_output_compressed_account, }, }; +use light_hasher::Hasher; use light_token_interface::{ hash_cache::HashCache, instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, @@ -27,7 +28,6 @@ use light_token_interface::{ ExtensionStructConfig, TokenData, TokenDataConfig, }, }; -use light_hasher::Hasher; use light_zero_copy::{traits::ZeroCopyAt, ZeroCopyNew}; #[test] diff --git a/programs/registry/src/compressible/compressed_token/accounts.rs b/programs/registry/src/compressible/compressed_token/accounts.rs index 2b6808cf8b..7dbb84bd36 100644 --- a/programs/registry/src/compressible/compressed_token/accounts.rs +++ b/programs/registry/src/compressible/compressed_token/accounts.rs @@ -32,8 +32,10 @@ impl<'a, A: AccountInfoTrait + Clone> Transfer2CpiAccounts<'a, A> { #[inline(always)] pub fn try_from_account_infos(fee_payer: A, accounts: &'a [A]) -> Result { let mut iter = AccountIterator::new(accounts); - let compressed_token_program = - iter.next_checked_pubkey("compressed_token_program", LIGHT_TOKEN_PROGRAM_ID.to_bytes())?; + let compressed_token_program = iter.next_checked_pubkey( + "compressed_token_program", + LIGHT_TOKEN_PROGRAM_ID.to_bytes(), + )?; let compressed_token_cpi_authority = iter.next_account("compressed_token_cpi_authority")?; diff --git a/programs/registry/src/compressible/compressed_token/compress_and_close.rs b/programs/registry/src/compressible/compressed_token/compress_and_close.rs index cd89facd4a..aa923aca5f 100644 --- a/programs/registry/src/compressible/compressed_token/compress_and_close.rs +++ b/programs/registry/src/compressible/compressed_token/compress_and_close.rs @@ -1,5 +1,6 @@ use anchor_lang::{prelude::ProgramError, pubkey, AnchorDeserialize, AnchorSerialize, Result}; use light_account_checks::packed_accounts::ProgramPackedAccounts; +use light_program_profiler::profile; use light_token_interface::{ instructions::{ extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, @@ -10,7 +11,6 @@ use light_token_interface::{ }, state::{Token, ZExtensionStruct}, }; -use light_program_profiler::profile; use light_zero_copy::traits::ZeroCopyAt; use solana_account_info::AccountInfo; use solana_instruction::{AccountMeta, Instruction}; diff --git a/sdk-libs/client/Cargo.toml b/sdk-libs/client/Cargo.toml index fda0193281..12df864663 100644 --- a/sdk-libs/client/Cargo.toml +++ b/sdk-libs/client/Cargo.toml @@ -43,7 +43,7 @@ light-indexed-merkle-tree = { workspace = true } light-sdk = { workspace = true } light-hasher = { workspace = true, features = ["poseidon"] } light-compressed-account = { workspace = true, features = ["solana", "poseidon"] } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } light-token-interface = { workspace = true } light-event = { workspace = true } diff --git a/sdk-libs/client/src/indexer/types.rs b/sdk-libs/client/src/indexer/types.rs index 3af89cc4e4..2278dd3735 100644 --- a/sdk-libs/client/src/indexer/types.rs +++ b/sdk-libs/client/src/indexer/types.rs @@ -7,12 +7,12 @@ use light_compressed_account::{ instruction_data::compressed_proof::CompressedProof, TreeType, }; -use light_token_interface::state::ExtensionStruct; -use light_ctoken_sdk::compat::{AccountState, TokenData}; use light_indexed_merkle_tree::array::IndexedElement; use light_sdk::instruction::{ PackedAccounts, PackedAddressTreeInfo, PackedStateTreeInfo, ValidityProof, }; +use light_token_interface::state::ExtensionStruct; +use light_token_sdk::compat::{AccountState, TokenData}; use num_bigint::BigUint; use solana_pubkey::Pubkey; use tracing::warn; @@ -939,11 +939,11 @@ impl TryFrom<&photon_api::models::TokenAccountV2> for CompressedTokenAccount { } #[allow(clippy::from_over_into)] -impl Into for CompressedTokenAccount { - fn into(self) -> light_ctoken_sdk::compat::TokenDataWithMerkleContext { +impl Into for CompressedTokenAccount { + fn into(self) -> light_token_sdk::compat::TokenDataWithMerkleContext { let compressed_account = CompressedAccountWithMerkleContext::from(self.account); - light_ctoken_sdk::compat::TokenDataWithMerkleContext { + light_token_sdk::compat::TokenDataWithMerkleContext { token_data: self.token, compressed_account, } @@ -951,30 +951,30 @@ impl Into for CompressedTo } #[allow(clippy::from_over_into)] -impl Into> +impl Into> for super::response::Response> { - fn into(self) -> Vec { + fn into(self) -> Vec { self.value .items .into_iter() .map( - |token_account| light_ctoken_sdk::compat::TokenDataWithMerkleContext { + |token_account| light_token_sdk::compat::TokenDataWithMerkleContext { token_data: token_account.token, compressed_account: CompressedAccountWithMerkleContext::from( token_account.account.clone(), ), }, ) - .collect::>() + .collect::>() } } -impl TryFrom for CompressedTokenAccount { +impl TryFrom for CompressedTokenAccount { type Error = IndexerError; fn try_from( - token_data_with_context: light_ctoken_sdk::compat::TokenDataWithMerkleContext, + token_data_with_context: light_token_sdk::compat::TokenDataWithMerkleContext, ) -> Result { let account = CompressedAccount::try_from(token_data_with_context.compressed_account)?; diff --git a/sdk-libs/compressible-client/src/lib.rs b/sdk-libs/compressible-client/src/lib.rs index 2006e21f36..f621868df0 100644 --- a/sdk-libs/compressible-client/src/lib.rs +++ b/sdk-libs/compressible-client/src/lib.rs @@ -8,7 +8,7 @@ use light_client::indexer::{CompressedAccount, TreeInfo, ValidityProofWithContex pub use light_sdk::compressible::config::CompressibleConfig; use light_sdk::{ compressible::{compression_info::CompressedAccountData, Pack}, - constants::C_TOKEN_PROGRAM_ID, + constants::LIGHT_TOKEN_PROGRAM_ID, instruction::{ account_meta::CompressedAccountMetaNoLamportsNoAddress, PackedAccounts, SystemAccountMetaConfig, ValidityProof, @@ -185,7 +185,7 @@ pub mod compressible_instruction { let mut has_tokens = false; let mut has_pdas = false; for (compressed_account, _) in compressed_accounts.iter() { - if compressed_account.owner == C_TOKEN_PROGRAM_ID.into() { + if compressed_account.owner == LIGHT_TOKEN_PROGRAM_ID.into() { has_tokens = true; } else { has_pdas = true; diff --git a/sdk-libs/macros/src/compressible/GUIDE.md b/sdk-libs/macros/src/compressible/GUIDE.md index 04d37494b5..02bb232932 100644 --- a/sdk-libs/macros/src/compressible/GUIDE.md +++ b/sdk-libs/macros/src/compressible/GUIDE.md @@ -138,7 +138,7 @@ let mut rpc = LightClient::new(LightClientConfig::local()).await?; // or devnet/ 2. Create a compressible ATA ```rust -use light_ctoken_sdk::instructions::{ +use light_token_sdk::instructions::{ create_compressible_associated_token_account, CreateCompressibleAssociatedTokenAccountInputs }; @@ -157,7 +157,7 @@ let ix = create_compressible_associated_token_account(CreateCompressibleAssociat 3. Create a cMint and mint to recipients ```rust -use light_ctoken_sdk::instructions::{ +use light_token_sdk::instructions::{ create_compressed_mint, CreateCompressedMintInputs, create_mint_to_compressed_instruction, MintToCompressedInputs }; diff --git a/sdk-libs/macros/src/compressible/decompress_context.rs b/sdk-libs/macros/src/compressible/decompress_context.rs index acb6c33ecd..5d5a37301e 100644 --- a/sdk-libs/macros/src/compressible/decompress_context.rs +++ b/sdk-libs/macros/src/compressible/decompress_context.rs @@ -71,7 +71,7 @@ pub fn generate_decompress_context_trait_impl( Ok(quote! { impl<#lifetime> light_sdk::compressible::DecompressContext<#lifetime> for DecompressAccountsIdempotent<#lifetime> { type CompressedData = CompressedAccountData; - type PackedTokenData = light_ctoken_sdk::compat::PackedCTokenData<#token_variant_ident>; + type PackedTokenData = light_token_sdk::compat::PackedCTokenData<#token_variant_ident>; type CompressedMeta = light_sdk::instruction::account_meta::CompressedAccountMetaNoLamportsNoAddress; type SeedParams = SeedParams; @@ -87,19 +87,19 @@ pub fn generate_decompress_context_trait_impl( &self.rent_sponsor } - fn ctoken_rent_sponsor(&self) -> std::option::Option<&solana_account_info::AccountInfo<#lifetime>> { + fn token_rent_sponsor(&self) -> std::option::Option<&solana_account_info::AccountInfo<#lifetime>> { self.ctoken_rent_sponsor.as_ref() } - fn ctoken_program(&self) -> std::option::Option<&solana_account_info::AccountInfo<#lifetime>> { + fn token_program(&self) -> std::option::Option<&solana_account_info::AccountInfo<#lifetime>> { self.ctoken_program.as_ref().map(|a| &**a) } - fn ctoken_cpi_authority(&self) -> std::option::Option<&solana_account_info::AccountInfo<#lifetime>> { + fn token_cpi_authority(&self) -> std::option::Option<&solana_account_info::AccountInfo<#lifetime>> { self.ctoken_cpi_authority.as_ref().map(|a| &**a) } - fn ctoken_config(&self) -> std::option::Option<&solana_account_info::AccountInfo<#lifetime>> { + fn token_config(&self) -> std::option::Option<&solana_account_info::AccountInfo<#lifetime>> { self.ctoken_config.as_ref().map(|a| &**a) } @@ -145,27 +145,27 @@ pub fn generate_decompress_context_trait_impl( &self, remaining_accounts: &[solana_account_info::AccountInfo<#lifetime>], fee_payer: &solana_account_info::AccountInfo<#lifetime>, - ctoken_program: &solana_account_info::AccountInfo<#lifetime>, - ctoken_rent_sponsor: &solana_account_info::AccountInfo<#lifetime>, - ctoken_cpi_authority: &solana_account_info::AccountInfo<#lifetime>, - ctoken_config: &solana_account_info::AccountInfo<#lifetime>, + token_program: &solana_account_info::AccountInfo<#lifetime>, + token_rent_sponsor: &solana_account_info::AccountInfo<#lifetime>, + token_cpi_authority: &solana_account_info::AccountInfo<#lifetime>, + token_config: &solana_account_info::AccountInfo<#lifetime>, config: &solana_account_info::AccountInfo<#lifetime>, - ctoken_accounts: Vec<(Self::PackedTokenData, Self::CompressedMeta)>, + token_accounts: Vec<(Self::PackedTokenData, Self::CompressedMeta)>, proof: light_sdk::instruction::ValidityProof, cpi_accounts: &light_sdk::cpi::v2::CpiAccounts<'b, #lifetime>, post_system_accounts: &[solana_account_info::AccountInfo<#lifetime>], has_pdas: bool, ) -> std::result::Result<(), solana_program_error::ProgramError> { - light_ctoken_sdk::compressible::process_decompress_tokens_runtime( + light_token_sdk::compressible::process_decompress_tokens_runtime( self, remaining_accounts, fee_payer, - ctoken_program, - ctoken_rent_sponsor, - ctoken_cpi_authority, - ctoken_config, + token_program, + token_rent_sponsor, + token_cpi_authority, + token_config, config, - ctoken_accounts, + token_accounts, proof, cpi_accounts, post_system_accounts, diff --git a/sdk-libs/macros/src/compressible/instructions.rs b/sdk-libs/macros/src/compressible/instructions.rs index 6469d22290..04243ff8a2 100644 --- a/sdk-libs/macros/src/compressible/instructions.rs +++ b/sdk-libs/macros/src/compressible/instructions.rs @@ -522,12 +522,12 @@ pub fn add_compressible_instructions( use super::*; impl light_sdk::compressible::HasTokenVariant for CompressedAccountData { - fn is_packed_ctoken(&self) -> bool { + fn is_packed_token(&self) -> bool { matches!(self.data, CompressedAccountVariant::PackedCTokenData(_)) } } - impl light_sdk::compressible::CTokenSeedProvider for CTokenAccountVariant { + impl light_sdk::compressible::TokenSeedProvider for CTokenAccountVariant { type Accounts<'info> = DecompressAccountsIdempotent<'info>; fn get_seeds<'a, 'info>( @@ -563,7 +563,7 @@ pub fn add_compressible_instructions( } } - impl light_ctoken_sdk::compressible::CTokenSeedProvider for CTokenAccountVariant { + impl light_token_sdk::compressible::TokenSeedProvider for CTokenAccountVariant { type Accounts<'info> = DecompressAccountsIdempotent<'info>; fn get_seeds<'a, 'info>( @@ -660,7 +660,7 @@ pub fn add_compressible_instructions( ) -> std::result::Result<( Vec, Vec<( - light_ctoken_sdk::compat::PackedCTokenData, + light_token_sdk::compat::PackedCTokenData, light_sdk::instruction::account_meta::CompressedAccountMetaNoLamportsNoAddress, )>, ), solana_program_error::ProgramError> { @@ -670,7 +670,7 @@ pub fn add_compressible_instructions( let estimated_capacity = compressed_accounts.len(); let mut compressed_pda_infos = Vec::with_capacity(estimated_capacity); let mut compressed_token_accounts: Vec<( - light_ctoken_sdk::compat::PackedCTokenData, + light_token_sdk::compat::PackedCTokenData, light_sdk::instruction::account_meta::CompressedAccountMetaNoLamportsNoAddress, )> = Vec::with_capacity(estimated_capacity); diff --git a/sdk-libs/macros/src/compressible/variant_enum.rs b/sdk-libs/macros/src/compressible/variant_enum.rs index 301afc9de7..c220a8c15a 100644 --- a/sdk-libs/macros/src/compressible/variant_enum.rs +++ b/sdk-libs/macros/src/compressible/variant_enum.rs @@ -41,8 +41,8 @@ pub fn compressed_account_variant(input: TokenStream) -> Result { #[derive(Clone, Debug, anchor_lang::AnchorSerialize, anchor_lang::AnchorDeserialize)] pub enum CompressedAccountVariant { #(#account_variants)* - PackedCTokenData(light_ctoken_sdk::compat::PackedCTokenData), - CTokenData(light_ctoken_sdk::compat::CTokenData), + PackedCTokenData(light_token_sdk::compat::PackedCTokenData), + CTokenData(light_token_sdk::compat::CTokenData), } }; @@ -187,7 +187,7 @@ pub fn compressed_account_variant(input: TokenStream) -> Result { #(#pack_match_arms)* Self::PackedCTokenData(_) => unreachable!(), Self::CTokenData(data) => { - Self::PackedCTokenData(light_ctoken_sdk::pack::Pack::pack(data, remaining_accounts)) + Self::PackedCTokenData(light_token_sdk::pack::Pack::pack(data, remaining_accounts)) } } } diff --git a/sdk-libs/program-test/Cargo.toml b/sdk-libs/program-test/Cargo.toml index c53e8becfa..15324540df 100644 --- a/sdk-libs/program-test/Cargo.toml +++ b/sdk-libs/program-test/Cargo.toml @@ -20,7 +20,7 @@ light-concurrent-merkle-tree = { workspace = true, optional = true } light-hasher = { workspace = true, features = ["poseidon", "sha256", "keccak", "std"] } light-token-interface = { workspace = true, optional = true } light-compressible = { workspace = true, optional = true } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } light-compressed-account = { workspace = true, features = ["anchor", "poseidon"] } light-batched-merkle-tree = { workspace = true, features = ["test-only"], optional = true } light-event = { workspace = true } diff --git a/sdk-libs/program-test/src/compressible.rs b/sdk-libs/program-test/src/compressible.rs index e6da5ac183..13a1d87dce 100644 --- a/sdk-libs/program-test/src/compressible.rs +++ b/sdk-libs/program-test/src/compressible.rs @@ -16,12 +16,12 @@ use light_compressible::rent::RentConfig; #[cfg(feature = "devenv")] use light_compressible::rent::SLOTS_PER_EPOCH; #[cfg(feature = "devenv")] +use light_sdk::compressible::CompressibleConfig as CpdaCompressibleConfig; +#[cfg(feature = "devenv")] use light_token_interface::state::{ - Token, CompressedMint, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, + CompressedMint, Token, ACCOUNT_TYPE_MINT, ACCOUNT_TYPE_TOKEN_ACCOUNT, }; #[cfg(feature = "devenv")] -use light_sdk::compressible::CompressibleConfig as CpdaCompressibleConfig; -#[cfg(feature = "devenv")] use solana_pubkey::Pubkey; #[cfg(feature = "devenv")] diff --git a/sdk-libs/program-test/src/forester/compress_and_close_forester.rs b/sdk-libs/program-test/src/forester/compress_and_close_forester.rs index 97ad43ec98..c08b950af5 100644 --- a/sdk-libs/program-test/src/forester/compress_and_close_forester.rs +++ b/sdk-libs/program-test/src/forester/compress_and_close_forester.rs @@ -6,13 +6,13 @@ use light_client::{ rpc::{Rpc, RpcError}, }; use light_compressible::config::CompressibleConfig; -use light_ctoken_sdk::compressed_token::CompressAndCloseAccounts as CTokenCompressAndCloseAccounts; use light_registry::{ accounts::CompressAndCloseContext as CompressAndCloseAccounts, compressible::compressed_token::CompressAndCloseIndices, instruction::CompressAndClose, utils::get_forester_epoch_pda_from_authority, }; use light_sdk::instruction::PackedAccounts; +use light_token_sdk::compressed_token::CompressAndCloseAccounts as CTokenCompressAndCloseAccounts; use solana_sdk::{ instruction::Instruction, pubkey::Pubkey, diff --git a/sdk-libs/program-test/src/indexer/extensions.rs b/sdk-libs/program-test/src/indexer/extensions.rs index 8e78a5768a..34356db9f3 100644 --- a/sdk-libs/program-test/src/indexer/extensions.rs +++ b/sdk-libs/program-test/src/indexer/extensions.rs @@ -4,8 +4,8 @@ use light_client::indexer::{ AddressMerkleTreeAccounts, MerkleProof, NewAddressProofWithContext, StateMerkleTreeAccounts, }; use light_compressed_account::compressed_account::CompressedAccountWithMerkleContext; -use light_ctoken_sdk::compat::TokenDataWithMerkleContext; use light_event::event::PublicTransactionEvent; +use light_token_sdk::compat::TokenDataWithMerkleContext; use solana_sdk::signature::Keypair; use super::{address_tree::AddressMerkleTreeBundle, state_tree::StateMerkleTreeBundle}; diff --git a/sdk-libs/program-test/src/indexer/test_indexer.rs b/sdk-libs/program-test/src/indexer/test_indexer.rs index 69d6f33fde..bffe842e21 100644 --- a/sdk-libs/program-test/src/indexer/test_indexer.rs +++ b/sdk-libs/program-test/src/indexer/test_indexer.rs @@ -38,7 +38,6 @@ use light_compressed_account::{ tx_hash::create_tx_hash, TreeType, }; -use light_ctoken_sdk::compat::{TokenData, TokenDataWithMerkleContext}; use light_event::event::PublicTransactionEvent; use light_hasher::{bigint::bigint_to_be_bytes_array, Poseidon}; use light_merkle_tree_reference::MerkleTree; @@ -66,6 +65,7 @@ use light_prover_client::{ }, }; use light_sdk::light_hasher::Hash; +use light_token_sdk::compat::{TokenData, TokenDataWithMerkleContext}; use log::info; use num_bigint::{BigInt, BigUint}; use num_traits::FromBytes; diff --git a/sdk-libs/program-test/src/logging/formatter.rs b/sdk-libs/program-test/src/logging/formatter.rs index fbb8339858..3ad41c612d 100644 --- a/sdk-libs/program-test/src/logging/formatter.rs +++ b/sdk-libs/program-test/src/logging/formatter.rs @@ -1220,7 +1220,7 @@ impl TransactionFormatter { if pubkey_bytes == light_sdk_types::constants::NOOP_PROGRAM_ID { return "noop program".to_string(); } - if pubkey_bytes == light_sdk_types::constants::C_TOKEN_PROGRAM_ID { + if pubkey_bytes == light_sdk_types::constants::LIGHT_TOKEN_PROGRAM_ID { return "compressed token program".to_string(); } if pubkey_bytes == light_sdk_types::constants::ADDRESS_TREE_V1 { diff --git a/sdk-libs/program-test/src/program_test/extensions.rs b/sdk-libs/program-test/src/program_test/extensions.rs index 25317bcf20..63762b4613 100644 --- a/sdk-libs/program-test/src/program_test/extensions.rs +++ b/sdk-libs/program-test/src/program_test/extensions.rs @@ -4,8 +4,8 @@ use light_client::indexer::{ AddressMerkleTreeAccounts, MerkleProof, NewAddressProofWithContext, StateMerkleTreeAccounts, }; use light_compressed_account::compressed_account::CompressedAccountWithMerkleContext; -use light_ctoken_sdk::compat::TokenDataWithMerkleContext; use light_event::event::PublicTransactionEvent; +use light_token_sdk::compat::TokenDataWithMerkleContext; use solana_sdk::signature::Keypair; use crate::{ diff --git a/sdk-libs/sdk-types/src/constants.rs b/sdk-libs/sdk-types/src/constants.rs index 7f78c72b44..96c9529a0f 100644 --- a/sdk-libs/sdk-types/src/constants.rs +++ b/sdk-libs/sdk-types/src/constants.rs @@ -12,7 +12,7 @@ pub const ACCOUNT_COMPRESSION_AUTHORITY_PDA: [u8; 32] = pubkey_array!("HwXnGK3tPkkVY6P439H2p68AxpeuWXd5PcrAxFpbmfbA"); /// ID of the light-compressed-token program. -pub const C_TOKEN_PROGRAM_ID: [u8; 32] = +pub const LIGHT_TOKEN_PROGRAM_ID: [u8; 32] = pubkey_array!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m"); /// Seed of the CPI authority. diff --git a/sdk-libs/sdk/src/compressible/decompress_runtime.rs b/sdk-libs/sdk/src/compressible/decompress_runtime.rs index 85d4ce6227..10ece4b6ae 100644 --- a/sdk-libs/sdk/src/compressible/decompress_runtime.rs +++ b/sdk-libs/sdk/src/compressible/decompress_runtime.rs @@ -21,14 +21,14 @@ use crate::{ /// Trait for account variants that can be checked for token vs PDA type. pub trait HasTokenVariant { - /// Returns true if this variant represents a token account (PackedCTokenData). - fn is_packed_ctoken(&self) -> bool; + /// Returns true if this variant represents a token account (PackedTokenData). + fn is_packed_token(&self) -> bool; } -/// Trait for CToken seed providers. +/// Trait for token seed providers. /// /// Also defined in compressed-token-sdk for token-specific runtime helpers. -pub trait CTokenSeedProvider: Copy { +pub trait TokenSeedProvider: Copy { /// Type of accounts struct needed for seed derivation. type Accounts<'info>; @@ -65,10 +65,10 @@ pub trait DecompressContext<'info> { fn fee_payer(&self) -> &AccountInfo<'info>; fn config(&self) -> &AccountInfo<'info>; fn rent_sponsor(&self) -> &AccountInfo<'info>; - fn ctoken_rent_sponsor(&self) -> Option<&AccountInfo<'info>>; - fn ctoken_program(&self) -> Option<&AccountInfo<'info>>; - fn ctoken_cpi_authority(&self) -> Option<&AccountInfo<'info>>; - fn ctoken_config(&self) -> Option<&AccountInfo<'info>>; + fn token_rent_sponsor(&self) -> Option<&AccountInfo<'info>>; + fn token_program(&self) -> Option<&AccountInfo<'info>>; + fn token_cpi_authority(&self) -> Option<&AccountInfo<'info>>; + fn token_config(&self) -> Option<&AccountInfo<'info>>; /// Collect and unpack compressed accounts into PDAs and tokens. /// @@ -95,12 +95,12 @@ pub trait DecompressContext<'info> { &self, remaining_accounts: &[AccountInfo<'info>], fee_payer: &AccountInfo<'info>, - ctoken_program: &AccountInfo<'info>, - ctoken_rent_sponsor: &AccountInfo<'info>, - ctoken_cpi_authority: &AccountInfo<'info>, - ctoken_config: &AccountInfo<'info>, + token_program: &AccountInfo<'info>, + token_rent_sponsor: &AccountInfo<'info>, + token_cpi_authority: &AccountInfo<'info>, + token_config: &AccountInfo<'info>, config: &AccountInfo<'info>, - ctoken_accounts: Vec<(Self::PackedTokenData, Self::CompressedMeta)>, + token_accounts: Vec<(Self::PackedTokenData, Self::CompressedMeta)>, proof: crate::instruction::ValidityProof, cpi_accounts: &CpiAccounts<'b, 'info>, post_system_accounts: &[AccountInfo<'info>], @@ -132,7 +132,7 @@ pub trait PdaSeedDerivation { pub fn check_account_types(compressed_accounts: &[T]) -> (bool, bool) { let (mut has_tokens, mut has_pdas) = (false, false); for account in compressed_accounts { - if account.is_packed_ctoken() { + if account.is_packed_token() { has_tokens = true; } else { has_pdas = true; @@ -330,26 +330,26 @@ where // Decompress tokens via trait method if has_tokens { - let ctoken_program = ctx - .ctoken_program() + let token_program = ctx + .token_program() .ok_or(ProgramError::NotEnoughAccountKeys)?; - let ctoken_rent_sponsor = ctx - .ctoken_rent_sponsor() + let token_rent_sponsor = ctx + .token_rent_sponsor() .ok_or(ProgramError::NotEnoughAccountKeys)?; - let ctoken_cpi_authority = ctx - .ctoken_cpi_authority() + let token_cpi_authority = ctx + .token_cpi_authority() .ok_or(ProgramError::NotEnoughAccountKeys)?; - let ctoken_config = ctx - .ctoken_config() + let token_config = ctx + .token_config() .ok_or(ProgramError::NotEnoughAccountKeys)?; ctx.process_tokens( remaining_accounts, fee_payer, - ctoken_program, - ctoken_rent_sponsor, - ctoken_cpi_authority, - ctoken_config, + token_program, + token_rent_sponsor, + token_cpi_authority, + token_config, ctx.config(), compressed_token_accounts, proof, diff --git a/sdk-libs/sdk/src/compressible/mod.rs b/sdk-libs/sdk/src/compressible/mod.rs index 6942dd4412..666751140d 100644 --- a/sdk-libs/sdk/src/compressible/mod.rs +++ b/sdk-libs/sdk/src/compressible/mod.rs @@ -36,5 +36,5 @@ pub use decompress_idempotent::{ #[cfg(feature = "v2")] pub use decompress_runtime::{ check_account_types, handle_packed_pda_variant, process_decompress_accounts_idempotent, - CTokenSeedProvider, DecompressContext, HasTokenVariant, PdaSeedDerivation, + DecompressContext, HasTokenVariant, PdaSeedDerivation, TokenSeedProvider, }; diff --git a/sdk-libs/token-client/Cargo.toml b/sdk-libs/token-client/Cargo.toml index 8c5d9ba026..5a2b2d3188 100644 --- a/sdk-libs/token-client/Cargo.toml +++ b/sdk-libs/token-client/Cargo.toml @@ -13,7 +13,7 @@ light-compressible = { workspace = true, features = ["anchor"] } light-token-interface = { workspace = true } light-sdk = { workspace = true } light-client = { workspace = true, features = ["v2"] } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } light-zero-copy = { workspace = true } # Solana dependencies diff --git a/sdk-libs/token-client/src/actions/create_compressible_token_account.rs b/sdk-libs/token-client/src/actions/create_compressible_token_account.rs index 470f664d9c..c283803e77 100644 --- a/sdk-libs/token-client/src/actions/create_compressible_token_account.rs +++ b/sdk-libs/token-client/src/actions/create_compressible_token_account.rs @@ -1,6 +1,6 @@ use light_client::rpc::{Rpc, RpcError}; use light_token_interface::{has_restricted_extensions, state::TokenDataVersion}; -use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; +use light_token_sdk::token::{CompressibleParams, CreateTokenAccount}; use solana_keypair::Keypair; use solana_pubkey::Pubkey; use solana_signer::Signer; @@ -71,7 +71,7 @@ pub async fn create_compressible_token_account( }; let create_token_account_ix = - CreateCTokenAccount::new(payer.pubkey(), token_account_pubkey, mint, owner) + CreateTokenAccount::new(payer.pubkey(), token_account_pubkey, mint, owner) .with_compressible(compressible_params) .instruction() .map_err(|e| RpcError::CustomError(format!("Failed to create instruction: {}", e)))?; diff --git a/sdk-libs/token-client/src/actions/mint_action.rs b/sdk-libs/token-client/src/actions/mint_action.rs index 115d819bf4..81a3f1e9e9 100644 --- a/sdk-libs/token-client/src/actions/mint_action.rs +++ b/sdk-libs/token-client/src/actions/mint_action.rs @@ -3,7 +3,7 @@ use light_client::{ rpc::{Rpc, RpcError}, }; use light_token_interface::instructions::mint_action::Recipient; -use light_ctoken_sdk::compressed_token::create_compressed_mint::{ +use light_token_sdk::compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }; use solana_keypair::Keypair; @@ -105,13 +105,13 @@ pub async fn mint_action_comprehensive( } if !mint_to_decompressed_recipients.is_empty() { - use light_ctoken_sdk::ctoken::derive_ctoken_ata; + use light_token_sdk::token::derive_token_ata; let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); for recipient in mint_to_decompressed_recipients { let recipient_pubkey = solana_pubkey::Pubkey::from(recipient.recipient.to_bytes()); - let (ata_address, _) = derive_ctoken_ata(&recipient_pubkey, &spl_mint_pda); + let (ata_address, _) = derive_token_ata(&recipient_pubkey, &spl_mint_pda); actions.push(MintActionType::MintToCToken { account: ata_address, diff --git a/sdk-libs/token-client/src/actions/spl_interface.rs b/sdk-libs/token-client/src/actions/spl_interface.rs index d5b2dcc89e..58052301da 100644 --- a/sdk-libs/token-client/src/actions/spl_interface.rs +++ b/sdk-libs/token-client/src/actions/spl_interface.rs @@ -4,7 +4,7 @@ use light_client::rpc::{Rpc, RpcError}; use light_token_interface::has_restricted_extensions; -use light_ctoken_sdk::spl_interface::{find_spl_interface_pda, CreateSplInterfacePda}; +use light_token_sdk::spl_interface::{find_spl_interface_pda, CreateSplInterfacePda}; use solana_keypair::Keypair; use solana_pubkey::Pubkey; use solana_signature::Signature; diff --git a/sdk-libs/token-client/src/actions/transfer2/compress.rs b/sdk-libs/token-client/src/actions/transfer2/compress.rs index d7bebc1929..745a9873c0 100644 --- a/sdk-libs/token-client/src/actions/transfer2/compress.rs +++ b/sdk-libs/token-client/src/actions/transfer2/compress.rs @@ -26,7 +26,7 @@ use crate::instructions::transfer2::{ /// * `decimals` - Mint decimals for SPL transfer_checked /// /// # Returns -/// `Result` - The compression instruction +/// `Result` - The compression instruction pub async fn compress( rpc: &mut R, solana_token_account: Pubkey, diff --git a/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs b/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs index 99222b3613..b232f85bfd 100644 --- a/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs +++ b/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs @@ -2,8 +2,8 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_sdk::{ - constants::SPL_TOKEN_PROGRAM_ID, ctoken::TransferCTokenToSpl, +use light_token_sdk::{ + constants::SPL_TOKEN_PROGRAM_ID, ctoken::TransferTokenToSpl, spl_interface::find_spl_interface_pda, }; use solana_keypair::Keypair; @@ -25,7 +25,7 @@ pub async fn transfer_ctoken_to_spl( ) -> Result { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda(&mint, false); - let transfer_ix = TransferCTokenToSpl { + let transfer_ix = TransferTokenToSpl { source_ctoken_account, destination_spl_token_account, amount, diff --git a/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs b/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs index f78665398a..dc35962af2 100644 --- a/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs +++ b/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs @@ -2,8 +2,8 @@ use light_client::{ indexer::Indexer, rpc::{Rpc, RpcError}, }; -use light_ctoken_sdk::{ - constants::SPL_TOKEN_PROGRAM_ID, ctoken::TransferSplToCtoken, +use light_token_sdk::{ + constants::SPL_TOKEN_PROGRAM_ID, ctoken::TransferSplToToken, spl_interface::find_spl_interface_pda, }; use solana_keypair::Keypair; @@ -35,7 +35,7 @@ pub async fn spl_to_ctoken_transfer( let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda(&mint, false); - let ix = TransferSplToCtoken { + let ix = TransferSplToToken { amount, spl_interface_pda_bump, source_spl_token_account, diff --git a/sdk-libs/token-client/src/instructions/create_mint.rs b/sdk-libs/token-client/src/instructions/create_mint.rs index 5a9ef8bb6a..3cffc9cdd4 100644 --- a/sdk-libs/token-client/src/instructions/create_mint.rs +++ b/sdk-libs/token-client/src/instructions/create_mint.rs @@ -5,7 +5,7 @@ use light_client::{ use light_token_interface::instructions::extensions::{ token_metadata::TokenMetadataInstructionData, ExtensionInstructionData, }; -use light_ctoken_sdk::ctoken::{ +use light_token_sdk::token::{ derive_cmint_compressed_address, find_cmint_address, CreateCMint, CreateCMintParams, }; use solana_instruction::Instruction; diff --git a/sdk-libs/token-client/src/instructions/mint_action.rs b/sdk-libs/token-client/src/instructions/mint_action.rs index 2363e34755..8a6ad34c33 100644 --- a/sdk-libs/token-client/src/instructions/mint_action.rs +++ b/sdk-libs/token-client/src/instructions/mint_action.rs @@ -10,7 +10,7 @@ use light_token_interface::{ extensions::{token_metadata::TokenMetadataInstructionData, ExtensionInstructionData}, mint_action::{ CompressAndCloseCMintAction, CompressedMintWithContext, DecompressMintAction, - MintActionCompressedInstructionData, MintToTokenAction, MintToCompressedAction, + MintActionCompressedInstructionData, MintToCompressedAction, MintToTokenAction, Recipient, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }, @@ -18,7 +18,7 @@ use light_token_interface::{ state::CompressedMint, LIGHT_TOKEN_PROGRAM_ID, }; -use light_ctoken_sdk::compressed_token::{ +use light_token_sdk::compressed_token::{ create_compressed_mint::{derive_cmint_compressed_address, find_cmint_address}, mint_action::MintActionMetaConfig, }; diff --git a/sdk-libs/token-client/src/instructions/mint_to_compressed.rs b/sdk-libs/token-client/src/instructions/mint_to_compressed.rs index fda3fc5e34..a319506de2 100644 --- a/sdk-libs/token-client/src/instructions/mint_to_compressed.rs +++ b/sdk-libs/token-client/src/instructions/mint_to_compressed.rs @@ -7,7 +7,7 @@ use light_token_interface::{ instructions::mint_action::{CompressedMintWithContext, Recipient}, state::{CompressedMint, TokenDataVersion}, }; -use light_ctoken_sdk::compressed_token::{ +use light_token_sdk::compressed_token::{ create_compressed_mint::derive_cmint_from_spl_mint, mint_to_compressed::{ create_mint_to_compressed_instruction, DecompressedMintConfig, MintToCompressedInputs, @@ -63,7 +63,7 @@ pub async fn mint_to_compressed_instruction( unimplemented!("SPL mint synchronization for decompressed CMint not yet implemented"); } let decompressed_mint_config: Option> = None; - let spl_interface_pda: Option = None; + let spl_interface_pda: Option = None; // Prepare compressed mint inputs let compressed_mint_inputs = CompressedMintWithContext { diff --git a/sdk-libs/token-client/src/instructions/transfer2.rs b/sdk-libs/token-client/src/instructions/transfer2.rs index abb6c58ad9..1bf3cdc213 100644 --- a/sdk-libs/token-client/src/instructions/transfer2.rs +++ b/sdk-libs/token-client/src/instructions/transfer2.rs @@ -2,6 +2,7 @@ use light_client::{ indexer::{CompressedTokenAccount, Indexer}, rpc::Rpc, }; +use light_sdk::instruction::{PackedAccounts, PackedStateTreeInfo}; use light_token_interface::{ instructions::{ extensions::ExtensionInstructionData, @@ -10,7 +11,7 @@ use light_token_interface::{ state::TokenDataVersion, LIGHT_TOKEN_PROGRAM_ID, }; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::{ transfer2::{ account_metas::Transfer2AccountsMetaConfig, create_transfer2_instruction, @@ -18,10 +19,9 @@ use light_ctoken_sdk::{ }, CTokenAccount2, }, - error::CTokenSdkError, + error::TokenSdkError, spl_interface::find_spl_interface_pda_with_index, }; -use light_sdk::instruction::{PackedAccounts, PackedStateTreeInfo}; use solana_instruction::Instruction; use solana_pubkey::Pubkey; @@ -84,7 +84,7 @@ pub async fn create_decompress_instruction( solana_token_account: Pubkey, payer: Pubkey, decimals: u8, -) -> Result { +) -> Result { create_generic_transfer2_instruction( rpc, vec![Transfer2InstructionType::Decompress(DecompressInput { @@ -168,7 +168,7 @@ pub async fn create_generic_transfer2_instruction( actions: Vec, payer: Pubkey, should_filter_zero_outputs: bool, -) -> Result { +) -> Result { // // Get a single shared output queue for ALL compress/compress-and-close operations // // This prevents reordering issues caused by the sort_by_key at the end // let shared_output_queue = rpc @@ -252,7 +252,7 @@ pub async fn create_generic_transfer2_instruction( ) .map(|(account, rpc_account)| { if input.to != account.token.owner { - return Err(CTokenSdkError::InvalidCompressInputOwner); + return Err(TokenSdkError::InvalidCompressInputOwner); } Ok(pack_input_token_account( account, @@ -488,7 +488,7 @@ pub async fn create_generic_transfer2_instruction( if token_data.is_empty() { // When no input accounts, create recipient account directly // This requires mint to be specified in the input - let mint = input.mint.ok_or(CTokenSdkError::InvalidAccountData)?; + let mint = input.mint.ok_or(TokenSdkError::InvalidAccountData)?; let recipient_index = packed_tree_accounts.insert_or_get(input.to); let mint_index = packed_tree_accounts.insert_or_get_read_only(mint); @@ -589,14 +589,14 @@ pub async fn create_generic_transfer2_instruction( let token_account_info = rpc .get_account(input.solana_ctoken_account) .await - .map_err(|_| CTokenSdkError::InvalidAccountData)? - .ok_or(CTokenSdkError::InvalidAccountData)?; + .map_err(|_| TokenSdkError::InvalidAccountData)? + .ok_or(TokenSdkError::InvalidAccountData)?; // Parse the compressed token account using zero-copy deserialization use light_token_interface::state::Token; use light_zero_copy::traits::ZeroCopyAt; let (compressed_token, _) = Token::zero_copy_at(&token_account_info.data) - .map_err(|_| CTokenSdkError::InvalidAccountData)?; + .map_err(|_| TokenSdkError::InvalidAccountData)?; let mint = compressed_token.mint; let balance: u64 = compressed_token.amount.into(); let owner = compressed_token.owner; @@ -604,7 +604,7 @@ pub async fn create_generic_transfer2_instruction( // Extract rent_sponsor, compression_authority, and compress_to_pubkey from Compressible extension let compressible_ext = compressed_token .get_compressible_extension() - .ok_or(CTokenSdkError::MissingCompressibleExtension)?; + .ok_or(TokenSdkError::MissingCompressibleExtension)?; let rent_sponsor = compressible_ext.info.rent_sponsor; let _compression_authority = compressible_ext.info.compression_authority; let compress_to_pubkey = compressible_ext.info.compress_to_pubkey == 1; diff --git a/sdk-libs/token-client/src/instructions/update_compressed_mint.rs b/sdk-libs/token-client/src/instructions/update_compressed_mint.rs index 54be8dec02..41abfc0d01 100644 --- a/sdk-libs/token-client/src/instructions/update_compressed_mint.rs +++ b/sdk-libs/token-client/src/instructions/update_compressed_mint.rs @@ -7,7 +7,7 @@ use light_token_interface::{ instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, state::CompressedMint, }; -use light_ctoken_sdk::compressed_token::update_compressed_mint::{ +use light_token_sdk::compressed_token::update_compressed_mint::{ update_compressed_mint, UpdateCompressedMintInputs, }; use light_token_types::CompressedMintAuthorityType; diff --git a/sdk-libs/token-client/src/lib.rs b/sdk-libs/token-client/src/lib.rs index 837768eee1..76dda47d75 100644 --- a/sdk-libs/token-client/src/lib.rs +++ b/sdk-libs/token-client/src/lib.rs @@ -1,4 +1,4 @@ pub mod actions; pub mod instructions; // re-export -pub use light_ctoken_sdk::ctoken; +pub use light_token_sdk::token; diff --git a/sdk-libs/ctoken-sdk/Cargo.toml b/sdk-libs/token-sdk/Cargo.toml similarity index 98% rename from sdk-libs/ctoken-sdk/Cargo.toml rename to sdk-libs/token-sdk/Cargo.toml index f7962290c5..e41319b851 100644 --- a/sdk-libs/ctoken-sdk/Cargo.toml +++ b/sdk-libs/token-sdk/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "light-ctoken-sdk" +name = "light-token-sdk" version = "0.2.1" edition = { workspace = true } description = "SDK for compressed tokens on Light Protocol" diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/ctoken_instruction.rs b/sdk-libs/token-sdk/src/compressed_token/ctoken_instruction.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/ctoken_instruction.rs rename to sdk-libs/token-sdk/src/compressed_token/ctoken_instruction.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/mod.rs b/sdk-libs/token-sdk/src/compressed_token/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/account.rs b/sdk-libs/token-sdk/src/compressed_token/v1/account.rs similarity index 91% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/account.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/account.rs index b297067011..25e7b0c282 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/account.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v1/account.rs @@ -3,7 +3,7 @@ use std::ops::Deref; use light_token_types::{PackedTokenTransferOutputData, TokenAccountMeta}; use solana_pubkey::Pubkey; -use crate::error::CTokenSdkError; +use crate::error::TokenSdkError; #[derive(Debug, PartialEq, Clone)] pub struct CTokenAccount { @@ -68,9 +68,9 @@ impl CTokenAccount { recipient: &Pubkey, amount: u64, output_merkle_tree_index: Option, - ) -> Result { + ) -> Result { if amount > self.output.amount { - return Err(CTokenSdkError::InsufficientBalance); + return Err(TokenSdkError::InsufficientBalance); } // TODO: skip outputs with zero amount when creating the instruction data. self.output.amount -= amount; @@ -103,9 +103,9 @@ impl CTokenAccount { _delegate: &Pubkey, amount: u64, output_merkle_tree_index: Option, - ) -> Result { + ) -> Result { if amount > self.output.amount { - return Err(CTokenSdkError::InsufficientBalance); + return Err(TokenSdkError::InsufficientBalance); } // Deduct the delegated amount from current account @@ -134,11 +134,11 @@ impl CTokenAccount { } // TODO: consider this might be confusing because it must not be used in combination with fn compress() - pub fn compress(&mut self, amount: u64) -> Result<(), CTokenSdkError> { + pub fn compress(&mut self, amount: u64) -> Result<(), TokenSdkError> { self.output.amount += amount; self.is_compress = true; if self.is_decompress { - return Err(CTokenSdkError::CannotCompressAndDecompress); + return Err(TokenSdkError::CannotCompressAndDecompress); } match self.compression_amount.as_mut() { @@ -151,12 +151,12 @@ impl CTokenAccount { } // TODO: consider this might be confusing because it must not be used in combination with fn decompress() - pub fn decompress(&mut self, amount: u64) -> Result<(), CTokenSdkError> { + pub fn decompress(&mut self, amount: u64) -> Result<(), TokenSdkError> { if self.is_compress { - return Err(CTokenSdkError::CannotCompressAndDecompress); + return Err(TokenSdkError::CannotCompressAndDecompress); } if self.output.amount < amount { - return Err(CTokenSdkError::InsufficientBalance); + return Err(TokenSdkError::InsufficientBalance); } self.output.amount -= amount; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v1/approve/account_metas.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/account_metas.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/approve/account_metas.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs b/sdk-libs/token-sdk/src/compressed_token/v1/approve/instruction.rs similarity index 93% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/approve/instruction.rs index 785090482d..424c4d81fd 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/instruction.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v1/approve/instruction.rs @@ -9,7 +9,7 @@ use solana_pubkey::Pubkey; use super::account_metas::{get_approve_instruction_account_metas, ApproveMetaConfig}; use crate::{ compressed_token::v1::CTokenAccount, - error::{CTokenSdkError, Result}, + error::{Result, TokenSdkError}, }; #[derive(Debug, Clone)] @@ -35,13 +35,13 @@ pub fn create_approve_instruction(inputs: ApproveInputs) -> Result let (input_token_data, _) = inputs.sender_account.into_inputs_and_outputs(); if input_token_data.is_empty() { - return Err(CTokenSdkError::InsufficientBalance); + return Err(TokenSdkError::InsufficientBalance); } // Calculate total input amount let total_input_amount: u64 = input_token_data.iter().map(|data| data.amount).sum(); if total_input_amount < inputs.delegated_amount { - return Err(CTokenSdkError::InsufficientBalance); + return Err(TokenSdkError::InsufficientBalance); } // Use the input token data directly since it's already in the correct format @@ -63,7 +63,7 @@ pub fn create_approve_instruction(inputs: ApproveInputs) -> Result // Serialize instruction data let serialized_data = instruction_data .try_to_vec() - .map_err(|_| CTokenSdkError::SerializationError)?; + .map_err(|_| TokenSdkError::SerializationError)?; // Create account meta config let meta_config = ApproveMetaConfig::new( diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v1/approve/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/approve/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/approve/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/account_metas.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/account_metas.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/account_metas.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs b/sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/instruction.rs similarity index 96% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/instruction.rs index 75041bdc3a..50b4033156 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/instruction.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/instruction.rs @@ -7,7 +7,7 @@ use solana_pubkey::Pubkey; use super::account_metas::{get_batch_compress_instruction_account_metas, BatchCompressMetaConfig}; use crate::{ - error::{CTokenSdkError, Result}, + error::{Result, TokenSdkError}, AnchorDeserialize, AnchorSerialize, }; @@ -54,7 +54,7 @@ pub fn create_batch_compress_instruction(inputs: BatchCompressInputs) -> Result< // Serialize instruction data let data_vec = instruction_data .try_to_vec() - .map_err(|_| CTokenSdkError::SerializationError)?; + .map_err(|_| TokenSdkError::SerializationError)?; let mut data = Vec::with_capacity(data_vec.len() + 8 + 4); data.extend_from_slice(BATCH_COMPRESS.as_slice()); data.extend_from_slice( diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/batch_compress/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v1/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/account_infos.rs b/sdk-libs/token-sdk/src/compressed_token/v1/transfer/account_infos.rs similarity index 96% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/account_infos.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/transfer/account_infos.rs index e6a03a7d8f..f3f495917a 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/account_infos.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v1/transfer/account_infos.rs @@ -24,7 +24,7 @@ impl<'info, const N: usize> TransferAccountInfos<'_, 'info, N> { // 722 with array vec pub fn into_account_infos(self) -> ArrayVec, N> { let mut capacity = 2 + self.ctoken_accounts.len() + self.packed_accounts.len(); - let ctoken_program_id_index = self.ctoken_accounts.len() - 2; + let light_token_program_id_index = self.ctoken_accounts.len() - 2; if self.cpi_context.is_some() { capacity += 1; } @@ -46,7 +46,7 @@ impl<'info, const N: usize> TransferAccountInfos<'_, 'info, N> { if let Some(cpi_context) = self.cpi_context { account_infos.push(cpi_context.clone()); } else { - account_infos.push(self.ctoken_accounts[ctoken_program_id_index].clone()); + account_infos.push(self.ctoken_accounts[light_token_program_id_index].clone()); } // Add tree accounts diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v1/transfer/account_metas.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/account_metas.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/transfer/account_metas.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs b/sdk-libs/token-sdk/src/compressed_token/v1/transfer/instruction.rs similarity index 95% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/transfer/instruction.rs index 69a6126b05..f1f5dfc648 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/instruction.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v1/transfer/instruction.rs @@ -9,7 +9,7 @@ use solana_pubkey::Pubkey; use super::account_metas::{get_transfer_instruction_account_metas, TokenAccountsMetaConfig}; use crate::{ compressed_token::v1::account::CTokenAccount, - error::{CTokenSdkError, Result}, + error::{Result, TokenSdkError}, AnchorSerialize, }; // CTokenAccount abstraction to bundle inputs and create outputs. @@ -65,17 +65,17 @@ pub fn create_transfer_instruction_raw( // Check 1: cpi accounts must be decompress or compress consistent with accounts if (is_compress && !meta_config.is_compress) || (is_decompress && !meta_config.is_decompress) { - return Err(CTokenSdkError::InconsistentCompressDecompressState); + return Err(TokenSdkError::InconsistentCompressDecompressState); } // Check 2: there can only be compress or decompress not both if is_compress && is_decompress { - return Err(CTokenSdkError::BothCompressAndDecompress); + return Err(TokenSdkError::BothCompressAndDecompress); } // Check 3: compress_or_decompress_amount must be Some if compress_or_decompress_amount.is_none() && meta_config.is_compress_or_decompress() { - return Err(CTokenSdkError::InvalidCompressDecompressAmount); + return Err(TokenSdkError::InvalidCompressDecompressAmount); } // Extract input and output data from token accounts @@ -110,7 +110,7 @@ pub fn create_transfer_instruction_raw( // TODO: calculate exact len. let serialized = instruction_data .try_to_vec() - .map_err(|_| CTokenSdkError::SerializationError)?; + .map_err(|_| TokenSdkError::SerializationError)?; // Serialize instruction data let mut data = Vec::with_capacity(8 + 4 + serialized.len()); // rough estimate @@ -214,7 +214,7 @@ pub fn transfer(inputs: TransferInputs) -> Result { } = inputs; // Sanity check. if sender_account.method_used { - return Err(CTokenSdkError::MethodUsed); + return Err(TokenSdkError::MethodUsed); } let account_meta_config = TokenAccountsMetaConfig::new(fee_payer, sender_account.owner()); // None is the same output_tree_index as token account @@ -257,7 +257,7 @@ pub fn decompress(inputs: DecompressInputs) -> Result { } = inputs; // Sanity check. if sender_account.method_used { - return Err(CTokenSdkError::MethodUsed); + return Err(TokenSdkError::MethodUsed); } let account_meta_config = TokenAccountsMetaConfig::decompress( fee_payer, diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v1/transfer/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v1/transfer/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v1/transfer/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/account2.rs b/sdk-libs/token-sdk/src/compressed_token/v2/account2.rs similarity index 89% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/account2.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/account2.rs index 0d5df86b75..74a2ce335f 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/account2.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/account2.rs @@ -1,13 +1,13 @@ use std::ops::Deref; +use light_program_profiler::profile; use light_token_interface::instructions::transfer2::{ Compression, CompressionMode, MultiInputTokenDataWithContext, MultiTokenTransferOutputData, }; -use light_program_profiler::profile; use solana_account_info::AccountInfo; use solana_pubkey::Pubkey; -use crate::{error::CTokenSdkError, utils::get_token_account_balance}; +use crate::{error::TokenSdkError, utils::get_token_account_balance}; #[derive(Debug, PartialEq, Clone)] pub struct CTokenAccount2 { @@ -20,13 +20,13 @@ pub struct CTokenAccount2 { impl CTokenAccount2 { #[profile] - pub fn new(token_data: Vec) -> Result { + pub fn new(token_data: Vec) -> Result { // all mint indices must be the same // all owners must be the same let amount = token_data.iter().map(|data| data.amount).sum(); // Check if token_data is empty if token_data.is_empty() { - return Err(CTokenSdkError::NoInputAccounts); + return Err(TokenSdkError::NoInputAccounts); } // Use the indices from the first token data (assuming they're all the same mint/owner) @@ -56,13 +56,13 @@ impl CTokenAccount2 { #[profile] pub fn new_delegated( token_data: Vec, - ) -> Result { + ) -> Result { // all mint indices must be the same // all owners must be the same let amount = token_data.iter().map(|data| data.amount).sum(); // Check if token_data is empty if token_data.is_empty() { - return Err(CTokenSdkError::NoInputAccounts); + return Err(TokenSdkError::NoInputAccounts); } // Use the indices from the first token data (assuming they're all the same mint/owner) @@ -107,9 +107,9 @@ impl CTokenAccount2 { // TODO: consider this might be confusing because it must not be used in combination with fn transfer() // could mark the struct as transferred and throw in fn transfer #[profile] - pub fn transfer(&mut self, recipient_index: u8, amount: u64) -> Result { + pub fn transfer(&mut self, recipient_index: u8, amount: u64) -> Result { if amount > self.output.amount { - return Err(CTokenSdkError::InsufficientBalance); + return Err(TokenSdkError::InsufficientBalance); } // TODO: skip outputs with zero amount when creating the instruction data. self.output.amount -= amount; @@ -136,9 +136,9 @@ impl CTokenAccount2 { /// and returns a new CTokenAccount that represents the delegated portion. /// The original account balance is reduced by the delegated amount. #[profile] - pub fn approve(&mut self, delegate_index: u8, amount: u64) -> Result { + pub fn approve(&mut self, delegate_index: u8, amount: u64) -> Result { if amount > self.output.amount { - return Err(CTokenSdkError::InsufficientBalance); + return Err(TokenSdkError::InsufficientBalance); } // Deduct the delegated amount from current account @@ -171,10 +171,10 @@ impl CTokenAccount2 { amount: u64, source_or_recipient_index: u8, authority: u8, - ) -> Result<(), CTokenSdkError> { + ) -> Result<(), TokenSdkError> { // Check if there's already a compression set if self.compression.is_some() { - return Err(CTokenSdkError::CompressionCannotBeSetTwice); + return Err(TokenSdkError::CompressionCannotBeSetTwice); } self.output.amount += amount; @@ -200,10 +200,10 @@ impl CTokenAccount2 { pool_index: u8, bump: u8, decimals: u8, - ) -> Result<(), CTokenSdkError> { + ) -> Result<(), TokenSdkError> { // Check if there's already a compression set if self.compression.is_some() { - return Err(CTokenSdkError::CompressionCannotBeSetTwice); + return Err(TokenSdkError::CompressionCannotBeSetTwice); } self.output.amount += amount; @@ -224,18 +224,14 @@ impl CTokenAccount2 { // TODO: consider this might be confusing because it must not be used in combination with fn decompress() #[profile] - pub fn decompress_token( - &mut self, - amount: u64, - source_index: u8, - ) -> Result<(), CTokenSdkError> { + pub fn decompress_token(&mut self, amount: u64, source_index: u8) -> Result<(), TokenSdkError> { // Check if there's already a compression set if self.compression.is_some() { - return Err(CTokenSdkError::CompressionCannotBeSetTwice); + return Err(TokenSdkError::CompressionCannotBeSetTwice); } if self.output.amount < amount { - return Err(CTokenSdkError::InsufficientBalance); + return Err(TokenSdkError::InsufficientBalance); } self.output.amount -= amount; @@ -258,14 +254,14 @@ impl CTokenAccount2 { pool_index: u8, bump: u8, decimals: u8, - ) -> Result<(), CTokenSdkError> { + ) -> Result<(), TokenSdkError> { // Check if there's already a compression set if self.compression.is_some() { - return Err(CTokenSdkError::CompressionCannotBeSetTwice); + return Err(TokenSdkError::CompressionCannotBeSetTwice); } if self.output.amount < amount { - return Err(CTokenSdkError::InsufficientBalance); + return Err(TokenSdkError::InsufficientBalance); } self.output.amount -= amount; @@ -289,10 +285,10 @@ impl CTokenAccount2 { source_or_recipient_index: u8, authority: u8, token_account_info: &AccountInfo, - ) -> Result<(), CTokenSdkError> { + ) -> Result<(), TokenSdkError> { // Check if there's already a compression set if self.compression.is_some() { - return Err(CTokenSdkError::CompressionCannotBeSetTwice); + return Err(TokenSdkError::CompressionCannotBeSetTwice); } // Get the actual token account balance to add to output @@ -327,10 +323,10 @@ impl CTokenAccount2 { rent_sponsor_index: u8, compressed_account_index: u8, destination_index: u8, - ) -> Result<(), CTokenSdkError> { + ) -> Result<(), TokenSdkError> { // Check if there's already a compression set if self.compression.is_some() { - return Err(CTokenSdkError::CompressionCannotBeSetTwice); + return Err(TokenSdkError::CompressionCannotBeSetTwice); } // Add the full balance to the output amount diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/compress_and_close.rs b/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs similarity index 93% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/compress_and_close.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs index f38991080f..d7037081eb 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/compress_and_close.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs @@ -1,9 +1,9 @@ -use light_token_interface::{instructions::transfer2::CompressedCpiContext, state::Token}; use light_program_profiler::profile; use light_sdk::{ error::LightSdkError, instruction::{AccountMetasVec, PackedAccounts, SystemAccountMetaConfig}, }; +use light_token_interface::{instructions::transfer2::CompressedCpiContext, state::Token}; use light_zero_copy::traits::ZeroCopyAt; use solana_account_info::AccountInfo; use solana_cpi::invoke_signed; @@ -19,7 +19,7 @@ use super::{ }, }; use crate::{ - error::CTokenSdkError, + error::TokenSdkError, utils::{AccountInfoToCompress, CTokenDefaultAccounts}, }; @@ -40,7 +40,7 @@ pub fn pack_for_compress_and_close( ctoken_account_pubkey: Pubkey, ctoken_account_data: &[u8], packed_accounts: &mut PackedAccounts, -) -> Result { +) -> Result { let (ctoken_account, _) = Token::zero_copy_at(ctoken_account_data)?; let source_index = packed_accounts.insert_or_get(ctoken_account_pubkey); let mint_index = packed_accounts.insert_or_get(Pubkey::from(ctoken_account.mint.to_bytes())); @@ -49,7 +49,7 @@ pub fn pack_for_compress_and_close( // Get compression info from Compressible extension let compressible_ext = ctoken_account .get_compressible_extension() - .ok_or(CTokenSdkError::MissingCompressibleExtension)?; + .ok_or(TokenSdkError::MissingCompressibleExtension)?; let authority_index = packed_accounts.insert_or_get_config( Pubkey::from(compressible_ext.info.compression_authority), true, @@ -81,35 +81,35 @@ fn find_account_indices( authority: &Pubkey, rent_sponsor_pubkey: &Pubkey, destination_pubkey: &Pubkey, -) -> Result { +) -> Result { let source_index = find_index(ctoken_account_key).ok_or_else(|| { msg!("Source ctoken account not found in packed_accounts"); - CTokenSdkError::InvalidAccountData + TokenSdkError::InvalidAccountData })?; let mint_index = find_index(mint_pubkey).ok_or_else(|| { msg!("Mint {} not found in packed_accounts", mint_pubkey); - CTokenSdkError::InvalidAccountData + TokenSdkError::InvalidAccountData })?; let owner_index = find_index(owner_pubkey).ok_or_else(|| { msg!("Owner {} not found in packed_accounts", owner_pubkey); - CTokenSdkError::InvalidAccountData + TokenSdkError::InvalidAccountData })?; let authority_index = find_index(authority).ok_or_else(|| { msg!("Authority not found in packed_accounts"); - CTokenSdkError::InvalidAccountData + TokenSdkError::InvalidAccountData })?; let rent_sponsor_index = find_index(rent_sponsor_pubkey).ok_or_else(|| { msg!("Rent recipient not found in packed_accounts"); - CTokenSdkError::InvalidAccountData + TokenSdkError::InvalidAccountData })?; let destination_index = find_index(destination_pubkey).ok_or_else(|| { msg!("Destination not found in packed_accounts"); - CTokenSdkError::InvalidAccountData + TokenSdkError::InvalidAccountData })?; Ok(CompressAndCloseIndices { @@ -138,10 +138,10 @@ pub fn compress_and_close_ctoken_accounts_with_indices<'info>( cpi_context_pubkey: Option, indices: &[CompressAndCloseIndices], packed_accounts: &[AccountInfo<'info>], -) -> Result { +) -> Result { if indices.is_empty() { msg!("indices empty"); - return Err(CTokenSdkError::InvalidAccountData); + return Err(TokenSdkError::InvalidAccountData); } // Convert packed_accounts to AccountMetas using ArrayVec to avoid heap allocation let mut packed_account_metas = arrayvec::ArrayVec::::new(); @@ -159,11 +159,11 @@ pub fn compress_and_close_ctoken_accounts_with_indices<'info>( // Get the amount from the source token account let source_account = packed_accounts .get(idx.source_index as usize) - .ok_or(CTokenSdkError::InvalidAccountData)?; + .ok_or(TokenSdkError::InvalidAccountData)?; let account_data = source_account .try_borrow_data() - .map_err(|_| CTokenSdkError::AccountBorrowFailed)?; + .map_err(|_| TokenSdkError::AccountBorrowFailed)?; let amount = light_token_interface::state::Token::amount_from_slice(&account_data)?; @@ -239,10 +239,10 @@ pub fn compress_and_close_ctoken_accounts<'info>( output_queue: AccountInfo<'info>, ctoken_solana_accounts: &[&AccountInfo<'info>], packed_accounts: &[AccountInfo<'info>], -) -> Result { +) -> Result { if ctoken_solana_accounts.is_empty() { msg!("ctoken_solana_accounts empty"); - return Err(CTokenSdkError::InvalidAccountData); + return Err(TokenSdkError::InvalidAccountData); } // Helper function to find index of a pubkey in packed_accounts using linear search @@ -262,12 +262,12 @@ pub fn compress_and_close_ctoken_accounts<'info>( // Deserialize the ctoken Solana account using light zero copy let account_data = ctoken_account_info .try_borrow_data() - .map_err(|_| CTokenSdkError::AccountBorrowFailed)?; + .map_err(|_| TokenSdkError::AccountBorrowFailed)?; // Deserialize the full Token including extensions let (compressed_token, _) = light_token_interface::state::Token::zero_copy_at(&account_data) - .map_err(|_| CTokenSdkError::InvalidAccountData)?; + .map_err(|_| TokenSdkError::InvalidAccountData)?; // Extract pubkeys from the deserialized account let mint_pubkey = Pubkey::from(compressed_token.mint.to_bytes()); @@ -276,7 +276,7 @@ pub fn compress_and_close_ctoken_accounts<'info>( // Get compression info from Compressible extension let compressible_ext = compressed_token .get_compressible_extension() - .ok_or(CTokenSdkError::MissingCompressibleExtension)?; + .ok_or(TokenSdkError::MissingCompressibleExtension)?; let authority = Pubkey::from(compressible_ext.info.compression_authority); let rent_sponsor = Pubkey::from(compressible_ext.info.rent_sponsor); @@ -326,7 +326,7 @@ pub fn compress_and_close_ctoken_accounts_signed<'b, 'info>( cpi_authority: AccountInfo<'info>, post_system: &[AccountInfo<'info>], remaining_accounts: &[AccountInfo<'info>], -) -> Result<(), CTokenSdkError> { +) -> Result<(), TokenSdkError> { let mut packed_accounts = Vec::with_capacity(post_system.len() + 4); packed_accounts.extend_from_slice(post_system); packed_accounts.push(cpi_authority); @@ -360,7 +360,7 @@ pub fn compress_and_close_ctoken_accounts_signed<'b, 'info>( } invoke_signed(&instruction, &account_infos, &all_signer_seeds) - .map_err(|e| CTokenSdkError::CpiError(e.to_string()))?; + .map_err(|e| TokenSdkError::CpiError(e.to_string()))?; Ok(()) } diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/account_metas.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/account_metas.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/account_metas.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs similarity index 96% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs index 3239f769b5..86a667be8a 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs @@ -18,7 +18,7 @@ use crate::{ get_mint_action_instruction_account_metas_cpi_write, MintActionMetaConfig, MintActionMetaConfigCpiWrite, }, - error::{CTokenSdkError, Result}, + error::{Result, TokenSdkError}, AnchorDeserialize, AnchorSerialize, }; @@ -90,7 +90,7 @@ pub fn create_compressed_mint_cpi( let data = instruction_data .data() - .map_err(|_| CTokenSdkError::SerializationError)?; + .map_err(|_| TokenSdkError::SerializationError)?; Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( @@ -124,7 +124,7 @@ pub fn create_compressed_mint_cpi_write( "Invalid CPI context first cpi set or set context must be true {:?}", input.cpi_context ); - return Err(CTokenSdkError::InvalidAccountData); + return Err(TokenSdkError::InvalidAccountData); } let compressed_mint_instruction_data = CompressedMintInstructionData { @@ -158,7 +158,7 @@ pub fn create_compressed_mint_cpi_write( let data = instruction_data .data() - .map_err(|_| CTokenSdkError::SerializationError)?; + .map_err(|_| TokenSdkError::SerializationError)?; Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/create_compressed_mint/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/decompress_full.rs b/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs similarity index 97% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/decompress_full.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs index f2e88458c8..7e351d01cd 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/decompress_full.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs @@ -1,13 +1,13 @@ use light_compressed_account::compressed_account::PackedMerkleContext; -use light_token_interface::instructions::{ - extensions::ExtensionInstructionData, - transfer2::{CompressedCpiContext, MultiInputTokenDataWithContext}, -}; use light_program_profiler::profile; use light_sdk::{ error::LightSdkError, instruction::{AccountMetasVec, PackedAccounts, PackedStateTreeInfo, SystemAccountMetaConfig}, }; +use light_token_interface::instructions::{ + extensions::ExtensionInstructionData, + transfer2::{CompressedCpiContext, MultiInputTokenDataWithContext}, +}; use solana_account_info::AccountInfo; use solana_instruction::{AccountMeta, Instruction}; use solana_pubkey::Pubkey; @@ -20,7 +20,7 @@ use super::{ }, }; use crate::{ - compat::TokenData, error::CTokenSdkError, utils::CTokenDefaultAccounts, AnchorDeserialize, + compat::TokenData, error::TokenSdkError, utils::CTokenDefaultAccounts, AnchorDeserialize, AnchorSerialize, ValidityProof, }; @@ -53,9 +53,9 @@ pub fn decompress_full_ctoken_accounts_with_indices<'info>( cpi_context_pubkey: Option, indices: &[DecompressFullIndices], packed_accounts: &[AccountInfo<'info>], -) -> Result { +) -> Result { if indices.is_empty() { - return Err(CTokenSdkError::InvalidAccountData); + return Err(TokenSdkError::InvalidAccountData); } // Process each set of indices @@ -88,7 +88,7 @@ pub fn decompress_full_ctoken_accounts_with_indices<'info>( let owner_idx = idx.source.owner as usize; if owner_idx >= signer_flags.len() { - return Err(CTokenSdkError::InvalidAccountData); + return Err(TokenSdkError::InvalidAccountData); } signer_flags[owner_idx] = true; } diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs similarity index 99% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/account_metas.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs index 3bdf907999..062975f3db 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs @@ -80,7 +80,7 @@ impl MintActionMetaConfig { cpi_context_pubkey: Pubkey, ) -> crate::error::Result { if instruction_data.cpi_context.is_none() { - return Err(crate::error::CTokenSdkError::CpiContextRequired); + return Err(crate::error::TokenSdkError::CpiContextRequired); } Ok(Self { diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs similarity index 99% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs index 4bcb516e79..051f727c39 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/cpi_accounts.rs @@ -1,15 +1,15 @@ use light_account_checks::{AccountError, AccountInfoTrait, AccountIterator}; -use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; -use light_token_types::CPI_AUTHORITY_PDA; use light_program_profiler::profile; use light_sdk_types::{ ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, LIGHT_SYSTEM_PROGRAM_ID, REGISTERED_PROGRAM_PDA, }; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; +use light_token_types::CPI_AUTHORITY_PDA; use solana_instruction::AccountMeta; use solana_msg::msg; -use crate::error::CTokenSdkError; +use crate::error::TokenSdkError; #[derive(Debug, Clone, Default, Copy)] pub struct MintActionCpiAccountsConfig { @@ -69,7 +69,7 @@ impl<'a, A: AccountInfoTrait + Clone> MintActionCpiAccounts<'a, A> { pub fn try_from_account_infos_full( accounts: &'a [A], config: MintActionCpiAccountsConfig, - ) -> Result { + ) -> Result { let mut iter = AccountIterator::new(accounts); let compressed_token_program = @@ -171,7 +171,7 @@ impl<'a, A: AccountInfoTrait + Clone> MintActionCpiAccounts<'a, A> { /// Simple version for common case (no optional features) #[inline(always)] #[track_caller] - pub fn try_from_account_infos(accounts: &'a [A]) -> Result { + pub fn try_from_account_infos(accounts: &'a [A]) -> Result { Self::try_from_account_infos_full(accounts, MintActionCpiAccountsConfig::default()) } diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/instruction.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/instruction.rs similarity index 97% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/instruction.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/mint_action/instruction.rs index 30d4646c1d..51f341c214 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/instruction.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/instruction.rs @@ -7,7 +7,7 @@ use solana_msg::msg; use solana_program_error::ProgramError; use super::{cpi_accounts::MintActionCpiAccounts, MintActionCpiWriteAccounts}; -use crate::{compressed_token::ctoken_instruction::CTokenInstruction, error::CTokenSdkError}; +use crate::{compressed_token::ctoken_instruction::CTokenInstruction, error::TokenSdkError}; impl CTokenInstruction for MintActionCompressedInstructionData { type ExecuteAccounts<'info, A: light_account_checks::AccountInfoTrait + Clone + 'info> = @@ -24,7 +24,7 @@ impl CTokenInstruction for MintActionCompressedInstructionData { msg!( "CPI context write operations not supported in instruction(). Use instruction_write_to_cpi_context_first() or instruction_write_to_cpi_context_set() instead" ); - return Err(ProgramError::from(CTokenSdkError::InvalidAccountData)); + return Err(ProgramError::from(TokenSdkError::InvalidAccountData)); } } diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_action/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/mint_action/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/account_metas.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/account_metas.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/account_metas.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs similarity index 91% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs index 5326b5fa68..18df3eca1c 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/instruction.rs @@ -9,7 +9,7 @@ use solana_pubkey::Pubkey; use crate::{ compressed_token::mint_action::MintActionMetaConfig, - error::{CTokenSdkError, Result}, + error::{Result, TokenSdkError}, spl_interface::SplInterfacePda, }; @@ -56,11 +56,10 @@ pub fn create_mint_to_compressed_instruction( spl_interface_pda: _, } = inputs; - let mint_to_action = - light_token_interface::instructions::mint_action::MintToCompressedAction { - token_account_version, - recipients, - }; + let mint_to_action = light_token_interface::instructions::mint_action::MintToCompressedAction { + token_account_version, + recipients, + }; let mut instruction_data = light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new( @@ -95,7 +94,7 @@ pub fn create_mint_to_compressed_instruction( let data = instruction_data .data() - .map_err(|_| CTokenSdkError::SerializationError)?; + .map_err(|_| TokenSdkError::SerializationError)?; Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/mint_to_compressed/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/token_metadata_ui.rs b/sdk-libs/token-sdk/src/compressed_token/v2/token_metadata_ui.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/token_metadata_ui.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/token_metadata_ui.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/account_metas.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/account_metas.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/transfer2/account_metas.rs index 8b774ee215..ee5978550a 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/account_metas.rs @@ -1,5 +1,5 @@ -use light_token_types::CPI_AUTHORITY_PDA; use light_sdk::constants::LIGHT_SYSTEM_PROGRAM_ID; +use light_token_types::CPI_AUTHORITY_PDA; use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs b/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs similarity index 97% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs index 722ec73273..e53580487e 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/cpi_accounts.rs @@ -1,15 +1,15 @@ use light_account_checks::{AccountError, AccountInfoTrait, AccountIterator}; -use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; -use light_token_types::CPI_AUTHORITY_PDA; use light_program_profiler::profile; use light_sdk_types::{ ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, LIGHT_SYSTEM_PROGRAM_ID, REGISTERED_PROGRAM_PDA, }; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; +use light_token_types::CPI_AUTHORITY_PDA; use solana_instruction::AccountMeta; use solana_msg::msg; -use crate::error::CTokenSdkError; +use crate::error::TokenSdkError; /// Parsed Transfer2 CPI accounts for structured access #[derive(Debug)] @@ -51,7 +51,7 @@ impl<'a, A: AccountInfoTrait + Clone> Transfer2CpiAccounts<'a, A> { with_sol_decompression: bool, with_cpi_context: bool, light_system_cpi_authority: bool, - ) -> Result { + ) -> Result { let mut iter = AccountIterator::new(accounts); let compressed_token_program = @@ -116,7 +116,7 @@ impl<'a, A: AccountInfoTrait + Clone> Transfer2CpiAccounts<'a, A> { pub fn try_from_account_infos( fee_payer: &'a A, accounts: &'a [A], - ) -> Result { + ) -> Result { Self::try_from_account_infos_full(fee_payer, accounts, false, false, false, false) } @@ -125,7 +125,7 @@ impl<'a, A: AccountInfoTrait + Clone> Transfer2CpiAccounts<'a, A> { pub fn try_from_account_infos_cpi_context( fee_payer: &'a A, accounts: &'a [A], - ) -> Result { + ) -> Result { Self::try_from_account_infos_full(fee_payer, accounts, false, false, true, false) } diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/instruction.rs b/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/instruction.rs similarity index 97% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/instruction.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/transfer2/instruction.rs index 39d5f2c8d0..67a78e893c 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/instruction.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/instruction.rs @@ -1,4 +1,5 @@ use light_compressed_account::instruction_data::compressed_proof::ValidityProof; +use light_program_profiler::profile; use light_token_interface::{ instructions::{ extensions::ExtensionInstructionData, @@ -6,14 +7,13 @@ use light_token_interface::{ }, LIGHT_TOKEN_PROGRAM_ID, TRANSFER2, }; -use light_program_profiler::profile; use solana_instruction::Instruction; use solana_pubkey::Pubkey; use super::account_metas::{get_transfer2_instruction_account_metas, Transfer2AccountsMetaConfig}; use crate::{ compressed_token::CTokenAccount2, - error::{CTokenSdkError, Result}, + error::{Result, TokenSdkError}, AnchorSerialize, }; @@ -137,7 +137,7 @@ pub fn create_transfer2_instruction(inputs: Transfer2Inputs) -> Result Result { // Validate that no token account has been used for token_account in &token_accounts { if token_account.method_used { - return Err(CTokenSdkError::MethodUsed); + return Err(TokenSdkError::MethodUsed); } } diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/transfer2/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/transfer2/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/account_metas.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/account_metas.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/account_metas.rs diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs b/sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs similarity index 96% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs index e0ef8b3873..6dd074f522 100644 --- a/sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/instruction.rs @@ -14,7 +14,7 @@ use crate::{ get_mint_action_instruction_account_metas_cpi_write, MintActionMetaConfig, MintActionMetaConfigCpiWrite, }, - error::{CTokenSdkError, Result}, + error::{Result, TokenSdkError}, AnchorDeserialize, AnchorSerialize, }; @@ -75,7 +75,7 @@ pub fn update_compressed_mint_cpi( let data = instruction_data .data() - .map_err(|_| CTokenSdkError::SerializationError)?; + .map_err(|_| TokenSdkError::SerializationError)?; Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( @@ -108,7 +108,7 @@ pub fn create_update_compressed_mint_cpi_write( inputs: UpdateCompressedMintInputsCpiWrite, ) -> Result { if !inputs.cpi_context.first_set_context && !inputs.cpi_context.set_context { - return Err(CTokenSdkError::InvalidCpiContext); + return Err(TokenSdkError::InvalidCpiContext); } let mut instruction_data = @@ -143,7 +143,7 @@ pub fn create_update_compressed_mint_cpi_write( let data = instruction_data .data() - .map_err(|_| CTokenSdkError::SerializationError)?; + .map_err(|_| TokenSdkError::SerializationError)?; Ok(Instruction { program_id: solana_pubkey::Pubkey::new_from_array( diff --git a/sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressed_token/v2/update_compressed_mint/mod.rs rename to sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/compressible/decompress_runtime.rs b/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs similarity index 97% rename from sdk-libs/ctoken-sdk/src/compressible/decompress_runtime.rs rename to sdk-libs/token-sdk/src/compressible/decompress_runtime.rs index f088057e01..614b0f9e35 100644 --- a/sdk-libs/ctoken-sdk/src/compressible/decompress_runtime.rs +++ b/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs @@ -1,9 +1,9 @@ //! Runtime helpers for token decompression. +use light_sdk::{cpi::v2::CpiAccounts, instruction::ValidityProof}; +use light_sdk_types::instruction::account_meta::CompressedAccountMetaNoLamportsNoAddress; use light_token_interface::instructions::{ extensions::CompressToPubkey, transfer2::MultiInputTokenDataWithContext, }; -use light_sdk::{cpi::v2::CpiAccounts, instruction::ValidityProof}; -use light_sdk_types::instruction::account_meta::CompressedAccountMetaNoLamportsNoAddress; use solana_account_info::AccountInfo; use solana_msg::msg; use solana_program_error::ProgramError; @@ -12,7 +12,7 @@ use solana_pubkey::Pubkey; use crate::compat::PackedCTokenData; /// Trait for getting token account seeds. -pub trait CTokenSeedProvider: Copy { +pub trait TokenSeedProvider: Copy { /// Type of accounts struct needed for seed derivation. type Accounts<'info>; @@ -56,7 +56,7 @@ pub fn process_decompress_tokens_runtime<'info, 'a, 'b, V, A>( program_id: &Pubkey, ) -> Result<(), ProgramError> where - V: CTokenSeedProvider = A>, + V: TokenSeedProvider = A>, A: 'info, { let mut token_decompress_indices: Vec< @@ -140,12 +140,12 @@ where } }); - crate::ctoken::CreateCTokenAccountCpi { + crate::token::CreateTokenAccountCpi { payer: fee_payer.clone(), account: (*owner_info).clone(), mint: (*mint_info).clone(), owner: *authority.key, - compressible: crate::ctoken::CompressibleParamsCpi { + compressible: crate::token::CompressibleParamsCpi { compressible_config: ctoken_config.clone(), rent_sponsor: ctoken_rent_sponsor.clone(), system_program: cpi_accounts diff --git a/sdk-libs/ctoken-sdk/src/compressible/mod.rs b/sdk-libs/token-sdk/src/compressible/mod.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/compressible/mod.rs rename to sdk-libs/token-sdk/src/compressible/mod.rs diff --git a/sdk-libs/ctoken-sdk/src/constants.rs b/sdk-libs/token-sdk/src/constants.rs similarity index 89% rename from sdk-libs/ctoken-sdk/src/constants.rs rename to sdk-libs/token-sdk/src/constants.rs index cde0a6c32a..edb6ad980c 100644 --- a/sdk-libs/ctoken-sdk/src/constants.rs +++ b/sdk-libs/token-sdk/src/constants.rs @@ -19,4 +19,4 @@ pub const NOOP_PROGRAM_ID: Pubkey = Pubkey::new_from_array(light_token_types::NO pub const CPI_AUTHORITY_PDA: Pubkey = Pubkey::new_from_array(light_token_types::CPI_AUTHORITY_PDA); -pub const CTOKEN_PROGRAM_ID: Pubkey = Pubkey::new_from_array(light_token_types::PROGRAM_ID); +pub const LIGHT_TOKEN_PROGRAM_ID: Pubkey = Pubkey::new_from_array(light_token_types::PROGRAM_ID); diff --git a/sdk-libs/ctoken-sdk/src/error.rs b/sdk-libs/token-sdk/src/error.rs similarity index 55% rename from sdk-libs/ctoken-sdk/src/error.rs rename to sdk-libs/token-sdk/src/error.rs index 9ea1406fb1..daeeec5192 100644 --- a/sdk-libs/ctoken-sdk/src/error.rs +++ b/sdk-libs/token-sdk/src/error.rs @@ -1,16 +1,19 @@ use light_account_checks::AccountError; -use light_token_interface::TokenError; -use light_token_types::error::LightTokenSdkTypeError; use light_sdk::error::LightSdkError; use light_sdk_types::error::LightSdkTypesError; +use light_token_interface::TokenError; +use light_token_types::error::LightTokenSdkTypeError; use light_zero_copy::errors::ZeroCopyError; use solana_program_error::ProgramError; use thiserror::Error; -pub type Result = std::result::Result; +pub type Result = std::result::Result; + +// Backwards compatibility alias +pub use TokenSdkError as CTokenSdkError; #[derive(Debug, Error)] -pub enum CTokenSdkError { +pub enum TokenSdkError { #[error("Insufficient balance")] InsufficientBalance, #[error("Serialization error")] @@ -73,8 +76,8 @@ pub enum CTokenSdkError { NoInputAccounts, #[error("Missing Compressible extension on CToken account")] MissingCompressibleExtension, - #[error("Invalid CToken account data")] - InvalidCTokenAccount, + #[error("Invalid Token account data")] + InvalidTokenAccount, #[error(transparent)] CompressedTokenTypes(#[from] LightTokenSdkTypeError), #[error(transparent)] @@ -89,59 +92,59 @@ pub enum CTokenSdkError { AccountError(#[from] AccountError), } #[cfg(feature = "anchor")] -impl From for anchor_lang::prelude::ProgramError { - fn from(e: CTokenSdkError) -> Self { +impl From for anchor_lang::prelude::ProgramError { + fn from(e: TokenSdkError) -> Self { ProgramError::Custom(e.into()) } } #[cfg(not(feature = "anchor"))] -impl From for ProgramError { - fn from(e: CTokenSdkError) -> Self { +impl From for ProgramError { + fn from(e: TokenSdkError) -> Self { ProgramError::Custom(e.into()) } } -impl From for u32 { - fn from(e: CTokenSdkError) -> Self { +impl From for u32 { + fn from(e: TokenSdkError) -> Self { match e { - CTokenSdkError::InsufficientBalance => 17001, - CTokenSdkError::SerializationError => 17002, - CTokenSdkError::CpiError(_) => 17003, - CTokenSdkError::CannotCompressAndDecompress => 17004, - CTokenSdkError::CompressionCannotBeSetTwice => 17005, - CTokenSdkError::InconsistentCompressDecompressState => 17006, - CTokenSdkError::BothCompressAndDecompress => 17007, - CTokenSdkError::InvalidCompressDecompressAmount => 17008, - CTokenSdkError::MethodUsed => 17009, - CTokenSdkError::DecompressedMintConfigRequired => 17010, - CTokenSdkError::InvalidCompressInputOwner => 17011, - CTokenSdkError::AccountBorrowFailed => 17012, - CTokenSdkError::InvalidAccountData => 17013, - CTokenSdkError::MissingCpiAccount => 17014, - CTokenSdkError::TooManyAccounts => 17015, - CTokenSdkError::NonContinuousIndices => 17016, - CTokenSdkError::PackedAccountIndexOutOfBounds => 17017, - CTokenSdkError::CannotMintWithDecompressedInCpiWrite => 17018, - CTokenSdkError::RentAuthorityIsNone => 17019, - CTokenSdkError::SplInterfaceRequired => 17020, - CTokenSdkError::IncompleteSplInterface => 17021, - CTokenSdkError::UseRegularSplTransfer => 17022, - CTokenSdkError::CannotDetermineAccountType => 17023, - CTokenSdkError::CpiContextRequired => 17024, - CTokenSdkError::MissingMintAccount => 17025, - CTokenSdkError::MissingSplTokenProgram => 17026, - CTokenSdkError::MissingSplInterfacePda => 17027, - CTokenSdkError::MissingSplInterfacePdaBump => 17028, - CTokenSdkError::InvalidCpiContext => 17029, - CTokenSdkError::NoInputAccounts => 17030, - CTokenSdkError::MissingCompressibleExtension => 17031, - CTokenSdkError::InvalidCTokenAccount => 17032, - CTokenSdkError::CompressedTokenTypes(e) => e.into(), - CTokenSdkError::TokenError(e) => e.into(), - CTokenSdkError::LightSdkTypesError(e) => e.into(), - CTokenSdkError::LightSdkError(e) => e.into(), - CTokenSdkError::ZeroCopyError(e) => e.into(), - CTokenSdkError::AccountError(e) => e.into(), + TokenSdkError::InsufficientBalance => 17001, + TokenSdkError::SerializationError => 17002, + TokenSdkError::CpiError(_) => 17003, + TokenSdkError::CannotCompressAndDecompress => 17004, + TokenSdkError::CompressionCannotBeSetTwice => 17005, + TokenSdkError::InconsistentCompressDecompressState => 17006, + TokenSdkError::BothCompressAndDecompress => 17007, + TokenSdkError::InvalidCompressDecompressAmount => 17008, + TokenSdkError::MethodUsed => 17009, + TokenSdkError::DecompressedMintConfigRequired => 17010, + TokenSdkError::InvalidCompressInputOwner => 17011, + TokenSdkError::AccountBorrowFailed => 17012, + TokenSdkError::InvalidAccountData => 17013, + TokenSdkError::MissingCpiAccount => 17014, + TokenSdkError::TooManyAccounts => 17015, + TokenSdkError::NonContinuousIndices => 17016, + TokenSdkError::PackedAccountIndexOutOfBounds => 17017, + TokenSdkError::CannotMintWithDecompressedInCpiWrite => 17018, + TokenSdkError::RentAuthorityIsNone => 17019, + TokenSdkError::SplInterfaceRequired => 17020, + TokenSdkError::IncompleteSplInterface => 17021, + TokenSdkError::UseRegularSplTransfer => 17022, + TokenSdkError::CannotDetermineAccountType => 17023, + TokenSdkError::CpiContextRequired => 17024, + TokenSdkError::MissingMintAccount => 17025, + TokenSdkError::MissingSplTokenProgram => 17026, + TokenSdkError::MissingSplInterfacePda => 17027, + TokenSdkError::MissingSplInterfacePdaBump => 17028, + TokenSdkError::InvalidCpiContext => 17029, + TokenSdkError::NoInputAccounts => 17030, + TokenSdkError::MissingCompressibleExtension => 17031, + TokenSdkError::InvalidTokenAccount => 17032, + TokenSdkError::CompressedTokenTypes(e) => e.into(), + TokenSdkError::TokenError(e) => e.into(), + TokenSdkError::LightSdkTypesError(e) => e.into(), + TokenSdkError::LightSdkError(e) => e.into(), + TokenSdkError::ZeroCopyError(e) => e.into(), + TokenSdkError::AccountError(e) => e.into(), } } } diff --git a/sdk-libs/ctoken-sdk/src/lib.rs b/sdk-libs/token-sdk/src/lib.rs similarity index 67% rename from sdk-libs/ctoken-sdk/src/lib.rs rename to sdk-libs/token-sdk/src/lib.rs index 5aa9402cd7..5c1411a21c 100644 --- a/sdk-libs/ctoken-sdk/src/lib.rs +++ b/sdk-libs/token-sdk/src/lib.rs @@ -45,16 +45,16 @@ //! //! | Operation | Instruction Builder | CPI Builder | //! |-----------|----------------|-------------| -//! | Create Associated cToken Account | [`CreateAssociatedCTokenAccount`](ctoken::CreateAssociatedCTokenAccount) | [`CreateAssociatedCTokenAccountCpi`](ctoken::CreateAssociatedCTokenAccountCpi) | -//! | Create cToken Account | [`CreateCTokenAccount`](ctoken::CreateCTokenAccount) | [`CreateCTokenAccountCpi`](ctoken::CreateCTokenAccountCpi) | -//! | Transfer cToken | [`TransferCToken`](ctoken::TransferCToken) | [`TransferCTokenCpi`](ctoken::TransferCTokenCpi) | -//! | Transfer cToken → SPL | [`TransferCTokenToSpl`](ctoken::TransferCTokenToSpl) | [`TransferCTokenToSplCpi`](ctoken::TransferCTokenToSplCpi) | -//! | Transfer SPL → cToken | [`TransferSplToCtoken`](ctoken::TransferSplToCtoken) | [`TransferSplToCtokenCpi`](ctoken::TransferSplToCtokenCpi) | -//! | Transfer (auto-detect) | - | [`TransferInterfaceCpi`](ctoken::TransferInterfaceCpi) | -//! | Decompress to cToken account | [`DecompressToCtoken`](ctoken::DecompressToCtoken) | - | -//! | Close cToken account | [`CloseCTokenAccount`](ctoken::CloseCTokenAccount) | [`CloseCTokenAccountCpi`](ctoken::CloseCTokenAccountCpi) | -//! | Create cMint | [`CreateCMint`](ctoken::CreateCMint) | [`CreateCMintCpi`](ctoken::CreateCMintCpi) | -//! | MintTo cToken account from cMint | [`MintToCToken`](ctoken::MintToCToken) | [`MintToCTokenCpi`](ctoken::MintToCTokenCpi) | +//! | Create Associated cToken Account | [`CreateAssociatedCTokenAccount`](token::CreateAssociatedCTokenAccount) | [`CreateAssociatedCTokenAccountCpi`](token::CreateAssociatedCTokenAccountCpi) | +//! | Create cToken Account | [`CreateTokenAccount`](token::CreateTokenAccount) | [`CreateTokenAccountCpi`](token::CreateTokenAccountCpi) | +//! | Transfer cToken | [`TransferCToken`](token::TransferCToken) | [`TransferCTokenCpi`](token::TransferCTokenCpi) | +//! | Transfer cToken → SPL | [`TransferTokenToSpl`](token::TransferTokenToSpl) | [`TransferTokenToSplCpi`](token::TransferTokenToSplCpi) | +//! | Transfer SPL → cToken | [`TransferSplToToken`](token::TransferSplToToken) | [`TransferSplToTokenCpi`](token::TransferSplToTokenCpi) | +//! | Transfer (auto-detect) | - | [`TransferInterfaceCpi`](token::TransferInterfaceCpi) | +//! | Decompress to cToken account | [`DecompressToCtoken`](token::DecompressToCtoken) | - | +//! | Close cToken account | [`CloseCTokenAccount`](token::CloseCTokenAccount) | [`CloseCTokenAccountCpi`](token::CloseCTokenAccountCpi) | +//! | Create cMint | [`CreateCMint`](token::CreateCMint) | [`CreateCMintCpi`](token::CreateCMintCpi) | +//! | MintTo cToken account from cMint | [`MintToCToken`](token::MintToCToken) | [`MintToCTokenCpi`](token::MintToCTokenCpi) | //! //! //! # Disclaimer @@ -62,7 +62,10 @@ pub mod compressed_token; pub mod compressible; -pub mod ctoken; +pub mod token; + +// Backwards compatibility alias +pub use token as ctoken; pub mod constants; pub mod error; diff --git a/sdk-libs/ctoken-sdk/src/pack.rs b/sdk-libs/token-sdk/src/pack.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/pack.rs rename to sdk-libs/token-sdk/src/pack.rs index cc2ad008e0..b220ef3c4b 100644 --- a/sdk-libs/ctoken-sdk/src/pack.rs +++ b/sdk-libs/token-sdk/src/pack.rs @@ -1,11 +1,11 @@ //! Pack implementation for TokenData types for c-tokens. use light_compressed_account::compressed_account::CompressedAccountWithMerkleContext; -pub use light_token_interface::state::TokenData; -use light_token_interface::state::TokenDataVersion; use light_sdk::{ instruction::PackedAccounts, light_hasher::{sha256::Sha256BE, HasherError}, }; +pub use light_token_interface::state::TokenData; +use light_token_interface::state::TokenDataVersion; use solana_account_info::AccountInfo; use solana_program_error::ProgramError; diff --git a/sdk-libs/ctoken-sdk/src/spl_interface.rs b/sdk-libs/token-sdk/src/spl_interface.rs similarity index 97% rename from sdk-libs/ctoken-sdk/src/spl_interface.rs rename to sdk-libs/token-sdk/src/spl_interface.rs index 32b9a8d46e..f3b7c958c6 100644 --- a/sdk-libs/ctoken-sdk/src/spl_interface.rs +++ b/sdk-libs/token-sdk/src/spl_interface.rs @@ -40,8 +40,8 @@ pub fn derive_spl_interface_pda(mint: &Pubkey, index: u8, restricted: bool) -> S /// /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::spl_interface::CreateSplInterfacePda; -/// # use light_ctoken_sdk::constants::SPL_TOKEN_PROGRAM_ID; +/// # use light_token_sdk::spl_interface::CreateSplInterfacePda; +/// # use light_token_sdk::constants::SPL_TOKEN_PROGRAM_ID; /// # let fee_payer = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let token_program = SPL_TOKEN_PROGRAM_ID; diff --git a/sdk-libs/ctoken-sdk/src/ctoken/approve.rs b/sdk-libs/token-sdk/src/token/approve.rs similarity index 80% rename from sdk-libs/ctoken-sdk/src/ctoken/approve.rs rename to sdk-libs/token-sdk/src/token/approve.rs index 7089e2c8e5..2067ba2a68 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/approve.rs +++ b/sdk-libs/token-sdk/src/token/approve.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Approve a delegate for a CToken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::ApproveCToken; +/// # use light_token_sdk::token::ApproveToken; /// # let token_account = Pubkey::new_unique(); /// # let delegate = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); -/// let instruction = ApproveCToken { +/// let instruction = ApproveToken { /// token_account, /// delegate, /// owner, @@ -20,7 +20,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ApproveCToken { +pub struct ApproveToken { /// CToken account to approve delegation for pub token_account: Pubkey, /// Delegate to approve @@ -33,13 +33,13 @@ pub struct ApproveCToken { /// # Approve CToken via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::ApproveCTokenCpi; +/// # use light_token_sdk::token::ApproveTokenCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let delegate: AccountInfo = todo!(); /// # let owner: AccountInfo = todo!(); /// # let system_program: AccountInfo = todo!(); -/// ApproveCTokenCpi { +/// ApproveTokenCpi { /// token_account, /// delegate, /// owner, @@ -49,7 +49,7 @@ pub struct ApproveCToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ApproveCTokenCpi<'info> { +pub struct ApproveTokenCpi<'info> { pub token_account: AccountInfo<'info>, pub delegate: AccountInfo<'info>, pub owner: AccountInfo<'info>, @@ -57,13 +57,13 @@ pub struct ApproveCTokenCpi<'info> { pub amount: u64, } -impl<'info> ApproveCTokenCpi<'info> { +impl<'info> ApproveTokenCpi<'info> { pub fn instruction(&self) -> Result { - ApproveCToken::from(self).instruction() + ApproveToken::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = ApproveCToken::from(&self).instruction()?; + let instruction = ApproveToken::from(&self).instruction()?; let account_infos = [ self.token_account, self.delegate, @@ -74,7 +74,7 @@ impl<'info> ApproveCTokenCpi<'info> { } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = ApproveCToken::from(&self).instruction()?; + let instruction = ApproveToken::from(&self).instruction()?; let account_infos = [ self.token_account, self.delegate, @@ -85,8 +85,8 @@ impl<'info> ApproveCTokenCpi<'info> { } } -impl<'info> From<&ApproveCTokenCpi<'info>> for ApproveCToken { - fn from(cpi: &ApproveCTokenCpi<'info>) -> Self { +impl<'info> From<&ApproveTokenCpi<'info>> for ApproveToken { + fn from(cpi: &ApproveTokenCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, delegate: *cpi.delegate.key, @@ -96,13 +96,13 @@ impl<'info> From<&ApproveCTokenCpi<'info>> for ApproveCToken { } } -impl ApproveCToken { +impl ApproveToken { pub fn instruction(self) -> Result { let mut data = vec![4u8]; // CTokenApprove discriminator data.extend_from_slice(&self.amount.to_le_bytes()); Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.token_account, false), AccountMeta::new_readonly(self.delegate, false), diff --git a/sdk-libs/ctoken-sdk/src/ctoken/approve_checked.rs b/sdk-libs/token-sdk/src/token/approve_checked.rs similarity index 83% rename from sdk-libs/ctoken-sdk/src/ctoken/approve_checked.rs rename to sdk-libs/token-sdk/src/token/approve_checked.rs index 670334d0d3..e836d5494e 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/approve_checked.rs +++ b/sdk-libs/token-sdk/src/token/approve_checked.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,12 +8,12 @@ use solana_pubkey::Pubkey; /// # Approve a delegate for a CToken account with decimals validation: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::ApproveCTokenChecked; +/// # use light_token_sdk::token::ApproveTokenChecked; /// # let token_account = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let delegate = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); -/// let instruction = ApproveCTokenChecked { +/// let instruction = ApproveTokenChecked { /// token_account, /// mint, /// delegate, @@ -24,7 +24,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ApproveCTokenChecked { +pub struct ApproveTokenChecked { /// CToken account to approve delegation for pub token_account: Pubkey, /// Mint account (for decimals validation - may be skipped if CToken has cached decimals) @@ -43,14 +43,14 @@ pub struct ApproveCTokenChecked { /// # Approve CToken via CPI with decimals validation: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::ApproveCTokenCheckedCpi; +/// # use light_token_sdk::token::ApproveTokenCheckedCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); /// # let delegate: AccountInfo = todo!(); /// # let owner: AccountInfo = todo!(); /// # let system_program: AccountInfo = todo!(); -/// ApproveCTokenCheckedCpi { +/// ApproveTokenCheckedCpi { /// token_account, /// mint, /// delegate, @@ -63,7 +63,7 @@ pub struct ApproveCTokenChecked { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ApproveCTokenCheckedCpi<'info> { +pub struct ApproveTokenCheckedCpi<'info> { pub token_account: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub delegate: AccountInfo<'info>, @@ -75,13 +75,13 @@ pub struct ApproveCTokenCheckedCpi<'info> { pub max_top_up: Option, } -impl<'info> ApproveCTokenCheckedCpi<'info> { +impl<'info> ApproveTokenCheckedCpi<'info> { pub fn instruction(&self) -> Result { - ApproveCTokenChecked::from(self).instruction() + ApproveTokenChecked::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = ApproveCTokenChecked::from(&self).instruction()?; + let instruction = ApproveTokenChecked::from(&self).instruction()?; let account_infos = [ self.token_account, self.mint, @@ -93,7 +93,7 @@ impl<'info> ApproveCTokenCheckedCpi<'info> { } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = ApproveCTokenChecked::from(&self).instruction()?; + let instruction = ApproveTokenChecked::from(&self).instruction()?; let account_infos = [ self.token_account, self.mint, @@ -105,8 +105,8 @@ impl<'info> ApproveCTokenCheckedCpi<'info> { } } -impl<'info> From<&ApproveCTokenCheckedCpi<'info>> for ApproveCTokenChecked { - fn from(cpi: &ApproveCTokenCheckedCpi<'info>) -> Self { +impl<'info> From<&ApproveTokenCheckedCpi<'info>> for ApproveTokenChecked { + fn from(cpi: &ApproveTokenCheckedCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, mint: *cpi.mint.key, @@ -119,7 +119,7 @@ impl<'info> From<&ApproveCTokenCheckedCpi<'info>> for ApproveCTokenChecked { } } -impl ApproveCTokenChecked { +impl ApproveTokenChecked { pub fn instruction(self) -> Result { let mut data = vec![13u8]; // CTokenApproveChecked discriminator (SPL compatible) data.extend_from_slice(&self.amount.to_le_bytes()); @@ -130,7 +130,7 @@ impl ApproveCTokenChecked { } Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.token_account, false), AccountMeta::new_readonly(self.mint, false), diff --git a/sdk-libs/ctoken-sdk/src/ctoken/burn.rs b/sdk-libs/token-sdk/src/token/burn.rs similarity index 82% rename from sdk-libs/ctoken-sdk/src/ctoken/burn.rs rename to sdk-libs/token-sdk/src/token/burn.rs index a36973e5a9..5a19712c6c 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/burn.rs +++ b/sdk-libs/token-sdk/src/token/burn.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Burn tokens from a ctoken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::BurnCToken; +/// # use light_token_sdk::token::BurnToken; /// # let source = Pubkey::new_unique(); /// # let cmint = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = BurnCToken { +/// let instruction = BurnToken { /// source, /// cmint, /// amount: 100, @@ -21,7 +21,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct BurnCToken { +pub struct BurnToken { /// CToken account to burn from pub source: Pubkey, /// CMint account (supply tracking) @@ -37,12 +37,12 @@ pub struct BurnCToken { /// # Burn ctoken via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::BurnCTokenCpi; +/// # use light_token_sdk::token::BurnTokenCpi; /// # use solana_account_info::AccountInfo; /// # let source: AccountInfo = todo!(); /// # let cmint: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// BurnCTokenCpi { +/// BurnTokenCpi { /// source, /// cmint, /// amount: 100, @@ -52,7 +52,7 @@ pub struct BurnCToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct BurnCTokenCpi<'info> { +pub struct BurnTokenCpi<'info> { pub source: AccountInfo<'info>, pub cmint: AccountInfo<'info>, pub amount: u64, @@ -61,26 +61,26 @@ pub struct BurnCTokenCpi<'info> { pub max_top_up: Option, } -impl<'info> BurnCTokenCpi<'info> { +impl<'info> BurnTokenCpi<'info> { pub fn instruction(&self) -> Result { - BurnCToken::from(self).instruction() + BurnToken::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = BurnCToken::from(&self).instruction()?; + let instruction = BurnToken::from(&self).instruction()?; let account_infos = [self.source, self.cmint, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = BurnCToken::from(&self).instruction()?; + let instruction = BurnToken::from(&self).instruction()?; let account_infos = [self.source, self.cmint, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&BurnCTokenCpi<'info>> for BurnCToken { - fn from(cpi: &BurnCTokenCpi<'info>) -> Self { +impl<'info> From<&BurnTokenCpi<'info>> for BurnToken { + fn from(cpi: &BurnTokenCpi<'info>) -> Self { Self { source: *cpi.source.key, cmint: *cpi.cmint.key, @@ -91,10 +91,10 @@ impl<'info> From<&BurnCTokenCpi<'info>> for BurnCToken { } } -impl BurnCToken { +impl BurnToken { pub fn instruction(self) -> Result { Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.source, false), AccountMeta::new(self.cmint, false), diff --git a/sdk-libs/ctoken-sdk/src/ctoken/burn_checked.rs b/sdk-libs/token-sdk/src/token/burn_checked.rs similarity index 82% rename from sdk-libs/ctoken-sdk/src/ctoken/burn_checked.rs rename to sdk-libs/token-sdk/src/token/burn_checked.rs index 6291974a27..2f4c07a7ab 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/burn_checked.rs +++ b/sdk-libs/token-sdk/src/token/burn_checked.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Burn tokens from a ctoken account with decimals validation: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::BurnCTokenChecked; +/// # use light_token_sdk::token::BurnTokenChecked; /// # let source = Pubkey::new_unique(); /// # let cmint = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = BurnCTokenChecked { +/// let instruction = BurnTokenChecked { /// source, /// cmint, /// amount: 100, @@ -22,7 +22,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct BurnCTokenChecked { +pub struct BurnTokenChecked { /// CToken account to burn from pub source: Pubkey, /// CMint account (supply tracking) @@ -40,12 +40,12 @@ pub struct BurnCTokenChecked { /// # Burn ctoken via CPI with decimals validation: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::BurnCTokenCheckedCpi; +/// # use light_token_sdk::token::BurnTokenCheckedCpi; /// # use solana_account_info::AccountInfo; /// # let source: AccountInfo = todo!(); /// # let cmint: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// BurnCTokenCheckedCpi { +/// BurnTokenCheckedCpi { /// source, /// cmint, /// amount: 100, @@ -56,7 +56,7 @@ pub struct BurnCTokenChecked { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct BurnCTokenCheckedCpi<'info> { +pub struct BurnTokenCheckedCpi<'info> { pub source: AccountInfo<'info>, pub cmint: AccountInfo<'info>, pub amount: u64, @@ -66,26 +66,26 @@ pub struct BurnCTokenCheckedCpi<'info> { pub max_top_up: Option, } -impl<'info> BurnCTokenCheckedCpi<'info> { +impl<'info> BurnTokenCheckedCpi<'info> { pub fn instruction(&self) -> Result { - BurnCTokenChecked::from(self).instruction() + BurnTokenChecked::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = BurnCTokenChecked::from(&self).instruction()?; + let instruction = BurnTokenChecked::from(&self).instruction()?; let account_infos = [self.source, self.cmint, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = BurnCTokenChecked::from(&self).instruction()?; + let instruction = BurnTokenChecked::from(&self).instruction()?; let account_infos = [self.source, self.cmint, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&BurnCTokenCheckedCpi<'info>> for BurnCTokenChecked { - fn from(cpi: &BurnCTokenCheckedCpi<'info>) -> Self { +impl<'info> From<&BurnTokenCheckedCpi<'info>> for BurnTokenChecked { + fn from(cpi: &BurnTokenCheckedCpi<'info>) -> Self { Self { source: *cpi.source.key, cmint: *cpi.cmint.key, @@ -97,10 +97,10 @@ impl<'info> From<&BurnCTokenCheckedCpi<'info>> for BurnCTokenChecked { } } -impl BurnCTokenChecked { +impl BurnTokenChecked { pub fn instruction(self) -> Result { Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.source, false), AccountMeta::new(self.cmint, false), diff --git a/sdk-libs/ctoken-sdk/src/ctoken/close.rs b/sdk-libs/token-sdk/src/token/close.rs similarity index 85% rename from sdk-libs/ctoken-sdk/src/ctoken/close.rs rename to sdk-libs/token-sdk/src/token/close.rs index 021efd701a..b14d90f958 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/close.rs +++ b/sdk-libs/token-sdk/src/token/close.rs @@ -4,21 +4,21 @@ use solana_instruction::{AccountMeta, Instruction}; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -use crate::ctoken::RENT_SPONSOR; +use crate::token::RENT_SPONSOR; /// # Create a close ctoken account instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::{CloseCTokenAccount, CTOKEN_PROGRAM_ID}; +/// # use light_token_sdk::token::{CloseTokenAccount, LIGHT_TOKEN_PROGRAM_ID}; /// # let account = Pubkey::new_unique(); /// # let destination = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); /// let instruction = -/// CloseCTokenAccount::new(CTOKEN_PROGRAM_ID, account, destination, owner) +/// CloseTokenAccount::new(LIGHT_TOKEN_PROGRAM_ID, account, destination, owner) /// .instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CloseCTokenAccount { +pub struct CloseTokenAccount { pub token_program: Pubkey, pub account: Pubkey, pub destination: Pubkey, @@ -26,7 +26,7 @@ pub struct CloseCTokenAccount { pub rent_sponsor: Pubkey, } -impl CloseCTokenAccount { +impl CloseTokenAccount { pub fn new(token_program: Pubkey, account: Pubkey, destination: Pubkey, owner: Pubkey) -> Self { Self { token_program, @@ -63,7 +63,7 @@ impl CloseCTokenAccount { /// # Close a ctoken account via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::CloseCTokenAccountCpi; +/// # use light_token_sdk::token::CloseTokenAccountCpi; /// # use solana_account_info::AccountInfo; /// # let token_program: AccountInfo = todo!(); /// # let account: AccountInfo = todo!(); @@ -71,7 +71,7 @@ impl CloseCTokenAccount { /// # let owner: AccountInfo = todo!(); /// // Use ctoken::RENT_SPONSOR or ctoken::rent_sponsor_pda() to get the protocol rent sponsor. /// # let rent_sponsor: AccountInfo = todo!(); -/// CloseCTokenAccountCpi { +/// CloseTokenAccountCpi { /// token_program, /// account, /// destination, @@ -81,7 +81,7 @@ impl CloseCTokenAccount { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CloseCTokenAccountCpi<'info> { +pub struct CloseTokenAccountCpi<'info> { pub token_program: AccountInfo<'info>, pub account: AccountInfo<'info>, pub destination: AccountInfo<'info>, @@ -89,9 +89,9 @@ pub struct CloseCTokenAccountCpi<'info> { pub rent_sponsor: AccountInfo<'info>, } -impl<'info> CloseCTokenAccountCpi<'info> { +impl<'info> CloseTokenAccountCpi<'info> { pub fn instruction(&self) -> Result { - CloseCTokenAccount::from(self).instruction() + CloseTokenAccount::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { @@ -117,8 +117,8 @@ impl<'info> CloseCTokenAccountCpi<'info> { } } -impl<'info> From<&CloseCTokenAccountCpi<'info>> for CloseCTokenAccount { - fn from(account_infos: &CloseCTokenAccountCpi<'info>) -> Self { +impl<'info> From<&CloseTokenAccountCpi<'info>> for CloseTokenAccount { + fn from(account_infos: &CloseTokenAccountCpi<'info>) -> Self { Self { token_program: *account_infos.token_program.key, account: *account_infos.account.key, diff --git a/sdk-libs/ctoken-sdk/src/ctoken/compressible.rs b/sdk-libs/token-sdk/src/token/compressible.rs similarity index 96% rename from sdk-libs/ctoken-sdk/src/ctoken/compressible.rs rename to sdk-libs/token-sdk/src/token/compressible.rs index 956c30a7c5..f168b0dc33 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/compressible.rs +++ b/sdk-libs/token-sdk/src/token/compressible.rs @@ -2,7 +2,7 @@ use light_token_interface::{instructions::extensions::CompressToPubkey, state::T use solana_account_info::AccountInfo; use solana_pubkey::Pubkey; -use crate::ctoken::{COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR}; +use crate::token::{COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR}; /// Parameters for creating compressible ctoken accounts. /// @@ -17,7 +17,7 @@ use crate::ctoken::{COMPRESSIBLE_CONFIG_V1, RENT_SPONSOR}; /// /// # Example /// ```rust -/// use light_ctoken_sdk::ctoken::CompressibleParams; +/// use light_token_sdk::token::CompressibleParams; /// /// let params = CompressibleParams::new(); /// ``` @@ -79,7 +79,7 @@ impl CompressibleParams { /// /// # Example /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::CompressibleParamsCpi; +/// # use light_token_sdk::token::CompressibleParamsCpi; /// # use solana_account_info::AccountInfo; /// // Use ctoken::COMPRESSIBLE_CONFIG_V1 or ctoken::config_pda() to get the protocol config. /// // Use ctoken::RENT_SPONSOR or ctoken::rent_sponsor_pda() to get the protocol rent sponsor. diff --git a/sdk-libs/ctoken-sdk/src/ctoken/create.rs b/sdk-libs/token-sdk/src/token/create.rs similarity index 89% rename from sdk-libs/ctoken-sdk/src/ctoken/create.rs rename to sdk-libs/token-sdk/src/token/create.rs index e0195c8127..cd0c070120 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/create.rs +++ b/sdk-libs/token-sdk/src/token/create.rs @@ -9,23 +9,23 @@ use solana_instruction::{AccountMeta, Instruction}; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -use crate::ctoken::{compressible::CompressibleParamsCpi, CompressibleParams}; +use crate::token::{compressible::CompressibleParamsCpi, CompressibleParams}; /// # Create a create ctoken account instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::CreateCTokenAccount; +/// # use light_token_sdk::token::CreateTokenAccount; /// # let payer = Pubkey::new_unique(); /// # let account = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); /// let instruction = -/// CreateCTokenAccount::new(payer, account, mint, owner) +/// CreateTokenAccount::new(payer, account, mint, owner) /// .instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` #[derive(Debug, Clone)] -pub struct CreateCTokenAccount { +pub struct CreateTokenAccount { pub payer: Pubkey, pub account: Pubkey, pub mint: Pubkey, @@ -33,7 +33,7 @@ pub struct CreateCTokenAccount { pub compressible: CompressibleParams, } -impl CreateCTokenAccount { +impl CreateTokenAccount { pub fn new(payer: Pubkey, account: Pubkey, mint: Pubkey, owner: Pubkey) -> Self { Self { payer, @@ -86,7 +86,7 @@ impl CreateCTokenAccount { /// # Create a ctoken account via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::{CreateCTokenAccountCpi, CompressibleParamsCpi}; +/// # use light_token_sdk::token::{CreateTokenAccountCpi, CompressibleParamsCpi}; /// # use solana_account_info::AccountInfo; /// # use solana_pubkey::Pubkey; /// # let payer: AccountInfo = todo!(); @@ -94,7 +94,7 @@ impl CreateCTokenAccount { /// # let mint: AccountInfo = todo!(); /// # let owner: Pubkey = todo!(); /// # let compressible: CompressibleParamsCpi = todo!(); -/// CreateCTokenAccountCpi { +/// CreateTokenAccountCpi { /// payer, /// account, /// mint, @@ -104,7 +104,7 @@ impl CreateCTokenAccount { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CreateCTokenAccountCpi<'info> { +pub struct CreateTokenAccountCpi<'info> { pub payer: AccountInfo<'info>, pub account: AccountInfo<'info>, pub mint: AccountInfo<'info>, @@ -112,7 +112,7 @@ pub struct CreateCTokenAccountCpi<'info> { pub compressible: CompressibleParamsCpi<'info>, } -impl<'info> CreateCTokenAccountCpi<'info> { +impl<'info> CreateTokenAccountCpi<'info> { pub fn new( payer: AccountInfo<'info>, account: AccountInfo<'info>, @@ -130,7 +130,7 @@ impl<'info> CreateCTokenAccountCpi<'info> { } pub fn instruction(&self) -> Result { - CreateCTokenAccount::from(self).instruction() + CreateTokenAccount::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { @@ -160,8 +160,8 @@ impl<'info> CreateCTokenAccountCpi<'info> { } } -impl<'info> From<&CreateCTokenAccountCpi<'info>> for CreateCTokenAccount { - fn from(account_infos: &CreateCTokenAccountCpi<'info>) -> Self { +impl<'info> From<&CreateTokenAccountCpi<'info>> for CreateTokenAccount { + fn from(account_infos: &CreateTokenAccountCpi<'info>) -> Self { Self { payer: *account_infos.payer.key, account: *account_infos.account.key, diff --git a/sdk-libs/ctoken-sdk/src/ctoken/create_associated_token_account.rs b/sdk-libs/token-sdk/src/token/create_associated_token_account.rs similarity index 97% rename from sdk-libs/ctoken-sdk/src/ctoken/create_associated_token_account.rs rename to sdk-libs/token-sdk/src/token/create_associated_token_account.rs index f5e5dfb034..fae7d29a5d 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/create_associated_token_account.rs +++ b/sdk-libs/token-sdk/src/token/create_associated_token_account.rs @@ -59,7 +59,7 @@ pub fn create_compressible_associated_token_account_idempotent( pub fn create_compressible_associated_token_account_with_mode( inputs: CreateCompressibleAssociatedTokenAccountInputs, ) -> Result { - let (ata_pubkey, bump) = derive_ctoken_ata(&inputs.owner, &inputs.mint); + let (ata_pubkey, bump) = derive_token_ata(&inputs.owner, &inputs.mint); create_compressible_associated_token_account_with_bump_and_mode::( inputs, ata_pubkey, bump, ) @@ -122,7 +122,7 @@ pub fn create_associated_token_account_with_mode( owner: Pubkey, mint: Pubkey, ) -> Result { - let (ata_pubkey, bump) = derive_ctoken_ata(&owner, &mint); + let (ata_pubkey, bump) = derive_token_ata(&owner, &mint); create_associated_token_account_with_bump_and_mode::( payer, owner, mint, ata_pubkey, bump, ) @@ -227,7 +227,7 @@ fn create_ata_instruction_unified (Pubkey, u8) { +pub fn derive_token_ata(owner: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) { Pubkey::find_program_address( &[ owner.as_ref(), @@ -262,7 +262,7 @@ pub fn create_compressible_associated_token_account2_idempotent( fn create_compressible_associated_token_account2_with_mode( inputs: CreateCompressibleAssociatedTokenAccountInputs, ) -> Result { - let (ata_pubkey, bump) = derive_ctoken_ata(&inputs.owner, &inputs.mint); + let (ata_pubkey, bump) = derive_token_ata(&inputs.owner, &inputs.mint); create_compressible_associated_token_account2_with_bump_and_mode::( inputs, ata_pubkey, bump, ) @@ -316,7 +316,7 @@ fn create_associated_token_account2_with_mode( owner: Pubkey, mint: Pubkey, ) -> Result { - let (ata_pubkey, bump) = derive_ctoken_ata(&owner, &mint); + let (ata_pubkey, bump) = derive_token_ata(&owner, &mint); create_associated_token_account2_with_bump_and_mode::( payer, owner, mint, ata_pubkey, bump, ) @@ -405,7 +405,7 @@ fn create_ata2_instruction_unified( +pub fn create_associated_token_account<'info>( payer: AccountInfo<'info>, associated_token_account: AccountInfo<'info>, system_program: AccountInfo<'info>, @@ -451,7 +451,7 @@ pub fn create_associated_ctoken_account<'info>( /// CPI wrapper to create a compressible c-token associated token account /// idempotently. #[allow(clippy::too_many_arguments)] -pub fn create_associated_ctoken_account_idempotent<'info>( +pub fn create_associated_token_account_idempotent<'info>( payer: AccountInfo<'info>, associated_token_account: AccountInfo<'info>, system_program: AccountInfo<'info>, diff --git a/sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs b/sdk-libs/token-sdk/src/token/create_ata.rs similarity index 88% rename from sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs rename to sdk-libs/token-sdk/src/token/create_ata.rs index 6aefc081e6..4862389aca 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/create_ata.rs +++ b/sdk-libs/token-sdk/src/token/create_ata.rs @@ -9,12 +9,12 @@ use solana_instruction::{AccountMeta, Instruction}; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -use crate::ctoken::{compressible::CompressibleParamsCpi, CompressibleParams}; +use crate::token::{compressible::CompressibleParamsCpi, CompressibleParams}; const CREATE_ATA_DISCRIMINATOR: u8 = 100; const CREATE_ATA_IDEMPOTENT_DISCRIMINATOR: u8 = 102; -pub fn derive_ctoken_ata(owner: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) { +pub fn derive_token_ata(owner: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) { Pubkey::find_program_address( &[ owner.as_ref(), @@ -28,17 +28,17 @@ pub fn derive_ctoken_ata(owner: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) { /// # Create an associated ctoken account instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::CreateAssociatedCTokenAccount; +/// # use light_token_sdk::token::CreateAssociatedTokenAccount; /// # let payer = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// let instruction = -/// CreateAssociatedCTokenAccount::new(payer, owner, mint) +/// CreateAssociatedTokenAccount::new(payer, owner, mint) /// .instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` #[derive(Debug, Clone)] -pub struct CreateAssociatedCTokenAccount { +pub struct CreateAssociatedTokenAccount { pub payer: Pubkey, pub owner: Pubkey, pub mint: Pubkey, @@ -48,9 +48,9 @@ pub struct CreateAssociatedCTokenAccount { pub idempotent: bool, } -impl CreateAssociatedCTokenAccount { +impl CreateAssociatedTokenAccount { pub fn new(payer: Pubkey, owner: Pubkey, mint: Pubkey) -> Self { - let (ata, bump) = derive_ctoken_ata(&owner, &mint); + let (ata, bump) = derive_token_ata(&owner, &mint); Self { payer, owner, @@ -134,7 +134,7 @@ impl CreateAssociatedCTokenAccount { /// # Create an associated ctoken account via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::{CreateAssociatedCTokenAccountCpi, CompressibleParamsCpi}; +/// # use light_token_sdk::token::{CreateAssociatedTokenAccountCpi, CompressibleParamsCpi}; /// # use solana_account_info::AccountInfo; /// # let owner: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); @@ -143,7 +143,7 @@ impl CreateAssociatedCTokenAccount { /// # let system_program: AccountInfo = todo!(); /// # let bump: u8 = todo!(); /// # let compressible: CompressibleParamsCpi = todo!(); -/// CreateAssociatedCTokenAccountCpi { +/// CreateAssociatedTokenAccountCpi { /// owner, /// mint, /// payer, @@ -156,7 +156,7 @@ impl CreateAssociatedCTokenAccount { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CreateAssociatedCTokenAccountCpi<'info> { +pub struct CreateAssociatedTokenAccountCpi<'info> { pub owner: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub payer: AccountInfo<'info>, @@ -167,9 +167,9 @@ pub struct CreateAssociatedCTokenAccountCpi<'info> { pub idempotent: bool, } -impl<'info> CreateAssociatedCTokenAccountCpi<'info> { +impl<'info> CreateAssociatedTokenAccountCpi<'info> { pub fn instruction(&self) -> Result { - CreateAssociatedCTokenAccount::from(self).instruction() + CreateAssociatedTokenAccount::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { @@ -201,8 +201,8 @@ impl<'info> CreateAssociatedCTokenAccountCpi<'info> { } } -impl<'info> From<&CreateAssociatedCTokenAccountCpi<'info>> for CreateAssociatedCTokenAccount { - fn from(account_infos: &CreateAssociatedCTokenAccountCpi<'info>) -> Self { +impl<'info> From<&CreateAssociatedTokenAccountCpi<'info>> for CreateAssociatedTokenAccount { + fn from(account_infos: &CreateAssociatedTokenAccountCpi<'info>) -> Self { Self { payer: *account_infos.payer.key, owner: *account_infos.owner.key, diff --git a/sdk-libs/ctoken-sdk/src/ctoken/create_cmint.rs b/sdk-libs/token-sdk/src/token/create_cmint.rs similarity index 98% rename from sdk-libs/ctoken-sdk/src/ctoken/create_cmint.rs rename to sdk-libs/token-sdk/src/token/create_cmint.rs index 83b8b0f2f9..3ae21ee2cb 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/create_cmint.rs +++ b/sdk-libs/token-sdk/src/token/create_cmint.rs @@ -19,9 +19,9 @@ use crate::{ get_mint_action_instruction_account_metas_cpi_write, MintActionMetaConfig, MintActionMetaConfigCpiWrite, }, - ctoken::SystemAccountInfos, + token::SystemAccountInfos, }; -// TODO: modify so that it creates a decompressed mint, if you want a compressed mint use light_ctoken_sdk::compressed_token::create_cmint +// TODO: modify so that it creates a decompressed mint, if you want a compressed mint use light_token_sdk::compressed_token::create_cmint /// Parameters for creating a compressed mint. #[derive(Debug, Clone)] pub struct CreateCMintParams { @@ -38,10 +38,10 @@ pub struct CreateCMintParams { /// # Create a compressed mint instruction: /// ```rust,no_run /// # use solana_pubkey::Pubkey; -/// use light_ctoken_sdk::ctoken::{ +/// use light_token_sdk::token::{ /// CreateCMint, CreateCMintParams, derive_cmint_compressed_address, find_cmint_address, /// }; -/// # use light_ctoken_sdk::CompressedProof; +/// # use light_token_sdk::CompressedProof; /// # let mint_seed_pubkey = Pubkey::new_unique(); /// # let payer = Pubkey::new_unique(); /// # let address_tree = Pubkey::new_unique(); @@ -306,7 +306,7 @@ impl CreateCompressedMintCpiWrite { /// # Create a compressed mint via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::{CreateCMintCpi, CreateCMintParams, SystemAccountInfos}; +/// # use light_token_sdk::token::{CreateCMintCpi, CreateCMintParams, SystemAccountInfos}; /// # use solana_account_info::AccountInfo; /// # let mint_seed: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); diff --git a/sdk-libs/ctoken-sdk/src/ctoken/decompress.rs b/sdk-libs/token-sdk/src/token/decompress.rs similarity index 95% rename from sdk-libs/ctoken-sdk/src/ctoken/decompress.rs rename to sdk-libs/token-sdk/src/token/decompress.rs index 1e675ff5f7..29affbaa4c 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/decompress.rs +++ b/sdk-libs/token-sdk/src/token/decompress.rs @@ -1,9 +1,9 @@ use light_compressed_account::instruction_data::compressed_proof::ValidityProof; +use light_sdk::instruction::{PackedAccounts, PackedStateTreeInfo}; use light_token_interface::{ instructions::extensions::{CompressedOnlyExtensionInstructionData, ExtensionInstructionData}, state::{ExtensionStruct, TokenDataVersion}, }; -use light_sdk::instruction::{PackedAccounts, PackedStateTreeInfo}; use solana_instruction::Instruction; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; @@ -18,15 +18,15 @@ use crate::{ }, CTokenAccount2, }, - ctoken::derive_ctoken_ata, + token::derive_token_ata, }; /// # Decompress compressed tokens to a cToken account /// /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::DecompressToCtoken; -/// # use light_ctoken_sdk::compat::TokenData; +/// # use light_token_sdk::token::DecompressToToken; +/// # use light_token_sdk::compat::TokenData; /// # use light_compressed_account::instruction_data::compressed_proof::ValidityProof; /// # let destination_ctoken_account = Pubkey::new_unique(); /// # let payer = Pubkey::new_unique(); @@ -35,7 +35,7 @@ use crate::{ /// # let queue = Pubkey::new_unique(); /// # let token_data = TokenData::default(); /// # let discriminator = [0, 0, 0, 0, 0, 0, 0, 4]; // ShaFlat -/// let instruction = DecompressToCtoken { +/// let instruction = DecompressToToken { /// token_data, /// discriminator, /// merkle_tree, @@ -50,7 +50,7 @@ use crate::{ /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` #[derive(Debug, Clone, PartialEq, Eq)] -pub struct DecompressToCtoken { +pub struct DecompressToToken { /// Token data from the compressed account (compat version with solana_pubkey::Pubkey) pub token_data: TokenData, /// Compressed Token Account discriminator @@ -73,7 +73,7 @@ pub struct DecompressToCtoken { pub validity_proof: ValidityProof, } -impl DecompressToCtoken { +impl DecompressToToken { pub fn instruction(self) -> Result { // Build packed accounts // Note: Don't add system accounts here - Transfer2AccountsMetaConfig adds them @@ -106,7 +106,7 @@ impl DecompressToCtoken { // For ATA decompress, derive the bump from wallet owner + mint // The signer is the wallet owner for ATAs let ata_bump = if is_ata { - let (_, bump) = derive_ctoken_ata(&self.signer, &self.token_data.mint); + let (_, bump) = derive_token_ata(&self.signer, &self.token_data.mint); bump } else { 0 diff --git a/sdk-libs/ctoken-sdk/src/ctoken/decompress_cmint.rs b/sdk-libs/token-sdk/src/token/decompress_cmint.rs similarity index 100% rename from sdk-libs/ctoken-sdk/src/ctoken/decompress_cmint.rs rename to sdk-libs/token-sdk/src/token/decompress_cmint.rs diff --git a/sdk-libs/ctoken-sdk/src/ctoken/freeze.rs b/sdk-libs/token-sdk/src/token/freeze.rs similarity index 77% rename from sdk-libs/ctoken-sdk/src/ctoken/freeze.rs rename to sdk-libs/token-sdk/src/token/freeze.rs index 9675fee219..1c925fbe22 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/freeze.rs +++ b/sdk-libs/token-sdk/src/token/freeze.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,18 +8,18 @@ use solana_pubkey::Pubkey; /// # Freeze a CToken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::FreezeCToken; +/// # use light_token_sdk::token::FreezeToken; /// # let token_account = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let freeze_authority = Pubkey::new_unique(); -/// let instruction = FreezeCToken { +/// let instruction = FreezeToken { /// token_account, /// mint, /// freeze_authority, /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct FreezeCToken { +pub struct FreezeToken { /// CToken account to freeze pub token_account: Pubkey, /// Mint of the token account @@ -30,12 +30,12 @@ pub struct FreezeCToken { /// # Freeze CToken via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::FreezeCTokenCpi; +/// # use light_token_sdk::token::FreezeTokenCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); /// # let freeze_authority: AccountInfo = todo!(); -/// FreezeCTokenCpi { +/// FreezeTokenCpi { /// token_account, /// mint, /// freeze_authority, @@ -43,32 +43,32 @@ pub struct FreezeCToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct FreezeCTokenCpi<'info> { +pub struct FreezeTokenCpi<'info> { pub token_account: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub freeze_authority: AccountInfo<'info>, } -impl<'info> FreezeCTokenCpi<'info> { +impl<'info> FreezeTokenCpi<'info> { pub fn instruction(&self) -> Result { - FreezeCToken::from(self).instruction() + FreezeToken::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = FreezeCToken::from(&self).instruction()?; + let instruction = FreezeToken::from(&self).instruction()?; let account_infos = [self.token_account, self.mint, self.freeze_authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = FreezeCToken::from(&self).instruction()?; + let instruction = FreezeToken::from(&self).instruction()?; let account_infos = [self.token_account, self.mint, self.freeze_authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&FreezeCTokenCpi<'info>> for FreezeCToken { - fn from(cpi: &FreezeCTokenCpi<'info>) -> Self { +impl<'info> From<&FreezeTokenCpi<'info>> for FreezeToken { + fn from(cpi: &FreezeTokenCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, mint: *cpi.mint.key, @@ -77,10 +77,10 @@ impl<'info> From<&FreezeCTokenCpi<'info>> for FreezeCToken { } } -impl FreezeCToken { +impl FreezeToken { pub fn instruction(self) -> Result { Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.token_account, false), AccountMeta::new_readonly(self.mint, false), diff --git a/sdk-libs/ctoken-sdk/src/ctoken/mint_to.rs b/sdk-libs/token-sdk/src/token/mint_to.rs similarity index 88% rename from sdk-libs/ctoken-sdk/src/ctoken/mint_to.rs rename to sdk-libs/token-sdk/src/token/mint_to.rs index 59fefde37a..de19f660f6 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/mint_to.rs +++ b/sdk-libs/token-sdk/src/token/mint_to.rs @@ -17,14 +17,14 @@ use crate::compressed_token::mint_action::{ // TODO: move to compressed_token. /// Parameters for minting tokens to a ctoken account. #[derive(Debug, Clone)] -pub struct MintToCTokenParams { +pub struct MintToTokenParams { pub compressed_mint_inputs: CompressedMintWithContext, pub mint_to_actions: Vec, pub mint_authority: Pubkey, pub proof: ValidityProof, } -impl MintToCTokenParams { +impl MintToTokenParams { pub fn new( compressed_mint_inputs: CompressedMintWithContext, amount: u64, @@ -54,8 +54,8 @@ impl MintToCTokenParams { /// # Create a mint to ctoken instruction: /// ```rust,no_run /// # use solana_pubkey::Pubkey; -/// use light_ctoken_sdk::ctoken::{MintToCToken, MintToCTokenParams, CompressedMintWithContext}; -/// use light_ctoken_sdk::ValidityProof; +/// use light_token_sdk::token::{MintToToken, MintToTokenParams, CompressedMintWithContext}; +/// use light_token_sdk::ValidityProof; /// # let compressed_mint_with_context: CompressedMintWithContext = todo!(); /// # let validity_proof: ValidityProof = todo!(); /// # let mint_authority = Pubkey::new_unique(); @@ -65,13 +65,13 @@ impl MintToCTokenParams { /// # let output_queue = Pubkey::new_unique(); /// # let ctoken_account = Pubkey::new_unique(); /// -/// let params = MintToCTokenParams::new( +/// let params = MintToTokenParams::new( /// compressed_mint_with_context, // from rpc /// 1000, // amount /// mint_authority, /// validity_proof, // from rpc /// ); -/// let instruction = MintToCToken::new( +/// let instruction = MintToToken::new( /// params, /// payer, /// state_tree_pubkey, @@ -82,7 +82,7 @@ impl MintToCTokenParams { /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` #[derive(Debug, Clone)] -pub struct MintToCToken { +pub struct MintToToken { pub payer: Pubkey, pub state_tree_pubkey: Pubkey, pub input_queue: Pubkey, @@ -90,12 +90,12 @@ pub struct MintToCToken { pub ctoken_accounts: Vec, pub cpi_context: Option, pub cpi_context_pubkey: Option, - pub params: MintToCTokenParams, + pub params: MintToTokenParams, } -impl MintToCToken { +impl MintToToken { pub fn new( - params: MintToCTokenParams, + params: MintToTokenParams, payer: Pubkey, state_tree_pubkey: Pubkey, input_queue: Pubkey, @@ -170,18 +170,18 @@ impl MintToCToken { } // ============================================================================ -// Params Struct: MintToCTokenCpiWriteParams +// Params Struct: MintToTokenCpiWriteParams // ============================================================================ #[derive(Debug, Clone)] -pub struct MintToCTokenCpiWriteParams { +pub struct MintToTokenCpiWriteParams { pub compressed_mint_inputs: CompressedMintWithContext, pub mint_to_actions: Vec, pub mint_authority: Pubkey, pub cpi_context: CpiContext, } -impl MintToCTokenCpiWriteParams { +impl MintToTokenCpiWriteParams { pub fn new( compressed_mint_inputs: CompressedMintWithContext, amount: u64, @@ -209,20 +209,20 @@ impl MintToCTokenCpiWriteParams { } // ============================================================================ -// Builder Struct: MintToCTokenCpiWrite +// Builder Struct: MintToTokenCpiWrite // ============================================================================ #[derive(Debug, Clone)] -pub struct MintToCTokenCpiWrite { +pub struct MintToTokenCpiWrite { pub payer: Pubkey, pub cpi_context_pubkey: Pubkey, pub ctoken_accounts: Vec, - pub params: MintToCTokenCpiWriteParams, + pub params: MintToTokenCpiWriteParams, } -impl MintToCTokenCpiWrite { +impl MintToTokenCpiWrite { pub fn new( - params: MintToCTokenCpiWriteParams, + params: MintToTokenCpiWriteParams, payer: Pubkey, cpi_context_pubkey: Pubkey, ctoken_accounts: Vec, @@ -280,12 +280,12 @@ impl MintToCTokenCpiWrite { } // ============================================================================ -// AccountInfos Struct: MintToCTokenCpi (for CPI usage) +// AccountInfos Struct: MintToTokenCpi (for CPI usage) // ============================================================================ /// # Mint to ctoken account via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::{MintToCTokenCpi, MintToCTokenParams, SystemAccountInfos}; +/// # use light_token_sdk::token::{MintToTokenCpi, MintToTokenParams, SystemAccountInfos}; /// # use solana_account_info::AccountInfo; /// # let authority: AccountInfo = todo!(); /// # let payer: AccountInfo = todo!(); @@ -294,8 +294,8 @@ impl MintToCTokenCpiWrite { /// # let output_queue: AccountInfo = todo!(); /// # let ctoken_accounts: Vec = todo!(); /// # let system_accounts: SystemAccountInfos = todo!(); -/// # let params: MintToCTokenParams = todo!(); -/// MintToCTokenCpi { +/// # let params: MintToTokenParams = todo!(); +/// MintToTokenCpi { /// authority, /// payer, /// state_tree, @@ -310,7 +310,7 @@ impl MintToCTokenCpiWrite { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct MintToCTokenCpi<'info> { +pub struct MintToTokenCpi<'info> { /// The authority for the mint operation (mint_authority). pub authority: AccountInfo<'info>, /// The fee payer for the transaction. @@ -319,15 +319,15 @@ pub struct MintToCTokenCpi<'info> { pub input_queue: AccountInfo<'info>, pub output_queue: AccountInfo<'info>, pub ctoken_accounts: Vec>, - pub system_accounts: crate::ctoken::SystemAccountInfos<'info>, + pub system_accounts: crate::token::SystemAccountInfos<'info>, pub cpi_context: Option, pub cpi_context_account: Option>, - pub params: MintToCTokenParams, + pub params: MintToTokenParams, } -impl<'info> MintToCTokenCpi<'info> { +impl<'info> MintToTokenCpi<'info> { pub fn instruction(&self) -> Result { - MintToCToken::try_from(self)?.instruction() + MintToToken::try_from(self)?.instruction() } pub fn invoke(self) -> Result<(), ProgramError> { @@ -385,13 +385,13 @@ impl<'info> MintToCTokenCpi<'info> { } } -impl<'info> TryFrom<&MintToCTokenCpi<'info>> for MintToCToken { +impl<'info> TryFrom<&MintToTokenCpi<'info>> for MintToToken { type Error = ProgramError; - fn try_from(account_infos: &MintToCTokenCpi<'info>) -> Result { + fn try_from(account_infos: &MintToTokenCpi<'info>) -> Result { if account_infos.params.mint_authority != *account_infos.authority.key { solana_msg::msg!( - "MintToCTokenCpi: params.mint_authority ({}) does not match authority account ({})", + "MintToTokenCpi: params.mint_authority ({}) does not match authority account ({})", account_infos.params.mint_authority, account_infos.authority.key ); @@ -418,19 +418,19 @@ impl<'info> TryFrom<&MintToCTokenCpi<'info>> for MintToCToken { } // ============================================================================ -// AccountInfos Struct: MintToCTokenCpiWriteCpi +// AccountInfos Struct: MintToTokenCpiWriteCpi // ============================================================================ -pub struct MintToCTokenCpiWriteCpi<'info> { +pub struct MintToTokenCpiWriteCpi<'info> { pub payer: AccountInfo<'info>, pub cpi_context_account: AccountInfo<'info>, pub ctoken_accounts: Vec>, - pub params: MintToCTokenCpiWriteParams, + pub params: MintToTokenCpiWriteParams, } -impl<'info> MintToCTokenCpiWriteCpi<'info> { +impl<'info> MintToTokenCpiWriteCpi<'info> { pub fn instruction(&self) -> Result { - MintToCTokenCpiWrite::from(self).instruction() + MintToTokenCpiWrite::from(self).instruction() } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { @@ -441,8 +441,8 @@ impl<'info> MintToCTokenCpiWriteCpi<'info> { } } -impl<'info> From<&MintToCTokenCpiWriteCpi<'info>> for MintToCTokenCpiWrite { - fn from(account_infos: &MintToCTokenCpiWriteCpi<'info>) -> Self { +impl<'info> From<&MintToTokenCpiWriteCpi<'info>> for MintToTokenCpiWrite { + fn from(account_infos: &MintToTokenCpiWriteCpi<'info>) -> Self { Self { payer: *account_infos.payer.key, cpi_context_pubkey: *account_infos.cpi_context_account.key, diff --git a/sdk-libs/ctoken-sdk/src/ctoken/mod.rs b/sdk-libs/token-sdk/src/token/mod.rs similarity index 68% rename from sdk-libs/ctoken-sdk/src/ctoken/mod.rs rename to sdk-libs/token-sdk/src/token/mod.rs index e05f9eef8a..75a72195db 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/mod.rs +++ b/sdk-libs/token-sdk/src/token/mod.rs @@ -3,10 +3,10 @@ //! //! ## Account Creation //! -//! - [`CreateAssociatedCTokenAccount`] - Create associated ctoken account (ATA) instruction -//! - [`CreateAssociatedCTokenAccountCpi`] - Create associated ctoken account (ATA) via CPI -//! - [`CreateCTokenAccount`] - Create ctoken account instruction -//! - [`CreateCTokenAccountCpi`] - Create ctoken account via CPI +//! - [`CreateAssociatedTokenAccount`] - Create associated ctoken account (ATA) instruction +//! - [`CreateAssociatedTokenAccountCpi`] - Create associated ctoken account (ATA) via CPI +//! - [`CreateTokenAccount`] - Create ctoken account instruction +//! - [`CreateTokenAccountCpi`] - Create ctoken account via CPI //! //! ## Transfers //! @@ -14,29 +14,29 @@ //! //! ## Decompress //! -//! - [`DecompressToCtoken`] - Decompress compressed tokens to a cToken account +//! - [`DecompressToToken`] - Decompress compressed tokens to a cToken account //! //! ## Close //! -//! - [`CloseCTokenAccount`] - Create close ctoken account instruction -//! - [`CloseCTokenAccountCpi`] - Close ctoken account via CPI +//! - [`CloseTokenAccount`] - Create close ctoken account instruction +//! - [`CloseTokenAccountCpi`] - Close ctoken account via CPI //! //! //! ## Mint //! //! - [`CreateCMint`] - Create cMint -//! - [`MintToCToken`] - Mint tokens to ctoken accounts +//! - [`MintToToken`] - Mint tokens to ctoken accounts //! //! # Example: Create cToken Account Instruction //! //! ```rust //! # use solana_pubkey::Pubkey; -//! use light_ctoken_sdk::ctoken::CreateAssociatedCTokenAccount; +//! use light_token_sdk::token::CreateAssociatedTokenAccount; //! # let payer = Pubkey::new_unique(); //! # let owner = Pubkey::new_unique(); //! # let mint = Pubkey::new_unique(); //! -//! let instruction = CreateAssociatedCTokenAccount::new(payer, owner, mint) +//! let instruction = CreateAssociatedTokenAccount::new(payer, owner, mint) //! .idempotent() //! .instruction()?; //! # Ok::<(), solana_program_error::ProgramError>(()) @@ -45,9 +45,9 @@ //! # Example: Create cToken Account CPI //! //! ```rust,ignore -//! use light_ctoken_sdk::ctoken::{CreateAssociatedCTokenAccountCpi, CompressibleParamsCpi}; +//! use light_token_sdk::token::{CreateAssociatedTokenAccountCpi, CompressibleParamsCpi}; //! -//! CreateAssociatedCTokenAccountCpi { +//! CreateAssociatedTokenAccountCpi { //! owner: ctx.accounts.owner.to_account_info(), //! mint: ctx.accounts.mint.to_account_info(), //! payer: ctx.accounts.payer.to_account_info(), @@ -74,19 +74,19 @@ mod compressible; mod create; mod create_ata; mod create_cmint; -mod ctoken_mint_to; -mod ctoken_mint_to_checked; mod decompress; mod decompress_cmint; mod freeze; mod mint_to; mod revoke; mod thaw; -mod transfer_ctoken; -mod transfer_ctoken_checked; -mod transfer_ctoken_spl; +mod token_mint_to; +mod token_mint_to_checked; mod transfer_interface; -mod transfer_spl_ctoken; +mod transfer_spl_to_token; +mod transfer_token; +mod transfer_token_checked; +mod transfer_token_to_spl; pub use approve::*; pub use approve_checked::*; @@ -97,9 +97,7 @@ pub use compressible::{CompressibleParams, CompressibleParamsCpi}; pub use create::*; pub use create_ata::*; pub use create_cmint::*; -pub use ctoken_mint_to::*; -pub use ctoken_mint_to_checked::*; -pub use decompress::DecompressToCtoken; +pub use decompress::DecompressToToken; pub use decompress_cmint::*; pub use freeze::*; use light_compressible::config::CompressibleConfig; @@ -116,11 +114,13 @@ pub use revoke::*; use solana_account_info::AccountInfo; use solana_pubkey::{pubkey, Pubkey}; pub use thaw::*; -pub use transfer_ctoken::*; -pub use transfer_ctoken_checked::*; -pub use transfer_ctoken_spl::{TransferCTokenToSpl, TransferCTokenToSplCpi}; +pub use token_mint_to::*; +pub use token_mint_to_checked::*; pub use transfer_interface::{SplInterface, TransferInterfaceCpi}; -pub use transfer_spl_ctoken::{TransferSplToCtoken, TransferSplToCtokenCpi}; +pub use transfer_spl_to_token::{TransferSplToToken, TransferSplToTokenCpi}; +pub use transfer_token::*; +pub use transfer_token_checked::*; +pub use transfer_token_to_spl::{TransferTokenToSpl, TransferTokenToSplCpi}; /// System accounts required for CPI operations to Light Protocol. /// @@ -146,7 +146,7 @@ pub struct SystemAccountInfos<'info> { /// System accounts with Pubkey references for instruction building. /// /// ```rust -/// # use light_ctoken_sdk::ctoken::SystemAccounts; +/// # use light_token_sdk::token::SystemAccounts; /// # use solana_instruction::AccountMeta; /// let system_accounts = SystemAccounts::default(); /// let accounts = vec![ @@ -181,9 +181,10 @@ impl Default for SystemAccounts { } /// Compressed Token Program ID: `cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m` -pub const CTOKEN_PROGRAM_ID: Pubkey = pubkey!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m"); +pub const LIGHT_TOKEN_PROGRAM_ID: Pubkey = pubkey!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m"); -pub const CTOKEN_CPI_AUTHORITY: Pubkey = pubkey!("GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy"); +pub const LIGHT_TOKEN_CPI_AUTHORITY: Pubkey = + pubkey!("GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy"); pub const COMPRESSIBLE_CONFIG_V1: Pubkey = pubkey!("ACXg8a7VaqecBWrSbdu73W4Pg9gsqXJ3EXAqkHyhvVXg"); @@ -191,25 +192,25 @@ pub const RENT_SPONSOR: Pubkey = pubkey!("r18WwUxfG8kQ69bQPAB2jV6zGNKy3GosFGctjQ /// Returns the program ID for the Compressed Token Program pub fn id() -> Pubkey { - CTOKEN_PROGRAM_ID + LIGHT_TOKEN_PROGRAM_ID } /// Return the cpi authority pda of the Compressed Token Program. pub fn cpi_authority() -> Pubkey { - CTOKEN_CPI_AUTHORITY + LIGHT_TOKEN_CPI_AUTHORITY } pub fn get_spl_interface_pda_and_bump(mint: &Pubkey) -> (Pubkey, u8) { - Pubkey::find_program_address(&[POOL_SEED, mint.as_ref()], &CTOKEN_PROGRAM_ID) + Pubkey::find_program_address(&[POOL_SEED, mint.as_ref()], &LIGHT_TOKEN_PROGRAM_ID) } -/// Returns the associated ctoken address for a given owner and mint. -pub fn get_associated_ctoken_address(owner: &Pubkey, mint: &Pubkey) -> Pubkey { - get_associated_ctoken_address_and_bump(owner, mint).0 +/// Returns the associated token address for a given owner and mint. +pub fn get_associated_token_address(owner: &Pubkey, mint: &Pubkey) -> Pubkey { + get_associated_token_address_and_bump(owner, mint).0 } -/// Returns the associated ctoken address and bump for a given owner and mint. -pub fn get_associated_ctoken_address_and_bump(owner: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) { +/// Returns the associated token address and bump for a given owner and mint. +pub fn get_associated_token_address_and_bump(owner: &Pubkey, mint: &Pubkey) -> (Pubkey, u8) { Pubkey::find_program_address( &[&owner.to_bytes(), &id().to_bytes(), &mint.to_bytes()], &id(), @@ -229,3 +230,14 @@ pub fn rent_sponsor_pda() -> Pubkey { pub fn compression_authority_pda() -> Pubkey { CompressibleConfig::ctoken_v1_compression_authority_pda() } + +// Backwards compatibility aliases for old type names +pub use close::CloseTokenAccount as CloseCTokenAccount; +pub use create::CreateTokenAccount as CreateCTokenAccount; +pub use create_ata::{ + derive_token_ata as derive_ctoken_ata, + CreateAssociatedTokenAccount as CreateAssociatedCTokenAccount, +}; +pub use decompress::DecompressToToken as DecompressToCtoken; +pub use mint_to::MintToToken as MintToCToken; +pub use transfer_token::TransferToken as TransferCToken; diff --git a/sdk-libs/ctoken-sdk/src/ctoken/revoke.rs b/sdk-libs/token-sdk/src/token/revoke.rs similarity index 76% rename from sdk-libs/ctoken-sdk/src/ctoken/revoke.rs rename to sdk-libs/token-sdk/src/token/revoke.rs index 8066fdef72..16e2ee00c2 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/revoke.rs +++ b/sdk-libs/token-sdk/src/token/revoke.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,16 +8,16 @@ use solana_pubkey::Pubkey; /// # Revoke delegation for a CToken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::RevokeCToken; +/// # use light_token_sdk::token::RevokeToken; /// # let token_account = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); -/// let instruction = RevokeCToken { +/// let instruction = RevokeToken { /// token_account, /// owner, /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct RevokeCToken { +pub struct RevokeToken { /// CToken account to revoke delegation for pub token_account: Pubkey, /// Owner of the CToken account (signer, payer for top-up) @@ -26,12 +26,12 @@ pub struct RevokeCToken { /// # Revoke CToken via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::RevokeCTokenCpi; +/// # use light_token_sdk::token::RevokeTokenCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let owner: AccountInfo = todo!(); /// # let system_program: AccountInfo = todo!(); -/// RevokeCTokenCpi { +/// RevokeTokenCpi { /// token_account, /// owner, /// system_program, @@ -39,32 +39,32 @@ pub struct RevokeCToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct RevokeCTokenCpi<'info> { +pub struct RevokeTokenCpi<'info> { pub token_account: AccountInfo<'info>, pub owner: AccountInfo<'info>, pub system_program: AccountInfo<'info>, } -impl<'info> RevokeCTokenCpi<'info> { +impl<'info> RevokeTokenCpi<'info> { pub fn instruction(&self) -> Result { - RevokeCToken::from(self).instruction() + RevokeToken::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = RevokeCToken::from(&self).instruction()?; + let instruction = RevokeToken::from(&self).instruction()?; let account_infos = [self.token_account, self.owner, self.system_program]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = RevokeCToken::from(&self).instruction()?; + let instruction = RevokeToken::from(&self).instruction()?; let account_infos = [self.token_account, self.owner, self.system_program]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&RevokeCTokenCpi<'info>> for RevokeCToken { - fn from(cpi: &RevokeCTokenCpi<'info>) -> Self { +impl<'info> From<&RevokeTokenCpi<'info>> for RevokeToken { + fn from(cpi: &RevokeTokenCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, owner: *cpi.owner.key, @@ -72,10 +72,10 @@ impl<'info> From<&RevokeCTokenCpi<'info>> for RevokeCToken { } } -impl RevokeCToken { +impl RevokeToken { pub fn instruction(self) -> Result { Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.token_account, false), AccountMeta::new(self.owner, true), diff --git a/sdk-libs/ctoken-sdk/src/ctoken/thaw.rs b/sdk-libs/token-sdk/src/token/thaw.rs similarity index 78% rename from sdk-libs/ctoken-sdk/src/ctoken/thaw.rs rename to sdk-libs/token-sdk/src/token/thaw.rs index 975806d4d1..bca06ce437 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/thaw.rs +++ b/sdk-libs/token-sdk/src/token/thaw.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,18 +8,18 @@ use solana_pubkey::Pubkey; /// # Thaw a frozen CToken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::ThawCToken; +/// # use light_token_sdk::token::ThawToken; /// # let token_account = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let freeze_authority = Pubkey::new_unique(); -/// let instruction = ThawCToken { +/// let instruction = ThawToken { /// token_account, /// mint, /// freeze_authority, /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ThawCToken { +pub struct ThawToken { /// CToken account to thaw pub token_account: Pubkey, /// Mint of the token account @@ -30,12 +30,12 @@ pub struct ThawCToken { /// # Thaw CToken via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::ThawCTokenCpi; +/// # use light_token_sdk::token::ThawTokenCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); /// # let freeze_authority: AccountInfo = todo!(); -/// ThawCTokenCpi { +/// ThawTokenCpi { /// token_account, /// mint, /// freeze_authority, @@ -43,32 +43,32 @@ pub struct ThawCToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ThawCTokenCpi<'info> { +pub struct ThawTokenCpi<'info> { pub token_account: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub freeze_authority: AccountInfo<'info>, } -impl<'info> ThawCTokenCpi<'info> { +impl<'info> ThawTokenCpi<'info> { pub fn instruction(&self) -> Result { - ThawCToken::from(self).instruction() + ThawToken::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = ThawCToken::from(&self).instruction()?; + let instruction = ThawToken::from(&self).instruction()?; let account_infos = [self.token_account, self.mint, self.freeze_authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = ThawCToken::from(&self).instruction()?; + let instruction = ThawToken::from(&self).instruction()?; let account_infos = [self.token_account, self.mint, self.freeze_authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&ThawCTokenCpi<'info>> for ThawCToken { - fn from(cpi: &ThawCTokenCpi<'info>) -> Self { +impl<'info> From<&ThawTokenCpi<'info>> for ThawToken { + fn from(cpi: &ThawTokenCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, mint: *cpi.mint.key, @@ -77,10 +77,10 @@ impl<'info> From<&ThawCTokenCpi<'info>> for ThawCToken { } } -impl ThawCToken { +impl ThawToken { pub fn instruction(self) -> Result { Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.token_account, false), AccountMeta::new_readonly(self.mint, false), diff --git a/sdk-libs/ctoken-sdk/src/ctoken/ctoken_mint_to.rs b/sdk-libs/token-sdk/src/token/token_mint_to.rs similarity index 82% rename from sdk-libs/ctoken-sdk/src/ctoken/ctoken_mint_to.rs rename to sdk-libs/token-sdk/src/token/token_mint_to.rs index ededc8e340..ef0934f636 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/ctoken_mint_to.rs +++ b/sdk-libs/token-sdk/src/token/token_mint_to.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Mint tokens to a ctoken account (simple 3-account instruction): /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::CTokenMintTo; +/// # use light_token_sdk::token::TokenMintTo; /// # let cmint = Pubkey::new_unique(); /// # let destination = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = CTokenMintTo { +/// let instruction = TokenMintTo { /// cmint, /// destination, /// amount: 100, @@ -21,7 +21,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CTokenMintTo { +pub struct TokenMintTo { /// CMint account (supply tracking) pub cmint: Pubkey, /// Destination CToken account to mint to @@ -37,13 +37,13 @@ pub struct CTokenMintTo { /// # Mint to ctoken via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::CTokenMintToCpi; +/// # use light_token_sdk::token::TokenMintToCpi; /// # use solana_account_info::AccountInfo; /// # let cmint: AccountInfo = todo!(); /// # let destination: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); /// # let system_program: AccountInfo = todo!(); -/// CTokenMintToCpi { +/// TokenMintToCpi { /// cmint, /// destination, /// amount: 100, @@ -54,7 +54,7 @@ pub struct CTokenMintTo { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CTokenMintToCpi<'info> { +pub struct TokenMintToCpi<'info> { pub cmint: AccountInfo<'info>, pub destination: AccountInfo<'info>, pub amount: u64, @@ -64,13 +64,13 @@ pub struct CTokenMintToCpi<'info> { pub max_top_up: Option, } -impl<'info> CTokenMintToCpi<'info> { +impl<'info> TokenMintToCpi<'info> { pub fn instruction(&self) -> Result { - CTokenMintTo::from(self).instruction() + TokenMintTo::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = CTokenMintTo::from(&self).instruction()?; + let instruction = TokenMintTo::from(&self).instruction()?; let account_infos = [ self.cmint, self.destination, @@ -81,7 +81,7 @@ impl<'info> CTokenMintToCpi<'info> { } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = CTokenMintTo::from(&self).instruction()?; + let instruction = TokenMintTo::from(&self).instruction()?; let account_infos = [ self.cmint, self.destination, @@ -92,8 +92,8 @@ impl<'info> CTokenMintToCpi<'info> { } } -impl<'info> From<&CTokenMintToCpi<'info>> for CTokenMintTo { - fn from(cpi: &CTokenMintToCpi<'info>) -> Self { +impl<'info> From<&TokenMintToCpi<'info>> for TokenMintTo { + fn from(cpi: &TokenMintToCpi<'info>) -> Self { Self { cmint: *cpi.cmint.key, destination: *cpi.destination.key, @@ -104,10 +104,10 @@ impl<'info> From<&CTokenMintToCpi<'info>> for CTokenMintTo { } } -impl CTokenMintTo { +impl TokenMintTo { pub fn instruction(self) -> Result { Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.cmint, false), AccountMeta::new(self.destination, false), @@ -115,7 +115,7 @@ impl CTokenMintTo { AccountMeta::new_readonly(Pubkey::default(), false), // System program for lamport transfers ], data: { - let mut data = vec![7u8]; // CTokenMintTo discriminator + let mut data = vec![7u8]; // TokenMintTo discriminator data.extend_from_slice(&self.amount.to_le_bytes()); // Include max_top_up if set (10-byte format) if let Some(max_top_up) = self.max_top_up { diff --git a/sdk-libs/ctoken-sdk/src/ctoken/ctoken_mint_to_checked.rs b/sdk-libs/token-sdk/src/token/token_mint_to_checked.rs similarity index 79% rename from sdk-libs/ctoken-sdk/src/ctoken/ctoken_mint_to_checked.rs rename to sdk-libs/token-sdk/src/token/token_mint_to_checked.rs index 303f13974f..91bfcddae2 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/ctoken_mint_to_checked.rs +++ b/sdk-libs/token-sdk/src/token/token_mint_to_checked.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Mint tokens to a ctoken account with decimals validation: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::CTokenMintToChecked; +/// # use light_token_sdk::token::TokenMintToChecked; /// # let cmint = Pubkey::new_unique(); /// # let destination = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = CTokenMintToChecked { +/// let instruction = TokenMintToChecked { /// cmint, /// destination, /// amount: 100, @@ -22,7 +22,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CTokenMintToChecked { +pub struct TokenMintToChecked { /// CMint account (supply tracking) pub cmint: Pubkey, /// Destination CToken account to mint to @@ -40,12 +40,12 @@ pub struct CTokenMintToChecked { /// # Mint to ctoken via CPI with decimals validation: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::CTokenMintToCheckedCpi; +/// # use light_token_sdk::token::TokenMintToCheckedCpi; /// # use solana_account_info::AccountInfo; /// # let cmint: AccountInfo = todo!(); /// # let destination: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// CTokenMintToCheckedCpi { +/// TokenMintToCheckedCpi { /// cmint, /// destination, /// amount: 100, @@ -56,7 +56,7 @@ pub struct CTokenMintToChecked { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CTokenMintToCheckedCpi<'info> { +pub struct TokenMintToCheckedCpi<'info> { pub cmint: AccountInfo<'info>, pub destination: AccountInfo<'info>, pub amount: u64, @@ -66,26 +66,26 @@ pub struct CTokenMintToCheckedCpi<'info> { pub max_top_up: Option, } -impl<'info> CTokenMintToCheckedCpi<'info> { +impl<'info> TokenMintToCheckedCpi<'info> { pub fn instruction(&self) -> Result { - CTokenMintToChecked::from(self).instruction() + TokenMintToChecked::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = CTokenMintToChecked::from(&self).instruction()?; + let instruction = TokenMintToChecked::from(&self).instruction()?; let account_infos = [self.cmint, self.destination, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = CTokenMintToChecked::from(&self).instruction()?; + let instruction = TokenMintToChecked::from(&self).instruction()?; let account_infos = [self.cmint, self.destination, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&CTokenMintToCheckedCpi<'info>> for CTokenMintToChecked { - fn from(cpi: &CTokenMintToCheckedCpi<'info>) -> Self { +impl<'info> From<&TokenMintToCheckedCpi<'info>> for TokenMintToChecked { + fn from(cpi: &TokenMintToCheckedCpi<'info>) -> Self { Self { cmint: *cpi.cmint.key, destination: *cpi.destination.key, @@ -97,17 +97,17 @@ impl<'info> From<&CTokenMintToCheckedCpi<'info>> for CTokenMintToChecked { } } -impl CTokenMintToChecked { +impl TokenMintToChecked { pub fn instruction(self) -> Result { Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts: vec![ AccountMeta::new(self.cmint, false), AccountMeta::new(self.destination, false), AccountMeta::new_readonly(self.authority, true), ], data: { - let mut data = vec![14u8]; // CTokenMintToChecked discriminator + let mut data = vec![14u8]; // TokenMintToChecked discriminator data.extend_from_slice(&self.amount.to_le_bytes()); data.push(self.decimals); // Include max_top_up if set (11-byte format) diff --git a/sdk-libs/ctoken-sdk/src/ctoken/transfer_interface.rs b/sdk-libs/token-sdk/src/token/transfer_interface.rs similarity index 81% rename from sdk-libs/ctoken-sdk/src/ctoken/transfer_interface.rs rename to sdk-libs/token-sdk/src/token/transfer_interface.rs index 881a289465..968d528458 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/transfer_interface.rs +++ b/sdk-libs/token-sdk/src/token/transfer_interface.rs @@ -2,10 +2,10 @@ use solana_account_info::AccountInfo; use solana_program_error::ProgramError; use super::{ - transfer_ctoken::TransferCTokenCpi, transfer_ctoken_spl::TransferCTokenToSplCpi, - transfer_spl_ctoken::TransferSplToCtokenCpi, + transfer_spl_to_token::TransferSplToTokenCpi, transfer_token::TransferTokenCpi, + transfer_token_to_spl::TransferTokenToSplCpi, }; -use crate::{error::CTokenSdkError, utils::is_ctoken_account}; +use crate::{error::TokenSdkError, utils::is_token_account}; /// Required accounts to interface between ctoken and SPL token accounts. pub struct SplInterface<'info> { @@ -75,16 +75,16 @@ impl<'info> TransferInterfaceCpi<'info> { spl_interface_pda_bump: Option, ) -> Result { let mint = - mint.ok_or_else(|| ProgramError::Custom(CTokenSdkError::MissingMintAccount.into()))?; + mint.ok_or_else(|| ProgramError::Custom(TokenSdkError::MissingMintAccount.into()))?; let spl_token_program = spl_token_program - .ok_or_else(|| ProgramError::Custom(CTokenSdkError::MissingSplTokenProgram.into()))?; + .ok_or_else(|| ProgramError::Custom(TokenSdkError::MissingSplTokenProgram.into()))?; let spl_interface_pda = spl_interface_pda - .ok_or_else(|| ProgramError::Custom(CTokenSdkError::MissingSplInterfacePda.into()))?; + .ok_or_else(|| ProgramError::Custom(TokenSdkError::MissingSplInterfacePda.into()))?; let spl_interface_pda_bump = spl_interface_pda_bump.ok_or_else(|| { - ProgramError::Custom(CTokenSdkError::MissingSplInterfacePdaBump.into()) + ProgramError::Custom(TokenSdkError::MissingSplInterfacePdaBump.into()) })?; self.spl_interface = Some(SplInterface { @@ -101,13 +101,13 @@ impl<'info> TransferInterfaceCpi<'info> { /// * `UseRegularSplTransfer` - If both source and destination are SPL accounts /// * `CannotDetermineAccountType` - If account type cannot be determined pub fn invoke(self) -> Result<(), ProgramError> { - let source_is_ctoken = is_ctoken_account(&self.source_account) - .map_err(|_| ProgramError::Custom(CTokenSdkError::CannotDetermineAccountType.into()))?; - let dest_is_ctoken = is_ctoken_account(&self.destination_account) - .map_err(|_| ProgramError::Custom(CTokenSdkError::CannotDetermineAccountType.into()))?; + let source_is_ctoken = is_token_account(&self.source_account) + .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; + let dest_is_ctoken = is_token_account(&self.destination_account) + .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; match (source_is_ctoken, dest_is_ctoken) { - (true, true) => TransferCTokenCpi { + (true, true) => TransferTokenCpi { source: self.source_account.clone(), destination: self.destination_account.clone(), amount: self.amount, @@ -118,10 +118,10 @@ impl<'info> TransferInterfaceCpi<'info> { (true, false) => { let config = self.spl_interface.ok_or_else(|| { - ProgramError::Custom(CTokenSdkError::SplInterfaceRequired.into()) + ProgramError::Custom(TokenSdkError::SplInterfaceRequired.into()) })?; - TransferCTokenToSplCpi { + TransferTokenToSplCpi { source_ctoken_account: self.source_account.clone(), destination_spl_token_account: self.destination_account.clone(), amount: self.amount, @@ -141,10 +141,10 @@ impl<'info> TransferInterfaceCpi<'info> { (false, true) => { let config = self.spl_interface.ok_or_else(|| { - ProgramError::Custom(CTokenSdkError::SplInterfaceRequired.into()) + ProgramError::Custom(TokenSdkError::SplInterfaceRequired.into()) })?; - TransferSplToCtokenCpi { + TransferSplToTokenCpi { source_spl_token_account: self.source_account.clone(), destination_ctoken_account: self.destination_account.clone(), amount: self.amount, @@ -164,7 +164,7 @@ impl<'info> TransferInterfaceCpi<'info> { } (false, false) => Err(ProgramError::Custom( - CTokenSdkError::UseRegularSplTransfer.into(), + TokenSdkError::UseRegularSplTransfer.into(), )), } } @@ -174,13 +174,13 @@ impl<'info> TransferInterfaceCpi<'info> { /// * `UseRegularSplTransfer` - If both source and destination are SPL accounts /// * `CannotDetermineAccountType` - If account type cannot be determined pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let source_is_ctoken = is_ctoken_account(&self.source_account) - .map_err(|_| ProgramError::Custom(CTokenSdkError::CannotDetermineAccountType.into()))?; - let dest_is_ctoken = is_ctoken_account(&self.destination_account) - .map_err(|_| ProgramError::Custom(CTokenSdkError::CannotDetermineAccountType.into()))?; + let source_is_ctoken = is_token_account(&self.source_account) + .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; + let dest_is_ctoken = is_token_account(&self.destination_account) + .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; match (source_is_ctoken, dest_is_ctoken) { - (true, true) => TransferCTokenCpi { + (true, true) => TransferTokenCpi { source: self.source_account.clone(), destination: self.destination_account.clone(), amount: self.amount, @@ -191,10 +191,10 @@ impl<'info> TransferInterfaceCpi<'info> { (true, false) => { let config = self.spl_interface.ok_or_else(|| { - ProgramError::Custom(CTokenSdkError::SplInterfaceRequired.into()) + ProgramError::Custom(TokenSdkError::SplInterfaceRequired.into()) })?; - TransferCTokenToSplCpi { + TransferTokenToSplCpi { source_ctoken_account: self.source_account.clone(), destination_spl_token_account: self.destination_account.clone(), amount: self.amount, @@ -214,10 +214,10 @@ impl<'info> TransferInterfaceCpi<'info> { (false, true) => { let config = self.spl_interface.ok_or_else(|| { - ProgramError::Custom(CTokenSdkError::SplInterfaceRequired.into()) + ProgramError::Custom(TokenSdkError::SplInterfaceRequired.into()) })?; - TransferSplToCtokenCpi { + TransferSplToTokenCpi { source_spl_token_account: self.source_account.clone(), destination_ctoken_account: self.destination_account.clone(), amount: self.amount, @@ -237,7 +237,7 @@ impl<'info> TransferInterfaceCpi<'info> { } (false, false) => Err(ProgramError::Custom( - CTokenSdkError::UseRegularSplTransfer.into(), + TokenSdkError::UseRegularSplTransfer.into(), )), } } diff --git a/sdk-libs/ctoken-sdk/src/ctoken/transfer_spl_ctoken.rs b/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs similarity index 92% rename from sdk-libs/ctoken-sdk/src/ctoken/transfer_spl_ctoken.rs rename to sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs index d04a1f6a7b..728bce29f6 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/transfer_spl_ctoken.rs +++ b/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs @@ -16,7 +16,7 @@ use crate::compressed_token::{ /// # Create a transfer SPL to cToken instruction /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::TransferSplToCtoken; +/// # use light_token_sdk::token::TransferSplToToken; /// # let source_spl_token_account = Pubkey::new_unique(); /// # let destination_ctoken_account = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); @@ -24,7 +24,7 @@ use crate::compressed_token::{ /// # let payer = Pubkey::new_unique(); /// # let spl_interface_pda = Pubkey::new_unique(); /// # let spl_token_program = Pubkey::new_unique(); -/// let instruction = TransferSplToCtoken { +/// let instruction = TransferSplToToken { /// amount: 100, /// spl_interface_pda_bump: 255, /// decimals: 9, @@ -38,7 +38,7 @@ use crate::compressed_token::{ /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferSplToCtoken { +pub struct TransferSplToToken { pub amount: u64, pub spl_interface_pda_bump: u8, pub decimals: u8, @@ -54,7 +54,7 @@ pub struct TransferSplToCtoken { /// # Transfer SPL to ctoken via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::TransferSplToCtokenCpi; +/// # use light_token_sdk::token::TransferSplToTokenCpi; /// # use solana_account_info::AccountInfo; /// # let source_spl_token_account: AccountInfo = todo!(); /// # let destination_ctoken_account: AccountInfo = todo!(); @@ -65,7 +65,7 @@ pub struct TransferSplToCtoken { /// # let spl_token_program: AccountInfo = todo!(); /// # let compressed_token_program_authority: AccountInfo = todo!(); /// # let system_program: AccountInfo = todo!(); -/// TransferSplToCtokenCpi { +/// TransferSplToTokenCpi { /// amount: 100, /// spl_interface_pda_bump: 255, /// decimals: 9, @@ -82,7 +82,7 @@ pub struct TransferSplToCtoken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferSplToCtokenCpi<'info> { +pub struct TransferSplToTokenCpi<'info> { pub amount: u64, pub spl_interface_pda_bump: u8, pub decimals: u8, @@ -99,13 +99,13 @@ pub struct TransferSplToCtokenCpi<'info> { pub system_program: AccountInfo<'info>, } -impl<'info> TransferSplToCtokenCpi<'info> { +impl<'info> TransferSplToTokenCpi<'info> { pub fn instruction(&self) -> Result { - TransferSplToCtoken::from(self).instruction() + TransferSplToToken::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TransferSplToCtoken::from(&self).instruction()?; + let instruction = TransferSplToToken::from(&self).instruction()?; // Account order must match instruction metas: cpi_authority_pda, fee_payer, packed_accounts... let account_infos = [ self.compressed_token_program_authority, // CPI authority PDA (first) @@ -122,7 +122,7 @@ impl<'info> TransferSplToCtokenCpi<'info> { } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TransferSplToCtoken::from(&self).instruction()?; + let instruction = TransferSplToToken::from(&self).instruction()?; // Account order must match instruction metas: cpi_authority_pda, fee_payer, packed_accounts... let account_infos = [ self.compressed_token_program_authority, // CPI authority PDA (first) @@ -139,8 +139,8 @@ impl<'info> TransferSplToCtokenCpi<'info> { } } -impl<'info> From<&TransferSplToCtokenCpi<'info>> for TransferSplToCtoken { - fn from(account_infos: &TransferSplToCtokenCpi<'info>) -> Self { +impl<'info> From<&TransferSplToTokenCpi<'info>> for TransferSplToToken { + fn from(account_infos: &TransferSplToTokenCpi<'info>) -> Self { Self { source_spl_token_account: *account_infos.source_spl_token_account.key, destination_ctoken_account: *account_infos.destination_ctoken_account.key, @@ -156,7 +156,7 @@ impl<'info> From<&TransferSplToCtokenCpi<'info>> for TransferSplToCtoken { } } -impl TransferSplToCtoken { +impl TransferSplToToken { pub fn instruction(self) -> Result { let packed_accounts = vec![ // Mint (index 0) diff --git a/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken.rs b/sdk-libs/token-sdk/src/token/transfer_token.rs similarity index 83% rename from sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken.rs rename to sdk-libs/token-sdk/src/token/transfer_token.rs index b2acf879ee..7a1797bc40 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken.rs +++ b/sdk-libs/token-sdk/src/token/transfer_token.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Create a transfer ctoken instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::TransferCToken; +/// # use light_token_sdk::token::TransferToken; /// # let source = Pubkey::new_unique(); /// # let destination = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = TransferCToken { +/// let instruction = TransferToken { /// source, /// destination, /// amount: 100, @@ -21,7 +21,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferCToken { +pub struct TransferToken { pub source: Pubkey, pub destination: Pubkey, pub amount: u64, @@ -33,12 +33,12 @@ pub struct TransferCToken { /// # Transfer ctoken via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::TransferCTokenCpi; +/// # use light_token_sdk::token::TransferTokenCpi; /// # use solana_account_info::AccountInfo; /// # let source: AccountInfo = todo!(); /// # let destination: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// TransferCTokenCpi { +/// TransferTokenCpi { /// source, /// destination, /// amount: 100, @@ -48,7 +48,7 @@ pub struct TransferCToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferCTokenCpi<'info> { +pub struct TransferTokenCpi<'info> { pub source: AccountInfo<'info>, pub destination: AccountInfo<'info>, pub amount: u64, @@ -57,26 +57,26 @@ pub struct TransferCTokenCpi<'info> { pub max_top_up: Option, } -impl<'info> TransferCTokenCpi<'info> { +impl<'info> TransferTokenCpi<'info> { pub fn instruction(&self) -> Result { - TransferCToken::from(self).instruction() + TransferToken::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TransferCToken::from(&self).instruction()?; + let instruction = TransferToken::from(&self).instruction()?; let account_infos = [self.source, self.destination, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TransferCToken::from(&self).instruction()?; + let instruction = TransferToken::from(&self).instruction()?; let account_infos = [self.source, self.destination, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&TransferCTokenCpi<'info>> for TransferCToken { - fn from(account_infos: &TransferCTokenCpi<'info>) -> Self { +impl<'info> From<&TransferTokenCpi<'info>> for TransferToken { + fn from(account_infos: &TransferTokenCpi<'info>) -> Self { Self { source: *account_infos.source.key, destination: *account_infos.destination.key, @@ -87,7 +87,7 @@ impl<'info> From<&TransferCTokenCpi<'info>> for TransferCToken { } } -impl TransferCToken { +impl TransferToken { pub fn instruction(self) -> Result { // Authority is writable only when max_top_up is set (for compressible top-up lamport transfer) let authority_meta = if self.max_top_up.is_some() { @@ -111,7 +111,7 @@ impl TransferCToken { } Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts, data: { let mut data = vec![3u8]; diff --git a/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_checked.rs b/sdk-libs/token-sdk/src/token/transfer_token_checked.rs similarity index 84% rename from sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_checked.rs rename to sdk-libs/token-sdk/src/token/transfer_token_checked.rs index 05fbb07e29..d0715625e4 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_checked.rs +++ b/sdk-libs/token-sdk/src/token/transfer_token_checked.rs @@ -1,4 +1,4 @@ -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -8,12 +8,12 @@ use solana_pubkey::Pubkey; /// # Create a transfer ctoken checked instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::TransferCTokenChecked; +/// # use light_token_sdk::token::TransferTokenChecked; /// # let source = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let destination = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = TransferCTokenChecked { +/// let instruction = TransferTokenChecked { /// source, /// mint, /// destination, @@ -24,7 +24,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferCTokenChecked { +pub struct TransferTokenChecked { pub source: Pubkey, pub mint: Pubkey, pub destination: Pubkey, @@ -38,13 +38,13 @@ pub struct TransferCTokenChecked { /// # Transfer ctoken checked via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::TransferCTokenCheckedCpi; +/// # use light_token_sdk::token::TransferTokenCheckedCpi; /// # use solana_account_info::AccountInfo; /// # let source: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); /// # let destination: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// TransferCTokenCheckedCpi { +/// TransferTokenCheckedCpi { /// source, /// mint, /// destination, @@ -56,7 +56,7 @@ pub struct TransferCTokenChecked { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferCTokenCheckedCpi<'info> { +pub struct TransferTokenCheckedCpi<'info> { pub source: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub destination: AccountInfo<'info>, @@ -67,26 +67,26 @@ pub struct TransferCTokenCheckedCpi<'info> { pub max_top_up: Option, } -impl<'info> TransferCTokenCheckedCpi<'info> { +impl<'info> TransferTokenCheckedCpi<'info> { pub fn instruction(&self) -> Result { - TransferCTokenChecked::from(self).instruction() + TransferTokenChecked::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TransferCTokenChecked::from(&self).instruction()?; + let instruction = TransferTokenChecked::from(&self).instruction()?; let account_infos = [self.source, self.mint, self.destination, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TransferCTokenChecked::from(&self).instruction()?; + let instruction = TransferTokenChecked::from(&self).instruction()?; let account_infos = [self.source, self.mint, self.destination, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&TransferCTokenCheckedCpi<'info>> for TransferCTokenChecked { - fn from(account_infos: &TransferCTokenCheckedCpi<'info>) -> Self { +impl<'info> From<&TransferTokenCheckedCpi<'info>> for TransferTokenChecked { + fn from(account_infos: &TransferTokenCheckedCpi<'info>) -> Self { Self { source: *account_infos.source.key, mint: *account_infos.mint.key, @@ -99,7 +99,7 @@ impl<'info> From<&TransferCTokenCheckedCpi<'info>> for TransferCTokenChecked { } } -impl TransferCTokenChecked { +impl TransferTokenChecked { pub fn instruction(self) -> Result { // Authority is writable only when max_top_up is set (for compressible top-up lamport transfer) let authority_meta = if self.max_top_up.is_some() { @@ -124,7 +124,7 @@ impl TransferCTokenChecked { } Ok(Instruction { - program_id: Pubkey::from(C_TOKEN_PROGRAM_ID), + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), accounts, data: { // Discriminator (1) + amount (8) + decimals (1) + optional max_top_up (2) diff --git a/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_spl.rs b/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs similarity index 92% rename from sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_spl.rs rename to sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs index ba1215d39e..5c5b39d60b 100644 --- a/sdk-libs/ctoken-sdk/src/ctoken/transfer_ctoken_spl.rs +++ b/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs @@ -1,6 +1,6 @@ use light_compressed_account::instruction_data::compressed_proof::ValidityProof; -use light_token_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; use light_program_profiler::profile; +use light_token_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; use solana_instruction::{AccountMeta, Instruction}; @@ -17,7 +17,7 @@ use crate::compressed_token::{ /// # Create a transfer ctoken to SPL instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_ctoken_sdk::ctoken::TransferCTokenToSpl; +/// # use light_token_sdk::token::TransferTokenToSpl; /// # let source_ctoken_account = Pubkey::new_unique(); /// # let destination_spl_token_account = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); @@ -25,7 +25,7 @@ use crate::compressed_token::{ /// # let payer = Pubkey::new_unique(); /// # let spl_interface_pda = Pubkey::new_unique(); /// # let spl_token_program = Pubkey::new_unique(); -/// let instruction = TransferCTokenToSpl { +/// let instruction = TransferTokenToSpl { /// source_ctoken_account, /// destination_spl_token_account, /// amount: 100, @@ -39,7 +39,7 @@ use crate::compressed_token::{ /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferCTokenToSpl { +pub struct TransferTokenToSpl { pub source_ctoken_account: Pubkey, pub destination_spl_token_account: Pubkey, pub amount: u64, @@ -54,7 +54,7 @@ pub struct TransferCTokenToSpl { /// # Transfer ctoken to SPL via CPI: /// ```rust,no_run -/// # use light_ctoken_sdk::ctoken::TransferCTokenToSplCpi; +/// # use light_token_sdk::token::TransferTokenToSplCpi; /// # use solana_account_info::AccountInfo; /// # let source_ctoken_account: AccountInfo = todo!(); /// # let destination_spl_token_account: AccountInfo = todo!(); @@ -64,7 +64,7 @@ pub struct TransferCTokenToSpl { /// # let spl_interface_pda: AccountInfo = todo!(); /// # let spl_token_program: AccountInfo = todo!(); /// # let compressed_token_program_authority: AccountInfo = todo!(); -/// TransferCTokenToSplCpi { +/// TransferTokenToSplCpi { /// source_ctoken_account, /// destination_spl_token_account, /// amount: 100, @@ -80,7 +80,7 @@ pub struct TransferCTokenToSpl { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferCTokenToSplCpi<'info> { +pub struct TransferTokenToSplCpi<'info> { pub source_ctoken_account: AccountInfo<'info>, pub destination_spl_token_account: AccountInfo<'info>, pub amount: u64, @@ -94,13 +94,13 @@ pub struct TransferCTokenToSplCpi<'info> { pub compressed_token_program_authority: AccountInfo<'info>, } -impl<'info> TransferCTokenToSplCpi<'info> { +impl<'info> TransferTokenToSplCpi<'info> { pub fn instruction(&self) -> Result { - TransferCTokenToSpl::from(self).instruction() + TransferTokenToSpl::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TransferCTokenToSpl::from(&self).instruction()?; + let instruction = TransferTokenToSpl::from(&self).instruction()?; // Account order must match instruction metas: cpi_authority_pda, fee_payer, packed_accounts... let account_infos = [ self.compressed_token_program_authority, // CPI authority PDA (first) @@ -116,7 +116,7 @@ impl<'info> TransferCTokenToSplCpi<'info> { } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TransferCTokenToSpl::from(&self).instruction()?; + let instruction = TransferTokenToSpl::from(&self).instruction()?; // Account order must match instruction metas: cpi_authority_pda, fee_payer, packed_accounts... let account_infos = [ self.compressed_token_program_authority, // CPI authority PDA (first) @@ -132,8 +132,8 @@ impl<'info> TransferCTokenToSplCpi<'info> { } } -impl<'info> From<&TransferCTokenToSplCpi<'info>> for TransferCTokenToSpl { - fn from(account_infos: &TransferCTokenToSplCpi<'info>) -> Self { +impl<'info> From<&TransferTokenToSplCpi<'info>> for TransferTokenToSpl { + fn from(account_infos: &TransferTokenToSplCpi<'info>) -> Self { Self { source_ctoken_account: *account_infos.source_ctoken_account.key, destination_spl_token_account: *account_infos.destination_spl_token_account.key, @@ -149,7 +149,7 @@ impl<'info> From<&TransferCTokenToSplCpi<'info>> for TransferCTokenToSpl { } } -impl TransferCTokenToSpl { +impl TransferTokenToSpl { #[profile] pub fn instruction(self) -> Result { let packed_accounts = vec![ diff --git a/sdk-libs/ctoken-sdk/src/utils.rs b/sdk-libs/token-sdk/src/utils.rs similarity index 81% rename from sdk-libs/ctoken-sdk/src/utils.rs rename to sdk-libs/token-sdk/src/utils.rs index 6c9c7453a9..2010a8a6e9 100644 --- a/sdk-libs/ctoken-sdk/src/utils.rs +++ b/sdk-libs/token-sdk/src/utils.rs @@ -1,26 +1,26 @@ //! Utility functions and default account configurations. +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use light_token_interface::{ instructions::transfer2::MultiInputTokenDataWithContext, state::Token, }; -use light_sdk_types::C_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; -use crate::{error::CTokenSdkError, AnchorDeserialize, AnchorSerialize}; +use crate::{error::TokenSdkError, AnchorDeserialize, AnchorSerialize}; -pub fn get_token_account_balance(token_account_info: &AccountInfo) -> Result { +pub fn get_token_account_balance(token_account_info: &AccountInfo) -> Result { let data = token_account_info .try_borrow_data() - .map_err(|_| CTokenSdkError::AccountBorrowFailed)?; - Token::amount_from_slice(&data).map_err(|_| CTokenSdkError::InvalidAccountData) + .map_err(|_| TokenSdkError::AccountBorrowFailed)?; + Token::amount_from_slice(&data).map_err(|_| TokenSdkError::InvalidAccountData) } -pub fn is_ctoken_account(account_info: &AccountInfo) -> Result { - let ctoken_program_id = Pubkey::from(C_TOKEN_PROGRAM_ID); +pub fn is_token_account(account_info: &AccountInfo) -> Result { + let light_token_program_id = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); - if account_info.owner == &ctoken_program_id { + if account_info.owner == &light_token_program_id { return Ok(true); } @@ -31,7 +31,7 @@ pub fn is_ctoken_account(account_info: &AccountInfo) -> Result { pub account_info: AccountInfo<'info>, pub signer_seeds: Vec>, } +use light_sdk::constants::REGISTERED_PROGRAM_PDA; use light_token_types::{ ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, CPI_AUTHORITY_PDA, LIGHT_SYSTEM_PROGRAM_ID, NOOP_PROGRAM_ID, PROGRAM_ID as LIGHT_COMPRESSED_TOKEN_PROGRAM_ID, }; -use light_sdk::constants::REGISTERED_PROGRAM_PDA; /// Standard pubkeys for compressed token instructions #[derive(Debug, Copy, Clone)] @@ -87,7 +87,7 @@ impl Default for CTokenDefaultAccounts { self_program: Pubkey::from(LIGHT_COMPRESSED_TOKEN_PROGRAM_ID), cpi_authority_pda: Pubkey::from(CPI_AUTHORITY_PDA), system_program: Pubkey::default(), - compressed_token_program: Pubkey::from(C_TOKEN_PROGRAM_ID), + compressed_token_program: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), } } } diff --git a/sdk-libs/ctoken-sdk/tests/account_metas_test.rs b/sdk-libs/token-sdk/tests/account_metas_test.rs similarity index 97% rename from sdk-libs/ctoken-sdk/tests/account_metas_test.rs rename to sdk-libs/token-sdk/tests/account_metas_test.rs index a52970a051..9fbb54b33e 100644 --- a/sdk-libs/ctoken-sdk/tests/account_metas_test.rs +++ b/sdk-libs/token-sdk/tests/account_metas_test.rs @@ -1,6 +1,7 @@ #![cfg(feature = "v1")] use anchor_lang::ToAccountMetas; -use light_ctoken_sdk::{ +use light_sdk::constants::REGISTERED_PROGRAM_PDA; +use light_token_sdk::{ compressed_token::{ batch_compress::{get_batch_compress_instruction_account_metas, BatchCompressMetaConfig}, transfer::account_metas::{ @@ -11,9 +12,8 @@ use light_ctoken_sdk::{ }; use light_token_types::constants::{ ACCOUNT_COMPRESSION_PROGRAM_ID, CPI_AUTHORITY_PDA, LIGHT_SYSTEM_PROGRAM_ID, NOOP_PROGRAM_ID, - PROGRAM_ID as CTOKEN_PROGRAM_ID, + PROGRAM_ID as LIGHT_TOKEN_PROGRAM_ID, }; -use light_sdk::constants::REGISTERED_PROGRAM_PDA; use solana_pubkey::Pubkey; // TODO: Rewrite to use get_transfer_instruction_account_metas @@ -124,7 +124,7 @@ fn test_get_batch_compress_instruction_account_metas() { account_compression_authority: default_pubkeys.account_compression_authority, account_compression_program: Pubkey::from(ACCOUNT_COMPRESSION_PROGRAM_ID), merkle_tree, - self_program: Pubkey::from(CTOKEN_PROGRAM_ID), + self_program: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), system_program: Pubkey::default(), sol_pool_pda: None, }; diff --git a/sdk-libs/ctoken-sdk/tests/create_associated_token_account.rs b/sdk-libs/token-sdk/tests/create_associated_token_account.rs similarity index 72% rename from sdk-libs/ctoken-sdk/tests/create_associated_token_account.rs rename to sdk-libs/token-sdk/tests/create_associated_token_account.rs index 9063e44da8..73d40c5712 100644 --- a/sdk-libs/ctoken-sdk/tests/create_associated_token_account.rs +++ b/sdk-libs/token-sdk/tests/create_associated_token_account.rs @@ -1,4 +1,4 @@ -use light_ctoken_sdk::ctoken::{derive_ctoken_ata, CreateAssociatedCTokenAccount}; +use light_token_sdk::token::{derive_token_ata, CreateAssociatedTokenAccount}; use solana_pubkey::Pubkey; const CREATE_ATA_DISCRIMINATOR: u8 = 100; @@ -10,12 +10,12 @@ fn test_discriminator_selection() { let owner = Pubkey::new_unique(); let mint = Pubkey::new_unique(); - let ix_regular = CreateAssociatedCTokenAccount::new(payer, owner, mint) + let ix_regular = CreateAssociatedTokenAccount::new(payer, owner, mint) .instruction() .unwrap(); assert_eq!(ix_regular.data[0], CREATE_ATA_DISCRIMINATOR); - let ix_idempotent = CreateAssociatedCTokenAccount::new(payer, owner, mint) + let ix_idempotent = CreateAssociatedTokenAccount::new(payer, owner, mint) .idempotent() .instruction() .unwrap(); @@ -28,10 +28,10 @@ fn test_instruction_data_consistency() { let owner = Pubkey::new_unique(); let mint = Pubkey::new_unique(); - let ix_regular = CreateAssociatedCTokenAccount::new(payer, owner, mint) + let ix_regular = CreateAssociatedTokenAccount::new(payer, owner, mint) .instruction() .unwrap(); - let ix_idempotent = CreateAssociatedCTokenAccount::new(payer, owner, mint) + let ix_idempotent = CreateAssociatedTokenAccount::new(payer, owner, mint) .idempotent() .instruction() .unwrap(); @@ -48,16 +48,16 @@ fn test_with_bump_functions() { let payer = Pubkey::new_unique(); let owner = Pubkey::new_unique(); let mint = Pubkey::new_unique(); - let (ata_pubkey, bump) = derive_ctoken_ata(&owner, &mint); + let (ata_pubkey, bump) = derive_token_ata(&owner, &mint); let ix_with_bump = - CreateAssociatedCTokenAccount::new_with_bump(payer, owner, mint, ata_pubkey, bump) + CreateAssociatedTokenAccount::new_with_bump(payer, owner, mint, ata_pubkey, bump) .instruction() .unwrap(); assert_eq!(ix_with_bump.data[0], CREATE_ATA_DISCRIMINATOR); let ix_with_bump_idempotent = - CreateAssociatedCTokenAccount::new_with_bump(payer, owner, mint, ata_pubkey, bump) + CreateAssociatedTokenAccount::new_with_bump(payer, owner, mint, ata_pubkey, bump) .idempotent() .instruction() .unwrap(); @@ -73,7 +73,7 @@ fn test_account_count() { let owner = Pubkey::new_unique(); let mint = Pubkey::new_unique(); - let ix_compressible = CreateAssociatedCTokenAccount::new(payer, owner, mint) + let ix_compressible = CreateAssociatedTokenAccount::new(payer, owner, mint) .instruction() .unwrap(); diff --git a/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs b/sdk-libs/token-sdk/tests/mint_action_cpi_accounts_tests.rs similarity index 93% rename from sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs rename to sdk-libs/token-sdk/tests/mint_action_cpi_accounts_tests.rs index 611c584d99..ab1a5ee014 100644 --- a/sdk-libs/ctoken-sdk/tests/mint_action_cpi_accounts_tests.rs +++ b/sdk-libs/token-sdk/tests/mint_action_cpi_accounts_tests.rs @@ -1,15 +1,15 @@ #![cfg(test)] use light_account_checks::account_info::test_account_info::pinocchio::get_account_info; -use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; -use light_ctoken_sdk::compressed_token::mint_action::{ - cpi_accounts::MintActionCpiAccountsConfig, MintActionCpiAccounts, -}; -use light_token_types::CPI_AUTHORITY_PDA; use light_sdk_types::{ ACCOUNT_COMPRESSION_AUTHORITY_PDA, ACCOUNT_COMPRESSION_PROGRAM_ID, LIGHT_SYSTEM_PROGRAM_ID, REGISTERED_PROGRAM_PDA, }; +use light_token_interface::LIGHT_TOKEN_PROGRAM_ID; +use light_token_sdk::compressed_token::mint_action::{ + cpi_accounts::MintActionCpiAccountsConfig, MintActionCpiAccounts, +}; +use light_token_types::CPI_AUTHORITY_PDA; use pinocchio::account_info::AccountInfo; /// Helper function to create test AccountInfo with specific properties @@ -57,7 +57,14 @@ fn test_successful_parsing_minimal() { // Create minimal set of accounts required for parsing let accounts = vec![ // Programs - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -129,7 +136,10 @@ fn test_successful_parsing_minimal() { assert!(result.is_ok()); let parsed = result.unwrap(); - assert_eq!(*parsed.compressed_token_program.key(), LIGHT_TOKEN_PROGRAM_ID); + assert_eq!( + *parsed.compressed_token_program.key(), + LIGHT_TOKEN_PROGRAM_ID + ); assert_eq!(*parsed.light_system_program.key(), LIGHT_SYSTEM_PROGRAM_ID); assert!(parsed.mint_signer.is_none()); assert!(parsed.authority.is_signer()); @@ -145,7 +155,14 @@ fn test_successful_parsing_with_all_options() { let accounts = vec![ // Programs - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -249,7 +266,14 @@ fn test_successful_create_mint() { let accounts = vec![ // Programs - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -325,7 +349,14 @@ fn test_successful_create_mint() { fn test_successful_update_mint() { let accounts = vec![ // Programs - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -479,7 +510,14 @@ fn test_invalid_light_system_program_id() { let wrong_program_id = pubkey_unique(); let accounts = vec![ - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), // Wrong light system program ID create_test_account(wrong_program_id, [0u8; 32], false, false, true, vec![]), // Rest of minimal accounts... @@ -537,7 +575,14 @@ fn test_invalid_light_system_program_id() { #[test] fn test_authority_not_signer() { let accounts = vec![ - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -602,7 +647,14 @@ fn test_authority_not_signer() { #[test] fn test_fee_payer_not_signer() { let accounts = vec![ - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -669,7 +721,14 @@ fn test_invalid_tree_ownership() { let wrong_owner = pubkey_unique(); let accounts = vec![ - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -728,7 +787,14 @@ fn test_invalid_queue_ownership() { let wrong_owner = pubkey_unique(); let accounts = vec![ - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], @@ -801,7 +867,14 @@ fn test_invalid_queue_ownership() { fn test_helper_methods() { // Create accounts for testing helper methods let accounts = vec![ - create_test_account(LIGHT_TOKEN_PROGRAM_ID, [0u8; 32], false, false, true, vec![]), + create_test_account( + LIGHT_TOKEN_PROGRAM_ID, + [0u8; 32], + false, + false, + true, + vec![], + ), create_test_account( LIGHT_SYSTEM_PROGRAM_ID, [0u8; 32], diff --git a/sdk-libs/ctoken-sdk/tests/pack_test.rs b/sdk-libs/token-sdk/tests/pack_test.rs similarity index 99% rename from sdk-libs/ctoken-sdk/tests/pack_test.rs rename to sdk-libs/token-sdk/tests/pack_test.rs index a43800a26c..2f3039c725 100644 --- a/sdk-libs/ctoken-sdk/tests/pack_test.rs +++ b/sdk-libs/token-sdk/tests/pack_test.rs @@ -1,10 +1,10 @@ #![cfg(feature = "compressible")] -use light_ctoken_sdk::{ +use light_sdk::instruction::PackedAccounts; +use light_token_sdk::{ compat::{PackedCTokenDataWithVariant, TokenData, TokenDataWithVariant}, pack::Pack, }; -use light_sdk::instruction::PackedAccounts; use solana_pubkey::Pubkey; #[test] diff --git a/sdk-tests/client-test/Cargo.toml b/sdk-tests/client-test/Cargo.toml index edd1addf93..0709251ea2 100644 --- a/sdk-tests/client-test/Cargo.toml +++ b/sdk-tests/client-test/Cargo.toml @@ -26,7 +26,7 @@ light-zero-copy = { workspace = true } light-hasher = { workspace = true, features = ["poseidon"] } light-compressed-account = { workspace = true, features = ["std"] } light-compressed-token = { workspace = true } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } light-indexed-array = { workspace = true } light-merkle-tree-reference = { workspace = true } light-macros = { workspace = true } diff --git a/sdk-tests/client-test/tests/light_client.rs b/sdk-tests/client-test/tests/light_client.rs index bc69f40e51..57d089f832 100644 --- a/sdk-tests/client-test/tests/light_client.rs +++ b/sdk-tests/client-test/tests/light_client.rs @@ -11,12 +11,12 @@ use light_compressed_account::{hash_to_bn254_field_size_be, TreeType}; use light_compressed_token::mint_sdk::{ create_create_token_pool_instruction, create_mint_to_instruction, }; -use light_ctoken_sdk::compat::{AccountState, TokenData}; use light_hasher::Poseidon; use light_merkle_tree_reference::{indexed::IndexedMerkleTree, MerkleTree}; use light_program_test::accounts::test_accounts::TestAccounts; use light_sdk::address::{v1::derive_address, NewAddressParams}; use light_test_utils::{system_program::create_invoke_instruction, Rpc, RpcError}; +use light_token_sdk::compat::{AccountState, TokenData}; use solana_compute_budget_interface::ComputeBudgetInstruction; use solana_keypair::Keypair; use solana_pubkey::Pubkey; diff --git a/sdk-tests/client-test/tests/light_program_test.rs b/sdk-tests/client-test/tests/light_program_test.rs index 2d5ea5f193..7cf11155f2 100644 --- a/sdk-tests/client-test/tests/light_program_test.rs +++ b/sdk-tests/client-test/tests/light_program_test.rs @@ -9,12 +9,12 @@ use light_compressed_account::hash_to_bn254_field_size_be; use light_compressed_token::mint_sdk::{ create_create_token_pool_instruction, create_mint_to_instruction, }; -use light_ctoken_sdk::compat::{AccountState, TokenData}; use light_program_test::{ accounts::test_accounts::TestAccounts, program_test::LightProgramTest, ProgramTestConfig, }; use light_sdk::address::{v1::derive_address, NewAddressParams}; use light_test_utils::{system_program::create_invoke_instruction, RpcError}; +use light_token_sdk::compat::{AccountState, TokenData}; use solana_sdk::{ compute_budget::ComputeBudgetInstruction, pubkey::Pubkey, diff --git a/sdk-tests/csdk-anchor-derived-test/Cargo.toml b/sdk-tests/csdk-anchor-derived-test/Cargo.toml index 2f32cfcbf2..8e4fcdfd87 100644 --- a/sdk-tests/csdk-anchor-derived-test/Cargo.toml +++ b/sdk-tests/csdk-anchor-derived-test/Cargo.toml @@ -30,7 +30,7 @@ light-compressed-account = { workspace = true, features = ["solana"] } anchor-lang = { workspace = true, features = ["idl-build"] } anchor-spl = { version = "=0.31.1", git = "https://github.com/lightprotocol/anchor", rev = "d8a2b3d9", features = ["memo", "metadata", "idl-build"] } light-token-interface = { workspace = true, features = ["anchor"] } -light-ctoken-sdk = { workspace = true, features = ["anchor", "compressible"] } +light-token-sdk = { workspace = true, features = ["anchor", "compressible"] } light-token-types = { workspace = true, features = ["anchor"] } light-compressible = { workspace = true, features = ["anchor"] } diff --git a/sdk-tests/csdk-anchor-derived-test/src/instruction_accounts.rs b/sdk-tests/csdk-anchor-derived-test/src/instruction_accounts.rs index 13e0100ddd..eae19d13f8 100644 --- a/sdk-tests/csdk-anchor-derived-test/src/instruction_accounts.rs +++ b/sdk-tests/csdk-anchor-derived-test/src/instruction_accounts.rs @@ -31,7 +31,7 @@ pub struct CreateUserRecordAndGameSession<'info> { pub mint_authority: Signer<'info>, /// Compressed token program - /// CHECK: Program ID validated using C_TOKEN_PROGRAM_ID constant + /// CHECK: Program ID validated using LIGHT_TOKEN_PROGRAM_ID constant pub ctoken_program: UncheckedAccount<'info>, /// CHECK: CPI authority of the compressed token program diff --git a/sdk-tests/csdk-anchor-derived-test/src/lib.rs b/sdk-tests/csdk-anchor-derived-test/src/lib.rs index 804c3b7ef2..8268f1cdbc 100644 --- a/sdk-tests/csdk-anchor-derived-test/src/lib.rs +++ b/sdk-tests/csdk-anchor-derived-test/src/lib.rs @@ -25,12 +25,6 @@ pub const LIGHT_CPI_SIGNER: CpiSigner = pub mod csdk_anchor_derived_test { use anchor_lang::solana_program::{program::invoke, sysvar::clock::Clock}; use light_compressed_account::instruction_data::traits::LightInstructionData; - use light_token_interface::instructions::mint_action::{ - MintActionCompressedInstructionData, MintToCompressedAction, Recipient, - }; - use light_ctoken_sdk::compressed_token::{ - create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, - }; use light_sdk::{ compressible::{ compress_account_on_init::prepare_compressed_account_on_init, CompressibleConfig, @@ -43,6 +37,12 @@ pub mod csdk_anchor_derived_test { use light_sdk_types::{ cpi_accounts::CpiAccountsConfig, cpi_context_write::CpiContextWriteAccounts, }; + use light_token_interface::instructions::mint_action::{ + MintActionCompressedInstructionData, MintToCompressedAction, Recipient, + }; + use light_token_sdk::compressed_token::{ + create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, + }; use super::*; use crate::{ diff --git a/sdk-tests/csdk-anchor-derived-test/src/processor.rs b/sdk-tests/csdk-anchor-derived-test/src/processor.rs index 8f1082b62a..82c3e3847e 100644 --- a/sdk-tests/csdk-anchor-derived-test/src/processor.rs +++ b/sdk-tests/csdk-anchor-derived-test/src/processor.rs @@ -1,12 +1,12 @@ use anchor_lang::prelude::*; use light_compressed_account::instruction_data::with_account_info::CompressedAccountInfo; -use light_ctoken_sdk::compat::PackedCTokenData; use light_sdk::{ compressible::{compress_account::prepare_account_for_compression, CompressibleConfig}, cpi::v2::CpiAccounts, instruction::{account_meta::CompressedAccountMetaNoLamportsNoAddress, ValidityProof}, LightDiscriminator, }; +use light_token_sdk::compat::PackedCTokenData; use crate::{ instruction_accounts::{CompressAccountsIdempotent, DecompressAccountsIdempotent}, @@ -16,7 +16,7 @@ use crate::{ }; impl light_sdk::compressible::HasTokenVariant for CompressedAccountData { - fn is_packed_ctoken(&self) -> bool { + fn is_packed_token(&self) -> bool { matches!(self.data, CompressedAccountVariant::PackedCTokenData(_)) } } @@ -45,19 +45,19 @@ impl<'info> light_sdk::compressible::DecompressContext<'info> self.rent_sponsor.as_ref() } - fn ctoken_rent_sponsor(&self) -> Option<&AccountInfo<'info>> { + fn token_rent_sponsor(&self) -> Option<&AccountInfo<'info>> { self.ctoken_rent_sponsor.as_ref() } - fn ctoken_program(&self) -> Option<&AccountInfo<'info>> { + fn token_program(&self) -> Option<&AccountInfo<'info>> { self.ctoken_program.as_ref() } - fn ctoken_cpi_authority(&self) -> Option<&AccountInfo<'info>> { + fn token_cpi_authority(&self) -> Option<&AccountInfo<'info>> { self.ctoken_cpi_authority.as_ref() } - fn ctoken_config(&self) -> Option<&AccountInfo<'info>> { + fn token_config(&self) -> Option<&AccountInfo<'info>> { self.ctoken_config.as_ref() } @@ -168,31 +168,31 @@ impl<'info> light_sdk::compressible::DecompressContext<'info> &self, _remaining_accounts: &[AccountInfo<'info>], _fee_payer: &AccountInfo<'info>, - _ctoken_program: &AccountInfo<'info>, - _ctoken_rent_sponsor: &AccountInfo<'info>, - _ctoken_cpi_authority: &AccountInfo<'info>, - _ctoken_config: &AccountInfo<'info>, + _token_program: &AccountInfo<'info>, + _token_rent_sponsor: &AccountInfo<'info>, + _token_cpi_authority: &AccountInfo<'info>, + _token_config: &AccountInfo<'info>, _config: &AccountInfo<'info>, - ctoken_accounts: Vec<(Self::PackedTokenData, Self::CompressedMeta)>, + token_accounts: Vec<(Self::PackedTokenData, Self::CompressedMeta)>, proof: light_sdk::instruction::ValidityProof, cpi_accounts: &CpiAccounts<'b, 'info>, post_system_accounts: &[AccountInfo<'info>], has_pdas: bool, ) -> std::result::Result<(), ProgramError> { - if ctoken_accounts.is_empty() { + if token_accounts.is_empty() { return Ok(()); } - light_ctoken_sdk::compressible::process_decompress_tokens_runtime::( + light_token_sdk::compressible::process_decompress_tokens_runtime::( self, _remaining_accounts, _fee_payer, - _ctoken_program, - _ctoken_rent_sponsor, - _ctoken_cpi_authority, - _ctoken_config, + _token_program, + _token_rent_sponsor, + _token_cpi_authority, + _token_config, _config, - ctoken_accounts, + token_accounts, proof, cpi_accounts, post_system_accounts, diff --git a/sdk-tests/csdk-anchor-derived-test/src/state.rs b/sdk-tests/csdk-anchor-derived-test/src/state.rs index 55bd424236..262667ff61 100644 --- a/sdk-tests/csdk-anchor-derived-test/src/state.rs +++ b/sdk-tests/csdk-anchor-derived-test/src/state.rs @@ -1,11 +1,11 @@ use anchor_lang::prelude::*; -use light_token_interface::instructions::mint_action::CompressedMintWithContext; use light_sdk::{ compressible::CompressionInfo, instruction::{PackedAddressTreeInfo, ValidityProof}, LightDiscriminator, LightHasher, }; use light_sdk_macros::{Compressible, CompressiblePack}; +use light_token_interface::instructions::mint_action::CompressedMintWithContext; #[derive( Default, Debug, LightHasher, LightDiscriminator, InitSpace, Compressible, CompressiblePack, diff --git a/sdk-tests/csdk-anchor-derived-test/src/variant.rs b/sdk-tests/csdk-anchor-derived-test/src/variant.rs index def6e91c4a..4dada3bd76 100644 --- a/sdk-tests/csdk-anchor-derived-test/src/variant.rs +++ b/sdk-tests/csdk-anchor-derived-test/src/variant.rs @@ -1,14 +1,14 @@ use anchor_lang::prelude::*; -use light_ctoken_sdk::{ - compat::{CTokenData, PackedCTokenData}, - pack::Pack as TokenPack, -}; use light_sdk::{ account::Size, compressible::{CompressionInfo, HasCompressionInfo, Pack as SdkPack, Unpack as SdkUnpack}, instruction::{account_meta::CompressedAccountMetaNoLamportsNoAddress, PackedAccounts}, LightDiscriminator, }; +use light_token_sdk::{ + compat::{CTokenData, PackedCTokenData}, + pack::Pack as TokenPack, +}; use crate::{ instruction_accounts::DecompressAccountsIdempotent, @@ -25,7 +25,7 @@ pub enum CTokenAccountVariant { CTokenSigner = 0, } -impl light_ctoken_sdk::compressible::CTokenSeedProvider for CTokenAccountVariant { +impl light_token_sdk::compressible::TokenSeedProvider for CTokenAccountVariant { type Accounts<'info> = DecompressAccountsIdempotent<'info>; fn get_seeds<'a, 'info>( diff --git a/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs b/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs index b23eb516c4..cb6d9931ed 100644 --- a/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs +++ b/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs @@ -1,15 +1,7 @@ use anchor_lang::{AccountDeserialize, AnchorDeserialize, InstructionData, ToAccountMetas}; use csdk_anchor_derived_test::{AccountCreationData, CompressionParams, GameSession, UserRecord}; use light_compressed_account::address::derive_address; -use light_token_interface::{ - instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, - state::CompressedMintMetadata, -}; -use light_ctoken_sdk::compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, -}; use light_macros::pubkey; -use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{ program_test::{ initialize_compression_config, setup_mock_program_data, LightProgramTest, TestRpc, @@ -20,7 +12,15 @@ use light_sdk::{ compressible::CompressibleConfig, instruction::{PackedAccounts, SystemAccountMetaConfig}, }; -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; +use light_token_interface::{ + instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, + state::CompressedMintMetadata, +}; +use light_token_sdk::compressed_token::create_compressed_mint::{ + derive_cmint_compressed_address, find_cmint_address, +}; +use light_token_types::CPI_AUTHORITY_PDA; use solana_instruction::Instruction; use solana_keypair::Keypair; use solana_pubkey::Pubkey; @@ -582,7 +582,7 @@ pub async fn create_user_record_and_game_session( user_record: *user_record_pda, game_session: *game_session_pda, mint_signer: mint_signer.pubkey(), - ctoken_program: C_TOKEN_PROGRAM_ID.into(), + ctoken_program: LIGHT_TOKEN_PROGRAM_ID.into(), system_program: solana_sdk::system_program::ID, config: *config_pda, rent_sponsor: RENT_SPONSOR, diff --git a/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml b/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml index 6d52a19730..1e92999796 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml +++ b/sdk-tests/csdk-anchor-full-derived-test/Cargo.toml @@ -32,7 +32,7 @@ light-compressed-account = { workspace = true, features = ["solana"] } anchor-lang = { workspace = true, features = ["idl-build"] } anchor-spl = { version = "=0.31.1", git = "https://github.com/lightprotocol/anchor", rev = "d8a2b3d9", features = ["memo", "metadata", "idl-build"] } light-token-interface = { workspace = true, features = ["anchor"] } -light-ctoken-sdk = { workspace = true, features = ["anchor", "compressible"] } +light-token-sdk = { workspace = true, features = ["anchor", "compressible"] } light-token-types = { workspace = true, features = ["anchor"] } light-compressible = { workspace = true, features = ["anchor"] } diff --git a/sdk-tests/csdk-anchor-full-derived-test/src/instruction_accounts.rs b/sdk-tests/csdk-anchor-full-derived-test/src/instruction_accounts.rs index adb38a181d..1e1db1be0d 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/src/instruction_accounts.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/src/instruction_accounts.rs @@ -29,7 +29,7 @@ pub struct CreateUserRecordAndGameSession<'info> { #[account( init, payer = user, - // Space: discriminator(8) + session_id(8) + player(32) + game_type_len(4) + + // Space: discriminator(8) + session_id(8) + player(32) + game_type_len(4) + // game_type(32) + start_time(8) + end_time(1+8) + score(8) = 109 bytes space = 8 + 8 + 32 + 4 + 32 + 8 + 9 + 8, seeds = [ @@ -52,7 +52,7 @@ pub struct CreateUserRecordAndGameSession<'info> { pub some_account: AccountInfo<'info>, /// Compressed token program - /// CHECK: Program ID validated using C_TOKEN_PROGRAM_ID constant + /// CHECK: Program ID validated using LIGHT_TOKEN_PROGRAM_ID constant pub ctoken_program: UncheckedAccount<'info>, /// CHECK: CPI authority of the compressed token program diff --git a/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs b/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs index 5a71217af0..6dbb478bb2 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs @@ -62,12 +62,6 @@ pub mod csdk_anchor_full_derived_test { #![allow(clippy::too_many_arguments)] use anchor_lang::solana_program::{program::invoke, sysvar::clock::Clock}; use light_compressed_account::instruction_data::traits::LightInstructionData; - use light_token_interface::instructions::mint_action::{ - MintActionCompressedInstructionData, MintToCompressedAction, Recipient, - }; - use light_ctoken_sdk::compressed_token::{ - create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, - }; use light_sdk::{ compressible::{ compress_account_on_init::prepare_compressed_account_on_init, CompressibleConfig, @@ -80,6 +74,12 @@ pub mod csdk_anchor_full_derived_test { use light_sdk_types::{ cpi_accounts::CpiAccountsConfig, cpi_context_write::CpiContextWriteAccounts, }; + use light_token_interface::instructions::mint_action::{ + MintActionCompressedInstructionData, MintToCompressedAction, Recipient, + }; + use light_token_sdk::compressed_token::{ + create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, + }; use super::*; use crate::{ diff --git a/sdk-tests/csdk-anchor-full-derived-test/src/state.rs b/sdk-tests/csdk-anchor-full-derived-test/src/state.rs index 208f94e014..27ce2224eb 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/src/state.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/src/state.rs @@ -1,11 +1,11 @@ use anchor_lang::prelude::*; -use light_token_interface::instructions::mint_action::CompressedMintWithContext; use light_sdk::{ compressible::CompressionInfo, instruction::{PackedAddressTreeInfo, ValidityProof}, LightDiscriminator, LightHasher, }; use light_sdk_macros::{Compressible, CompressiblePack}; +use light_token_interface::instructions::mint_action::CompressedMintWithContext; #[derive( Default, Debug, LightHasher, LightDiscriminator, InitSpace, Compressible, CompressiblePack, diff --git a/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs b/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs index 84f2c85307..0f1fb3623c 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs @@ -3,15 +3,7 @@ use csdk_anchor_full_derived_test::{ AccountCreationData, CompressionParams, GameSession, UserRecord, }; use light_compressed_account::address::derive_address; -use light_token_interface::{ - instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, - state::CompressedMintMetadata, -}; -use light_ctoken_sdk::compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, -}; use light_macros::pubkey; -use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{ program_test::{setup_mock_program_data, LightProgramTest}, AddressWithTree, Indexer, ProgramTestConfig, Rpc, @@ -20,7 +12,15 @@ use light_sdk::{ compressible::CompressibleConfig, instruction::{PackedAccounts, SystemAccountMetaConfig}, }; -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; +use light_token_interface::{ + instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, + state::CompressedMintMetadata, +}; +use light_token_sdk::compressed_token::create_compressed_mint::{ + derive_cmint_compressed_address, find_cmint_address, +}; +use light_token_types::CPI_AUTHORITY_PDA; use solana_instruction::Instruction; use solana_keypair::Keypair; use solana_pubkey::Pubkey; @@ -237,7 +237,7 @@ pub async fn create_user_record_and_game_session( authority: authority.pubkey(), mint_authority, some_account: some_account.pubkey(), - ctoken_program: C_TOKEN_PROGRAM_ID.into(), + ctoken_program: LIGHT_TOKEN_PROGRAM_ID.into(), compress_token_program_cpi_authority: CPI_AUTHORITY_PDA.into(), system_program: solana_sdk::system_program::ID, config: *config_pda, diff --git a/sdk-tests/sdk-compressible-test/Cargo.toml b/sdk-tests/sdk-compressible-test/Cargo.toml index 90c226e057..ccb30f3186 100644 --- a/sdk-tests/sdk-compressible-test/Cargo.toml +++ b/sdk-tests/sdk-compressible-test/Cargo.toml @@ -29,7 +29,7 @@ light-compressed-account = { workspace = true, features = ["solana"] } anchor-lang = { workspace = true, features = ["idl-build"] } anchor-spl = { version = "=0.31.1", git = "https://github.com/lightprotocol/anchor", rev = "d8a2b3d9", features = ["memo", "metadata", "idl-build"] } light-token-interface = { workspace = true, features = ["anchor"] } -light-ctoken-sdk = { workspace = true, features = ["anchor", "compressible"] } +light-token-sdk = { workspace = true, features = ["anchor", "compressible"] } light-token-types = { workspace = true, features = ["anchor"] } light-compressible = { workspace = true, features = ["anchor"] } diff --git a/sdk-tests/sdk-compressible-test/src/instruction_accounts.rs b/sdk-tests/sdk-compressible-test/src/instruction_accounts.rs index 32ab36f246..aaa5492cbb 100644 --- a/sdk-tests/sdk-compressible-test/src/instruction_accounts.rs +++ b/sdk-tests/sdk-compressible-test/src/instruction_accounts.rs @@ -92,7 +92,7 @@ pub struct CreateUserRecordAndGameSession<'info> { pub mint_authority: Signer<'info>, /// Compressed token program - /// CHECK: Program ID validated using C_TOKEN_PROGRAM_ID constant + /// CHECK: Program ID validated using LIGHT_TOKEN_PROGRAM_ID constant pub ctoken_program: UncheckedAccount<'info>, /// CHECK: CPI authority of the compressed token program diff --git a/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs b/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs index c182369f35..846103eab3 100644 --- a/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs +++ b/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs @@ -3,10 +3,6 @@ use anchor_lang::{ solana_program::{instruction::Instruction, program::invoke, sysvar::clock::Clock}, }; use light_compressed_account::instruction_data::traits::LightInstructionData; -use light_token_interface::instructions::mint_action::{MintToCompressedAction, Recipient}; -use light_ctoken_sdk::compressed_token::{ - create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, -}; use light_sdk::{ compressible::{ compress_account_on_init::prepare_compressed_account_on_init, CompressibleConfig, @@ -19,6 +15,10 @@ use light_sdk::{ use light_sdk_types::{ cpi_accounts::CpiAccountsConfig, cpi_context_write::CpiContextWriteAccounts, }; +use light_token_interface::instructions::mint_action::{MintToCompressedAction, Recipient}; +use light_token_sdk::compressed_token::{ + create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, +}; use crate::{errors::ErrorCode, instruction_accounts::*, seeds::*, state::*, LIGHT_CPI_SIGNER}; pub fn create_user_record_and_game_session<'info>( diff --git a/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs b/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs index 33106f6ccb..c9fa12ac27 100644 --- a/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs +++ b/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs @@ -1,6 +1,5 @@ // Auto-generated by compressible_instructions macro. use anchor_lang::prelude::*; -use light_ctoken_sdk::ctoken::{CompressibleParamsCpi, CreateCTokenAccountCpi}; use light_sdk::{ compressible::{ decompress_idempotent::{ @@ -14,6 +13,7 @@ use light_sdk::{ }, }; use light_sdk_types::cpi_accounts::CpiAccountsConfig; +use light_token_sdk::token::{CompressibleParamsCpi, CreateTokenAccountCpi}; use solana_program::program_error::ProgramError; use crate::{constants::*, errors::ErrorCode, instruction_accounts::*, state::*, LIGHT_CPI_SIGNER}; @@ -157,7 +157,7 @@ pub fn decompress_accounts_idempotent<'info>( ctoken_config: &anchor_lang::prelude::AccountInfo<'info>, config: &anchor_lang::prelude::AccountInfo<'info>, ctoken_accounts: Vec<( - light_ctoken_sdk::compat::PackedCTokenData, + light_token_sdk::compat::PackedCTokenData, light_sdk::instruction::account_meta::CompressedAccountMetaNoLamportsNoAddress, )>, proof: light_sdk::instruction::ValidityProof, @@ -166,7 +166,7 @@ pub fn decompress_accounts_idempotent<'info>( has_pdas: bool, ) -> Result<()> { let mut token_decompress_indices: Box< - Vec, + Vec, > = Box::new(Vec::with_capacity(ctoken_accounts.len())); // Collect per-owner signer seed groups; invoke_signed requires one seed group per PDA signer let mut token_signers_seed_groups: Vec>> = @@ -223,7 +223,7 @@ pub fn decompress_accounts_idempotent<'info>( seeds: seeds_without_bump, }; - CreateCTokenAccountCpi { + CreateTokenAccountCpi { payer: fee_payer.clone().to_account_info(), account: owner_info.clone(), mint: mint_info.clone(), @@ -256,7 +256,7 @@ pub fn decompress_accounts_idempotent<'info>( root_index: meta.tree_info.root_index, }; let decompress_index = - light_ctoken_sdk::compressed_token::decompress_full::DecompressFullIndices { + light_token_sdk::compressed_token::decompress_full::DecompressFullIndices { source, destination_index: owner_index, tlv: None, @@ -266,7 +266,7 @@ pub fn decompress_accounts_idempotent<'info>( } let ctoken_ix = - light_ctoken_sdk::compressed_token::decompress_full::decompress_full_ctoken_accounts_with_indices( + light_token_sdk::compressed_token::decompress_full::decompress_full_ctoken_accounts_with_indices( fee_payer.key(), proof, if has_pdas { @@ -323,7 +323,7 @@ pub fn decompress_accounts_idempotent<'info>( } let mut ctoken_accounts: Vec<( - light_ctoken_sdk::compat::PackedCTokenData, + light_token_sdk::compat::PackedCTokenData, light_sdk::instruction::account_meta::CompressedAccountMetaNoLamportsNoAddress, )> = Vec::with_capacity(token_count); let mut compressed_pda_infos = Vec::with_capacity(pda_count); diff --git a/sdk-tests/sdk-compressible-test/src/state.rs b/sdk-tests/sdk-compressible-test/src/state.rs index 18907a0f0e..3cca9dc377 100644 --- a/sdk-tests/sdk-compressible-test/src/state.rs +++ b/sdk-tests/sdk-compressible-test/src/state.rs @@ -3,8 +3,6 @@ // hasCompressionInfo implementions. use anchor_lang::prelude::*; -use light_token_interface::instructions::mint_action::CompressedMintWithContext; -use light_ctoken_sdk::pack::Pack as _TokenPack; use light_sdk::{ account::Size, compressible::{ @@ -17,6 +15,8 @@ use light_sdk::{ }, LightDiscriminator, LightHasher, }; +use light_token_interface::instructions::mint_action::CompressedMintWithContext; +use light_token_sdk::pack::Pack as _TokenPack; #[derive(AnchorSerialize, AnchorDeserialize, Debug, Clone, Copy)] #[repr(u8)] @@ -36,8 +36,8 @@ pub enum CompressedAccountVariant { PackedGameSession(PackedGameSession), PlaceholderRecord(PlaceholderRecord), PackedPlaceholderRecord(PackedPlaceholderRecord), - PackedCTokenData(light_ctoken_sdk::compat::PackedCTokenData), - CTokenData(light_ctoken_sdk::compat::CTokenData), + PackedCTokenData(light_token_sdk::compat::PackedCTokenData), + CTokenData(light_token_sdk::compat::CTokenData), } impl Default for CompressedAccountVariant { diff --git a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs index 00ef05c74c..11caa17f23 100644 --- a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs +++ b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs @@ -4,11 +4,22 @@ use anchor_lang::{ use light_client::indexer::CompressedAccount; use light_compressed_account::address::derive_address; use light_compressible_client::compressible_instruction; +use light_program_test::{ + program_test::{ + initialize_compression_config, setup_mock_program_data, LightProgramTest, TestRpc, + }, + AddressWithTree, Indexer, ProgramTestConfig, Rpc, +}; +use light_sdk::{ + compressible::CompressibleConfig, + instruction::{PackedAccounts, SystemAccountMetaConfig}, +}; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use light_token_interface::{ instructions::mint_action::{CompressedMintInstructionData, CompressedMintWithContext}, state::CompressedMintMetadata, }; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }, @@ -16,17 +27,6 @@ use light_ctoken_sdk::{ pack::compat::CTokenDataWithVariant, }; use light_token_types::CPI_AUTHORITY_PDA; -use light_program_test::{ - program_test::{ - initialize_compression_config, setup_mock_program_data, LightProgramTest, TestRpc, - }, - AddressWithTree, Indexer, ProgramTestConfig, Rpc, -}; -use light_sdk::{ - compressible::CompressibleConfig, - instruction::{PackedAccounts, SystemAccountMetaConfig}, -}; -use light_sdk_types::C_TOKEN_PROGRAM_ID; use sdk_compressible_test::{ get_ctoken_signer2_seeds, get_ctoken_signer3_seeds, get_ctoken_signer4_seeds, get_ctoken_signer5_seeds, get_ctoken_signer_seeds, CTokenAccountVariant, @@ -246,7 +246,7 @@ pub async fn create_user_record_and_game_session( user_record: *user_record_pda, game_session: *game_session_pda, mint_signer: mint_signer.pubkey(), - ctoken_program: C_TOKEN_PROGRAM_ID.into(), + ctoken_program: LIGHT_TOKEN_PROGRAM_ID.into(), system_program: solana_sdk::system_program::ID, config: *config_pda, rent_sponsor: RENT_SPONSOR, @@ -740,7 +740,7 @@ pub async fn decompress_multiple_pdas_with_ctoken( !token_account_data.data.is_empty(), "Token account should have data" ); - assert_eq!(token_account_data.owner, C_TOKEN_PROGRAM_ID.into()); + assert_eq!(token_account_data.owner, LIGHT_TOKEN_PROGRAM_ID.into()); let compressed_user_record_data = rpc .get_compressed_account(c_user_pda.clone().address.unwrap(), None) diff --git a/sdk-tests/sdk-ctoken-test/Cargo.lock b/sdk-tests/sdk-light-token-test/Cargo.lock similarity index 100% rename from sdk-tests/sdk-ctoken-test/Cargo.lock rename to sdk-tests/sdk-light-token-test/Cargo.lock diff --git a/sdk-tests/sdk-ctoken-test/Cargo.toml b/sdk-tests/sdk-light-token-test/Cargo.toml similarity index 95% rename from sdk-tests/sdk-ctoken-test/Cargo.toml rename to sdk-tests/sdk-light-token-test/Cargo.toml index c95c416f33..0045b4f480 100644 --- a/sdk-tests/sdk-ctoken-test/Cargo.toml +++ b/sdk-tests/sdk-light-token-test/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "sdk-ctoken-test" +name = "sdk-light-token-test" version = "0.1.0" description = "Native Solana program demonstrating compressed token operations" edition = "2021" @@ -17,7 +17,7 @@ default = [] [dependencies] # Light Protocol SDK dependencies (workspace-based) -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } light-token-types = { workspace = true } light-token-interface = { workspace = true } light-sdk = { workspace = true, features = ["v2"] } diff --git a/sdk-tests/sdk-ctoken-test/README.md b/sdk-tests/sdk-light-token-test/README.md similarity index 100% rename from sdk-tests/sdk-ctoken-test/README.md rename to sdk-tests/sdk-light-token-test/README.md diff --git a/sdk-tests/sdk-ctoken-test/Xargo.toml b/sdk-tests/sdk-light-token-test/Xargo.toml similarity index 100% rename from sdk-tests/sdk-ctoken-test/Xargo.toml rename to sdk-tests/sdk-light-token-test/Xargo.toml diff --git a/sdk-tests/sdk-ctoken-test/src/approve.rs b/sdk-tests/sdk-light-token-test/src/approve.rs similarity index 95% rename from sdk-tests/sdk-ctoken-test/src/approve.rs rename to sdk-tests/sdk-light-token-test/src/approve.rs index fa0c875155..9cfb809ec8 100644 --- a/sdk-tests/sdk-ctoken-test/src/approve.rs +++ b/sdk-tests/sdk-light-token-test/src/approve.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::ctoken::ApproveCTokenCpi; +use light_token_sdk::token::ApproveTokenCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -26,7 +26,7 @@ pub fn process_approve_invoke( return Err(ProgramError::NotEnoughAccountKeys); } - ApproveCTokenCpi { + ApproveTokenCpi { token_account: accounts[0].clone(), delegate: accounts[1].clone(), owner: accounts[2].clone(), @@ -63,7 +63,7 @@ pub fn process_approve_invoke_signed( } let signer_seeds: &[&[u8]] = &[TOKEN_ACCOUNT_SEED, &[bump]]; - ApproveCTokenCpi { + ApproveTokenCpi { token_account: accounts[0].clone(), delegate: accounts[1].clone(), owner: accounts[2].clone(), diff --git a/sdk-tests/sdk-ctoken-test/src/burn.rs b/sdk-tests/sdk-light-token-test/src/burn.rs similarity index 95% rename from sdk-tests/sdk-ctoken-test/src/burn.rs rename to sdk-tests/sdk-light-token-test/src/burn.rs index 8f223054ec..9fda3ea2f3 100644 --- a/sdk-tests/sdk-ctoken-test/src/burn.rs +++ b/sdk-tests/sdk-light-token-test/src/burn.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::ctoken::BurnCTokenCpi; +use light_token_sdk::token::BurnTokenCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -22,7 +22,7 @@ pub fn process_burn_invoke(accounts: &[AccountInfo], amount: u64) -> Result<(), return Err(ProgramError::NotEnoughAccountKeys); } - BurnCTokenCpi { + BurnTokenCpi { source: accounts[0].clone(), cmint: accounts[1].clone(), amount, @@ -58,7 +58,7 @@ pub fn process_burn_invoke_signed( } let signer_seeds: &[&[u8]] = &[TOKEN_ACCOUNT_SEED, &[bump]]; - BurnCTokenCpi { + BurnTokenCpi { source: accounts[0].clone(), cmint: accounts[1].clone(), amount, diff --git a/sdk-tests/sdk-ctoken-test/src/close.rs b/sdk-tests/sdk-light-token-test/src/close.rs similarity index 94% rename from sdk-tests/sdk-ctoken-test/src/close.rs rename to sdk-tests/sdk-light-token-test/src/close.rs index 6fc9889508..c6e0ef2c2c 100644 --- a/sdk-tests/sdk-ctoken-test/src/close.rs +++ b/sdk-tests/sdk-light-token-test/src/close.rs @@ -1,4 +1,4 @@ -use light_ctoken_sdk::ctoken::CloseCTokenAccountCpi; +use light_token_sdk::token::CloseTokenAccountCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -16,7 +16,7 @@ pub fn process_close_account_invoke(accounts: &[AccountInfo]) -> Result<(), Prog return Err(ProgramError::NotEnoughAccountKeys); } - CloseCTokenAccountCpi { + CloseTokenAccountCpi { token_program: accounts[0].clone(), account: accounts[1].clone(), destination: accounts[2].clone(), @@ -50,7 +50,7 @@ pub fn process_close_account_invoke_signed(accounts: &[AccountInfo]) -> Result<( } let signer_seeds: &[&[u8]] = &[TOKEN_ACCOUNT_SEED, &[bump]]; - CloseCTokenAccountCpi { + CloseTokenAccountCpi { token_program: accounts[0].clone(), account: accounts[1].clone(), destination: accounts[2].clone(), diff --git a/sdk-tests/sdk-ctoken-test/src/create_ata.rs b/sdk-tests/sdk-light-token-test/src/create_ata.rs similarity index 94% rename from sdk-tests/sdk-ctoken-test/src/create_ata.rs rename to sdk-tests/sdk-light-token-test/src/create_ata.rs index 5ea9f4d307..02986c9257 100644 --- a/sdk-tests/sdk-ctoken-test/src/create_ata.rs +++ b/sdk-tests/sdk-light-token-test/src/create_ata.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::ctoken::{CompressibleParamsCpi, CreateAssociatedCTokenAccountCpi}; +use light_token_sdk::token::{CompressibleParamsCpi, CreateAssociatedTokenAccountCpi}; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ATA_SEED, ID}; @@ -38,7 +38,7 @@ pub fn process_create_ata_invoke( ); // Use the CreateAssociatedCTokenAccountCpi - owner and mint are AccountInfos - CreateAssociatedCTokenAccountCpi { + CreateAssociatedTokenAccountCpi { owner: accounts[0].clone(), mint: accounts[1].clone(), payer: accounts[2].clone(), @@ -87,7 +87,7 @@ pub fn process_create_ata_invoke_signed( ); // Use the CreateAssociatedCTokenAccountCpi - owner and mint are AccountInfos - let account_infos = CreateAssociatedCTokenAccountCpi { + let account_infos = CreateAssociatedTokenAccountCpi { owner: accounts[0].clone(), mint: accounts[1].clone(), payer: accounts[2].clone(), diff --git a/sdk-tests/sdk-ctoken-test/src/create_cmint.rs b/sdk-tests/sdk-light-token-test/src/create_cmint.rs similarity index 99% rename from sdk-tests/sdk-ctoken-test/src/create_cmint.rs rename to sdk-tests/sdk-light-token-test/src/create_cmint.rs index 419e9776e3..a0206994ba 100644 --- a/sdk-tests/sdk-ctoken-test/src/create_cmint.rs +++ b/sdk-tests/sdk-light-token-test/src/create_cmint.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::{ +use light_token_sdk::{ ctoken::{CreateCMintCpi, CreateCMintParams, ExtensionInstructionData, SystemAccountInfos}, CompressedProof, }; diff --git a/sdk-tests/sdk-ctoken-test/src/create_token_account.rs b/sdk-tests/sdk-light-token-test/src/create_token_account.rs similarity index 95% rename from sdk-tests/sdk-ctoken-test/src/create_token_account.rs rename to sdk-tests/sdk-light-token-test/src/create_token_account.rs index 14803a89bc..0325d6aa2f 100644 --- a/sdk-tests/sdk-ctoken-test/src/create_token_account.rs +++ b/sdk-tests/sdk-light-token-test/src/create_token_account.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::ctoken::{CompressibleParamsCpi, CreateCTokenAccountCpi}; +use light_token_sdk::token::{CompressibleParamsCpi, CreateTokenAccountCpi}; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -41,7 +41,7 @@ pub fn process_create_token_account_invoke( ); // Build the account infos struct - CreateCTokenAccountCpi { + CreateTokenAccountCpi { payer: accounts[0].clone(), account: accounts[1].clone(), mint: accounts[2].clone(), @@ -86,7 +86,7 @@ pub fn process_create_token_account_invoke_signed( ); // Build the account infos struct - let account_infos = CreateCTokenAccountCpi { + let account_infos = CreateTokenAccountCpi { payer: accounts[0].clone(), account: accounts[1].clone(), mint: accounts[2].clone(), diff --git a/sdk-tests/sdk-ctoken-test/src/ctoken_mint_to.rs b/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs similarity index 96% rename from sdk-tests/sdk-ctoken-test/src/ctoken_mint_to.rs rename to sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs index 181246baa9..e744dddeb9 100644 --- a/sdk-tests/sdk-ctoken-test/src/ctoken_mint_to.rs +++ b/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::ctoken::CTokenMintToCpi; +use light_token_sdk::token::TokenMintToCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{mint_to_ctoken::MINT_AUTHORITY_SEED, ID}; @@ -26,7 +26,7 @@ pub fn process_ctoken_mint_to_invoke( return Err(ProgramError::NotEnoughAccountKeys); } - CTokenMintToCpi { + TokenMintToCpi { cmint: accounts[0].clone(), destination: accounts[1].clone(), amount, @@ -64,7 +64,7 @@ pub fn process_ctoken_mint_to_invoke_signed( } let signer_seeds: &[&[u8]] = &[MINT_AUTHORITY_SEED, &[bump]]; - CTokenMintToCpi { + TokenMintToCpi { cmint: accounts[0].clone(), destination: accounts[1].clone(), amount, diff --git a/sdk-tests/sdk-ctoken-test/src/decompress_cmint.rs b/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs similarity index 99% rename from sdk-tests/sdk-ctoken-test/src/decompress_cmint.rs rename to sdk-tests/sdk-light-token-test/src/decompress_cmint.rs index 7e30460fec..01b5eda601 100644 --- a/sdk-tests/sdk-ctoken-test/src/decompress_cmint.rs +++ b/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::{ +use light_token_sdk::{ ctoken::{CompressedMintWithContext, DecompressCMintCpi, SystemAccountInfos}, ValidityProof, }; diff --git a/sdk-tests/sdk-ctoken-test/src/freeze.rs b/sdk-tests/sdk-light-token-test/src/freeze.rs similarity index 94% rename from sdk-tests/sdk-ctoken-test/src/freeze.rs rename to sdk-tests/sdk-light-token-test/src/freeze.rs index f65a36f17a..e389a0b7f9 100644 --- a/sdk-tests/sdk-ctoken-test/src/freeze.rs +++ b/sdk-tests/sdk-light-token-test/src/freeze.rs @@ -1,4 +1,4 @@ -use light_ctoken_sdk::ctoken::FreezeCTokenCpi; +use light_token_sdk::token::FreezeTokenCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{FREEZE_AUTHORITY_SEED, ID}; @@ -15,7 +15,7 @@ pub fn process_freeze_invoke(accounts: &[AccountInfo]) -> Result<(), ProgramErro return Err(ProgramError::NotEnoughAccountKeys); } - FreezeCTokenCpi { + FreezeTokenCpi { token_account: accounts[0].clone(), mint: accounts[1].clone(), freeze_authority: accounts[2].clone(), @@ -46,7 +46,7 @@ pub fn process_freeze_invoke_signed(accounts: &[AccountInfo]) -> Result<(), Prog } let signer_seeds: &[&[u8]] = &[FREEZE_AUTHORITY_SEED, &[bump]]; - FreezeCTokenCpi { + FreezeTokenCpi { token_account: accounts[0].clone(), mint: accounts[1].clone(), freeze_authority: accounts[2].clone(), diff --git a/sdk-tests/sdk-ctoken-test/src/lib.rs b/sdk-tests/sdk-light-token-test/src/lib.rs similarity index 98% rename from sdk-tests/sdk-ctoken-test/src/lib.rs rename to sdk-tests/sdk-light-token-test/src/lib.rs index e23638b2cd..1faec24a2e 100644 --- a/sdk-tests/sdk-ctoken-test/src/lib.rs +++ b/sdk-tests/sdk-light-token-test/src/lib.rs @@ -54,8 +54,8 @@ pub use transfer_interface::{ }; pub use transfer_spl_ctoken::{ process_ctoken_to_spl_invoke, process_ctoken_to_spl_invoke_signed, - process_spl_to_ctoken_invoke, process_spl_to_ctoken_invoke_signed, TransferCTokenToSplData, - TransferSplToCtokenData, TRANSFER_AUTHORITY_SEED, + process_spl_to_ctoken_invoke, process_spl_to_ctoken_invoke_signed, TransferSplToTokenData, + TransferTokenToSplData, TRANSFER_AUTHORITY_SEED, }; /// Program ID - replace with actual program ID after deployment @@ -269,22 +269,22 @@ pub fn process_instruction( process_create_cmint_with_pda_authority(accounts, data) } InstructionType::SplToCtokenInvoke => { - let data = TransferSplToCtokenData::try_from_slice(&instruction_data[1..]) + let data = TransferSplToTokenData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; process_spl_to_ctoken_invoke(accounts, data) } InstructionType::SplToCtokenInvokeSigned => { - let data = TransferSplToCtokenData::try_from_slice(&instruction_data[1..]) + let data = TransferSplToTokenData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; process_spl_to_ctoken_invoke_signed(accounts, data) } InstructionType::CtokenToSplInvoke => { - let data = TransferCTokenToSplData::try_from_slice(&instruction_data[1..]) + let data = TransferTokenToSplData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; process_ctoken_to_spl_invoke(accounts, data) } InstructionType::CtokenToSplInvokeSigned => { - let data = TransferCTokenToSplData::try_from_slice(&instruction_data[1..]) + let data = TransferTokenToSplData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; process_ctoken_to_spl_invoke_signed(accounts, data) } diff --git a/sdk-tests/sdk-ctoken-test/src/mint_to_ctoken.rs b/sdk-tests/sdk-light-token-test/src/mint_to_ctoken.rs similarity index 96% rename from sdk-tests/sdk-ctoken-test/src/mint_to_ctoken.rs rename to sdk-tests/sdk-light-token-test/src/mint_to_ctoken.rs index 770f7f1c1a..03f5486b62 100644 --- a/sdk-tests/sdk-ctoken-test/src/mint_to_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/src/mint_to_ctoken.rs @@ -1,7 +1,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_token_interface::instructions::mint_action::CompressedMintWithContext; -use light_ctoken_sdk::ctoken::{MintToCTokenCpi, MintToCTokenParams, SystemAccountInfos}; use light_sdk::instruction::ValidityProof; +use light_token_interface::instructions::mint_action::CompressedMintWithContext; +use light_token_sdk::token::{MintToTokenCpi, MintToTokenParams, SystemAccountInfos}; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::ID; @@ -48,7 +48,7 @@ pub fn process_mint_to_ctoken( } // Build params using the constructor - let params = MintToCTokenParams::new( + let params = MintToTokenParams::new( data.compressed_mint_inputs, data.amount, data.mint_authority, @@ -71,7 +71,7 @@ pub fn process_mint_to_ctoken( // Build the account infos struct and invoke // SDK account order: output_queue (9), tree (10), input_queue (11), ctoken_accounts (12+) // In this case, payer == authority (accounts[3]) - MintToCTokenCpi { + MintToTokenCpi { authority: accounts[2].clone(), // authority from SDK accounts payer: accounts[3].clone(), // fee_payer from SDK accounts state_tree: accounts[10].clone(), // tree at index 10 @@ -124,7 +124,7 @@ pub fn process_mint_to_ctoken_invoke_signed( } // Build params using the constructor - let params = MintToCTokenParams::new( + let params = MintToTokenParams::new( data.compressed_mint_inputs, data.amount, data.mint_authority, @@ -146,7 +146,7 @@ pub fn process_mint_to_ctoken_invoke_signed( // Build the account infos struct // authority is the PDA (accounts[2]) - let account_infos = MintToCTokenCpi { + let account_infos = MintToTokenCpi { authority: accounts[2].clone(), // authority PDA payer: accounts[3].clone(), // fee_payer from SDK accounts state_tree: accounts[10].clone(), // tree at index 10 diff --git a/sdk-tests/sdk-ctoken-test/src/revoke.rs b/sdk-tests/sdk-light-token-test/src/revoke.rs similarity index 94% rename from sdk-tests/sdk-ctoken-test/src/revoke.rs rename to sdk-tests/sdk-light-token-test/src/revoke.rs index e3cc641ac3..33afebc692 100644 --- a/sdk-tests/sdk-ctoken-test/src/revoke.rs +++ b/sdk-tests/sdk-light-token-test/src/revoke.rs @@ -1,4 +1,4 @@ -use light_ctoken_sdk::ctoken::RevokeCTokenCpi; +use light_token_sdk::token::RevokeTokenCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -15,7 +15,7 @@ pub fn process_revoke_invoke(accounts: &[AccountInfo]) -> Result<(), ProgramErro return Err(ProgramError::NotEnoughAccountKeys); } - RevokeCTokenCpi { + RevokeTokenCpi { token_account: accounts[0].clone(), owner: accounts[1].clone(), system_program: accounts[2].clone(), @@ -46,7 +46,7 @@ pub fn process_revoke_invoke_signed(accounts: &[AccountInfo]) -> Result<(), Prog } let signer_seeds: &[&[u8]] = &[TOKEN_ACCOUNT_SEED, &[bump]]; - RevokeCTokenCpi { + RevokeTokenCpi { token_account: accounts[0].clone(), owner: accounts[1].clone(), system_program: accounts[2].clone(), diff --git a/sdk-tests/sdk-ctoken-test/src/thaw.rs b/sdk-tests/sdk-light-token-test/src/thaw.rs similarity index 95% rename from sdk-tests/sdk-ctoken-test/src/thaw.rs rename to sdk-tests/sdk-light-token-test/src/thaw.rs index 7530f5f04c..f9c48a001b 100644 --- a/sdk-tests/sdk-ctoken-test/src/thaw.rs +++ b/sdk-tests/sdk-light-token-test/src/thaw.rs @@ -1,4 +1,4 @@ -use light_ctoken_sdk::ctoken::ThawCTokenCpi; +use light_token_sdk::token::ThawTokenCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{FREEZE_AUTHORITY_SEED, ID}; @@ -15,7 +15,7 @@ pub fn process_thaw_invoke(accounts: &[AccountInfo]) -> Result<(), ProgramError> return Err(ProgramError::NotEnoughAccountKeys); } - ThawCTokenCpi { + ThawTokenCpi { token_account: accounts[0].clone(), mint: accounts[1].clone(), freeze_authority: accounts[2].clone(), @@ -46,7 +46,7 @@ pub fn process_thaw_invoke_signed(accounts: &[AccountInfo]) -> Result<(), Progra } let signer_seeds: &[&[u8]] = &[FREEZE_AUTHORITY_SEED, &[bump]]; - ThawCTokenCpi { + ThawTokenCpi { token_account: accounts[0].clone(), mint: accounts[1].clone(), freeze_authority: accounts[2].clone(), diff --git a/sdk-tests/sdk-ctoken-test/src/transfer.rs b/sdk-tests/sdk-light-token-test/src/transfer.rs similarity index 95% rename from sdk-tests/sdk-ctoken-test/src/transfer.rs rename to sdk-tests/sdk-light-token-test/src/transfer.rs index 1e21cfa7bd..75d2b23b6b 100644 --- a/sdk-tests/sdk-ctoken-test/src/transfer.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::ctoken::TransferCTokenCpi; +use light_token_sdk::token::TransferTokenCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -29,7 +29,7 @@ pub fn process_transfer_invoke( } // Build the account infos struct using the builder pattern - TransferCTokenCpi { + TransferTokenCpi { source: accounts[0].clone(), destination: accounts[1].clone(), amount: data.amount, @@ -69,7 +69,7 @@ pub fn process_transfer_invoke_signed( } // Build the account infos struct - let transfer_accounts = TransferCTokenCpi { + let transfer_accounts = TransferTokenCpi { source: accounts[0].clone(), destination: accounts[1].clone(), amount: data.amount, diff --git a/sdk-tests/sdk-ctoken-test/src/transfer_checked.rs b/sdk-tests/sdk-light-token-test/src/transfer_checked.rs similarity index 94% rename from sdk-tests/sdk-ctoken-test/src/transfer_checked.rs rename to sdk-tests/sdk-light-token-test/src/transfer_checked.rs index 3cb7ec4f13..21a6b962e3 100644 --- a/sdk-tests/sdk-ctoken-test/src/transfer_checked.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer_checked.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::ctoken::TransferCTokenCheckedCpi; +use light_token_sdk::token::TransferTokenCheckedCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -26,7 +26,7 @@ pub fn process_transfer_checked_invoke( return Err(ProgramError::NotEnoughAccountKeys); } - TransferCTokenCheckedCpi { + TransferTokenCheckedCpi { source: accounts[0].clone(), mint: accounts[1].clone(), destination: accounts[2].clone(), @@ -63,7 +63,7 @@ pub fn process_transfer_checked_invoke_signed( return Err(ProgramError::InvalidSeeds); } - let transfer_accounts = TransferCTokenCheckedCpi { + let transfer_accounts = TransferTokenCheckedCpi { source: accounts[0].clone(), mint: accounts[1].clone(), destination: accounts[2].clone(), diff --git a/sdk-tests/sdk-ctoken-test/src/transfer_interface.rs b/sdk-tests/sdk-light-token-test/src/transfer_interface.rs similarity index 98% rename from sdk-tests/sdk-ctoken-test/src/transfer_interface.rs rename to sdk-tests/sdk-light-token-test/src/transfer_interface.rs index be518bf8c7..a1bb37e0bc 100644 --- a/sdk-tests/sdk-ctoken-test/src/transfer_interface.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer_interface.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::ctoken::TransferInterfaceCpi; +use light_token_sdk::token::TransferInterfaceCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::ID; diff --git a/sdk-tests/sdk-ctoken-test/src/transfer_spl_ctoken.rs b/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs similarity index 93% rename from sdk-tests/sdk-ctoken-test/src/transfer_spl_ctoken.rs rename to sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs index 265fefb5fc..0c4f7207e3 100644 --- a/sdk-tests/sdk-ctoken-test/src/transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_ctoken_sdk::ctoken::{TransferCTokenToSplCpi, TransferSplToCtokenCpi}; +use light_token_sdk::token::{TransferSplToTokenCpi, TransferTokenToSplCpi}; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::ID; @@ -9,7 +9,7 @@ pub const TRANSFER_AUTHORITY_SEED: &[u8] = b"transfer_authority"; /// Instruction data for SPL to CToken transfer #[derive(BorshSerialize, BorshDeserialize, Debug)] -pub struct TransferSplToCtokenData { +pub struct TransferSplToTokenData { pub amount: u64, pub spl_interface_pda_bump: u8, pub decimals: u8, @@ -17,7 +17,7 @@ pub struct TransferSplToCtokenData { /// Instruction data for CToken to SPL transfer #[derive(BorshSerialize, BorshDeserialize, Debug)] -pub struct TransferCTokenToSplData { +pub struct TransferTokenToSplData { pub amount: u64, pub spl_interface_pda_bump: u8, pub decimals: u8, @@ -38,13 +38,13 @@ pub struct TransferCTokenToSplData { /// - accounts[9]: system_program pub fn process_spl_to_ctoken_invoke( accounts: &[AccountInfo], - data: TransferSplToCtokenData, + data: TransferSplToTokenData, ) -> Result<(), ProgramError> { if accounts.len() < 10 { return Err(ProgramError::NotEnoughAccountKeys); } - TransferSplToCtokenCpi { + TransferSplToTokenCpi { source_spl_token_account: accounts[1].clone(), destination_ctoken_account: accounts[2].clone(), amount: data.amount, @@ -80,7 +80,7 @@ pub fn process_spl_to_ctoken_invoke( /// - accounts[9]: system_program pub fn process_spl_to_ctoken_invoke_signed( accounts: &[AccountInfo], - data: TransferSplToCtokenData, + data: TransferSplToTokenData, ) -> Result<(), ProgramError> { if accounts.len() < 10 { return Err(ProgramError::NotEnoughAccountKeys); @@ -95,7 +95,7 @@ pub fn process_spl_to_ctoken_invoke_signed( return Err(ProgramError::InvalidSeeds); } - let account_infos = TransferSplToCtokenCpi { + let account_infos = TransferSplToTokenCpi { source_spl_token_account: accounts[1].clone(), destination_ctoken_account: accounts[2].clone(), amount: data.amount, @@ -131,13 +131,13 @@ pub fn process_spl_to_ctoken_invoke_signed( /// - accounts[8]: compressed_token_program_authority pub fn process_ctoken_to_spl_invoke( accounts: &[AccountInfo], - data: TransferCTokenToSplData, + data: TransferTokenToSplData, ) -> Result<(), ProgramError> { if accounts.len() < 9 { return Err(ProgramError::NotEnoughAccountKeys); } - TransferCTokenToSplCpi { + TransferTokenToSplCpi { source_ctoken_account: accounts[1].clone(), destination_spl_token_account: accounts[2].clone(), amount: data.amount, @@ -171,7 +171,7 @@ pub fn process_ctoken_to_spl_invoke( /// - accounts[8]: compressed_token_program_authority pub fn process_ctoken_to_spl_invoke_signed( accounts: &[AccountInfo], - data: TransferCTokenToSplData, + data: TransferTokenToSplData, ) -> Result<(), ProgramError> { if accounts.len() < 9 { return Err(ProgramError::NotEnoughAccountKeys); @@ -186,7 +186,7 @@ pub fn process_ctoken_to_spl_invoke_signed( return Err(ProgramError::InvalidSeeds); } - let account_infos = TransferCTokenToSplCpi { + let account_infos = TransferTokenToSplCpi { source_ctoken_account: accounts[1].clone(), destination_spl_token_account: accounts[2].clone(), amount: data.amount, diff --git a/sdk-tests/sdk-ctoken-test/tests/scenario_cmint.rs b/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs similarity index 99% rename from sdk-tests/sdk-ctoken-test/tests/scenario_cmint.rs rename to sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs index e1b1a8ef8f..1e1d32f8eb 100644 --- a/sdk-tests/sdk-ctoken-test/tests/scenario_cmint.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs @@ -15,10 +15,10 @@ mod shared; use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; -use light_ctoken_sdk::ctoken::{ +use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; +use light_token_sdk::token::{ CreateAssociatedCTokenAccount, DecompressToCtoken, Token, TransferCToken, }; -use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use solana_sdk::{signature::Keypair, signer::Signer}; /// Test the complete cMint to cToken flow using direct SDK calls diff --git a/sdk-tests/sdk-ctoken-test/tests/scenario_cmint_compression_only.rs b/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs similarity index 99% rename from sdk-tests/sdk-ctoken-test/tests/scenario_cmint_compression_only.rs rename to sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs index 99970f5a4f..bbdef05f12 100644 --- a/sdk-tests/sdk-ctoken-test/tests/scenario_cmint_compression_only.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs @@ -15,10 +15,10 @@ mod shared; use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; -use light_ctoken_sdk::ctoken::{ +use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; +use light_token_sdk::token::{ CompressibleParams, CreateAssociatedCTokenAccount, DecompressToCtoken, Token, TransferCToken, }; -use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use solana_sdk::{signature::Keypair, signer::Signer}; /// Test the complete cMint to cToken flow with compression_only: true diff --git a/sdk-tests/sdk-ctoken-test/tests/scenario_spl.rs b/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs similarity index 95% rename from sdk-tests/sdk-ctoken-test/tests/scenario_spl.rs rename to sdk-tests/sdk-light-token-test/tests/scenario_spl.rs index 6b324ec96e..9fff0bde52 100644 --- a/sdk-tests/sdk-ctoken-test/tests/scenario_spl.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs @@ -18,15 +18,15 @@ use anchor_spl::token::{spl_token, Mint}; use light_client::{indexer::Indexer, rpc::Rpc}; -use light_ctoken_sdk::{ - ctoken::{ - derive_ctoken_ata, CreateAssociatedCTokenAccount, DecompressToCtoken, FreezeCToken, - ThawCToken, TransferSplToCtoken, - }, - spl_interface::{find_spl_interface_pda_with_index, CreateSplInterfacePda}, -}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use light_test_utils::spl::{create_token_account, mint_spl_tokens}; +use light_token_sdk::{ + spl_interface::{find_spl_interface_pda_with_index, CreateSplInterfacePda}, + token::{ + derive_token_ata, CreateAssociatedTokenAccount, DecompressToToken, FreezeToken, ThawToken, + TransferSplToToken, + }, +}; use solana_sdk::{signature::Keypair, signer::Signer}; use spl_token_2022::pod::PodAccount; @@ -132,9 +132,9 @@ async fn test_spl_to_ctoken_scenario() { .await .unwrap(); - let (ctoken_ata, _bump) = derive_ctoken_ata(&ctoken_recipient.pubkey(), &mint); + let (ctoken_ata, _bump) = derive_token_ata(&ctoken_recipient.pubkey(), &mint); let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), ctoken_recipient.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), ctoken_recipient.pubkey(), mint) .instruction() .unwrap(); @@ -153,7 +153,7 @@ async fn test_spl_to_ctoken_scenario() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); - let transfer_instruction = TransferSplToCtoken { + let transfer_instruction = TransferSplToToken { amount: transfer_amount, spl_interface_pda_bump, decimals, @@ -221,7 +221,7 @@ async fn test_spl_to_ctoken_scenario() { // 8. Freeze the cToken account println!("\nFreezing cToken account..."); - let freeze_instruction = FreezeCToken { + let freeze_instruction = FreezeToken { token_account: ctoken_ata, mint, freeze_authority: payer.pubkey(), @@ -246,7 +246,7 @@ async fn test_spl_to_ctoken_scenario() { // 9. Thaw the cToken account println!("Thawing cToken account..."); - let thaw_instruction = ThawCToken { + let thaw_instruction = ThawToken { token_account: ctoken_ata, mint, freeze_authority: payer.pubkey(), @@ -323,7 +323,7 @@ async fn test_spl_to_ctoken_scenario() { // 12. Recreate cToken ATA for decompression (idempotent) println!("\nRecreating cToken ATA for decompression..."); let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), ctoken_recipient.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), ctoken_recipient.pubkey(), mint) .idempotent() .instruction() .unwrap(); @@ -366,7 +366,7 @@ async fn test_spl_to_ctoken_scenario() { // 13. Decompress compressed tokens to cToken account println!("Decompressing tokens to cToken account..."); - let decompress_instruction = DecompressToCtoken { + let decompress_instruction = DecompressToToken { token_data, discriminator, merkle_tree: account_proof.tree_info.tree, diff --git a/sdk-tests/sdk-ctoken-test/tests/scenario_spl_restricted_ext.rs b/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs similarity index 97% rename from sdk-tests/sdk-ctoken-test/tests/scenario_spl_restricted_ext.rs rename to sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs index a45b353956..ec366461e0 100644 --- a/sdk-tests/sdk-ctoken-test/tests/scenario_spl_restricted_ext.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs @@ -14,17 +14,17 @@ // 11. Verify cToken account has tokens again use light_client::{indexer::Indexer, rpc::Rpc}; -use light_ctoken_sdk::{ - ctoken::{ - derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount, DecompressToCtoken, - TransferSplToCtoken, - }, - spl_interface::find_spl_interface_pda_with_index, -}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use light_test_utils::mint_2022::{ create_mint_22_with_extensions, create_token_22_account, mint_spl_tokens_22, }; +use light_token_sdk::{ + ctoken::{ + derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount, DecompressToCtoken, + TransferSplToToken, + }, + spl_interface::find_spl_interface_pda_with_index, +}; use solana_sdk::{signature::Keypair, signer::Signer}; use spl_token_2022::pod::PodAccount; @@ -75,7 +75,7 @@ async fn test_t22_restricted_to_ctoken_scenario() { .await .unwrap(); - let (ctoken_ata, _bump) = derive_ctoken_ata(&ctoken_recipient.pubkey(), &mint); + let (ctoken_ata, _bump) = derive_token_ata(&ctoken_recipient.pubkey(), &mint); let compressible_params = CompressibleParams { compression_only: true, ..Default::default() @@ -101,7 +101,7 @@ async fn test_t22_restricted_to_ctoken_scenario() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, true); - let transfer_instruction = TransferSplToCtoken { + let transfer_instruction = TransferSplToToken { amount: transfer_amount, spl_interface_pda_bump, decimals, diff --git a/sdk-tests/sdk-ctoken-test/tests/shared.rs b/sdk-tests/sdk-light-token-test/tests/shared.rs similarity index 87% rename from sdk-tests/sdk-ctoken-test/tests/shared.rs rename to sdk-tests/sdk-light-token-test/tests/shared.rs index 01a49a177d..91eb3e9c29 100644 --- a/sdk-tests/sdk-ctoken-test/tests/shared.rs +++ b/sdk-tests/sdk-light-token-test/tests/shared.rs @@ -1,4 +1,4 @@ -// Shared test utilities for sdk-ctoken-test +// Shared test utilities for sdk-light-token-test use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; @@ -15,9 +15,9 @@ pub async fn setup_create_compressed_mint( decimals: u8, recipients: Vec<(u64, Pubkey)>, ) -> (Pubkey, [u8; 32], Vec, Keypair) { - use light_ctoken_sdk::ctoken::{ - CreateAssociatedCTokenAccount, CreateCMint, CreateCMintParams, MintToCToken, - MintToCTokenParams, + use light_token_sdk::token::{ + CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintToToken, + MintToTokenParams, }; let mint_seed = Keypair::new(); @@ -25,12 +25,12 @@ pub async fn setup_create_compressed_mint( let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); - let mint = light_ctoken_sdk::ctoken::find_cmint_address(&mint_seed.pubkey()).0; + let mint = light_token_sdk::token::find_cmint_address(&mint_seed.pubkey()).0; // Get validity proof for the address let rpc_result = rpc @@ -91,15 +91,15 @@ pub async fn setup_create_compressed_mint( } // Create ATAs for each recipient - use light_ctoken_sdk::ctoken::derive_ctoken_ata; + use light_token_sdk::token::derive_token_ata; let mut ata_pubkeys = Vec::with_capacity(recipients.len()); for (_amount, owner) in &recipients { - let (ata_address, _bump) = derive_ctoken_ata(owner, &mint); + let (ata_address, _bump) = derive_token_ata(owner, &mint); ata_pubkeys.push(ata_address); - let create_ata = CreateAssociatedCTokenAccount::new(payer.pubkey(), *owner, mint); + let create_ata = CreateAssociatedTokenAccount::new(payer.pubkey(), *owner, mint); let ata_instruction = create_ata.instruction().unwrap(); rpc.create_and_send_transaction(&[ata_instruction], &payer.pubkey(), &[payer]) @@ -150,7 +150,7 @@ pub async fn setup_create_compressed_mint( // Build mint params with first recipient let (first_idx, (first_amount, _)) = recipients_with_amount[0]; - let mut mint_params = MintToCTokenParams::new( + let mut mint_params = MintToTokenParams::new( compressed_mint_with_context, *first_amount, mint_authority, @@ -164,8 +164,8 @@ pub async fn setup_create_compressed_mint( mint_params = mint_params.add_mint_to_action(*idx as u8, *amount); } - // Build MintToCToken instruction - let mint_to_ctoken = MintToCToken::new( + // Build MintToToken instruction + let mint_to_ctoken = MintToToken::new( mint_params, payer.pubkey(), compressed_mint_account.tree_info.tree, @@ -194,9 +194,9 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( decimals: u8, recipients: Vec<(u64, Pubkey)>, ) -> (Pubkey, [u8; 32], Vec) { - use light_ctoken_sdk::ctoken::{ - CreateAssociatedCTokenAccount, CreateCMint, CreateCMintParams, MintToCToken, - MintToCTokenParams, + use light_token_sdk::token::{ + CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintToToken, + MintToTokenParams, }; let mint_seed = Keypair::new(); @@ -204,12 +204,12 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); - let mint = light_ctoken_sdk::ctoken::find_cmint_address(&mint_seed.pubkey()).0; + let mint = light_token_sdk::token::find_cmint_address(&mint_seed.pubkey()).0; // Get validity proof for the address let rpc_result = rpc @@ -266,7 +266,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; - use light_ctoken_sdk::ctoken::DecompressCMint; + use light_token_sdk::token::DecompressCMint; let compressed_mint = CompressedMint::deserialize( &mut compressed_mint_account @@ -322,15 +322,15 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( } // Create ATAs for each recipient - use light_ctoken_sdk::ctoken::derive_ctoken_ata; + use light_token_sdk::token::derive_token_ata; let mut ata_pubkeys = Vec::with_capacity(recipients.len()); for (_amount, owner) in &recipients { - let (ata_address, _bump) = derive_ctoken_ata(owner, &mint); + let (ata_address, _bump) = derive_token_ata(owner, &mint); ata_pubkeys.push(ata_address); - let create_ata = CreateAssociatedCTokenAccount::new(payer.pubkey(), *owner, mint); + let create_ata = CreateAssociatedTokenAccount::new(payer.pubkey(), *owner, mint); let ata_instruction = create_ata.instruction().unwrap(); rpc.create_and_send_transaction(&[ata_instruction], &payer.pubkey(), &[payer]) @@ -338,8 +338,8 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( .unwrap(); } - // After decompression, use CTokenMintTo (simple 3-account instruction) - // instead of MintToCToken (which uses compressed mint) + // After decompression, use TokenMintTo (simple 3-account instruction) + // instead of MintToToken (which uses compressed mint) let recipients_with_amount: Vec<_> = recipients .iter() .enumerate() @@ -347,10 +347,10 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( .collect(); if !recipients_with_amount.is_empty() { - use light_ctoken_sdk::ctoken::CTokenMintTo; + use light_token_sdk::token::TokenMintTo; for (idx, (amount, _)) in &recipients_with_amount { - let mint_instruction = CTokenMintTo { + let mint_instruction = TokenMintTo { cmint: mint, destination: ata_pubkeys[*idx], amount: *amount, @@ -379,9 +379,9 @@ pub async fn setup_create_compressed_mint_with_compression_only( recipients: Vec<(u64, Pubkey)>, compression_only: bool, ) -> (Pubkey, [u8; 32], Vec) { - use light_ctoken_sdk::ctoken::{ - CompressibleParams, CreateAssociatedCTokenAccount, CreateCMint, CreateCMintParams, - MintToCToken, MintToCTokenParams, + use light_token_sdk::token::{ + CompressibleParams, CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, + MintToToken, MintToTokenParams, }; let mint_seed = Keypair::new(); @@ -389,12 +389,12 @@ pub async fn setup_create_compressed_mint_with_compression_only( let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); - let mint = light_ctoken_sdk::ctoken::find_cmint_address(&mint_seed.pubkey()).0; + let mint = light_token_sdk::token::find_cmint_address(&mint_seed.pubkey()).0; // Get validity proof for the address let rpc_result = rpc @@ -455,7 +455,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( } // Create ATAs for each recipient with custom compression_only setting - use light_ctoken_sdk::ctoken::derive_ctoken_ata; + use light_token_sdk::token::derive_token_ata; let mut ata_pubkeys = Vec::with_capacity(recipients.len()); @@ -466,10 +466,10 @@ pub async fn setup_create_compressed_mint_with_compression_only( }; for (_amount, owner) in &recipients { - let (ata_address, _bump) = derive_ctoken_ata(owner, &mint); + let (ata_address, _bump) = derive_token_ata(owner, &mint); ata_pubkeys.push(ata_address); - let create_ata = CreateAssociatedCTokenAccount::new(payer.pubkey(), *owner, mint) + let create_ata = CreateAssociatedTokenAccount::new(payer.pubkey(), *owner, mint) .with_compressible(compressible_params.clone()); let ata_instruction = create_ata.instruction().unwrap(); @@ -521,7 +521,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( // Build mint params with first recipient let (first_idx, (first_amount, _)) = recipients_with_amount[0]; - let mut mint_params = MintToCTokenParams::new( + let mut mint_params = MintToTokenParams::new( compressed_mint_with_context, *first_amount, mint_authority, @@ -535,8 +535,8 @@ pub async fn setup_create_compressed_mint_with_compression_only( mint_params = mint_params.add_mint_to_action(*idx as u8, *amount); } - // Build MintToCToken instruction - let mint_to_ctoken = MintToCToken::new( + // Build MintToToken instruction + let mint_to_ctoken = MintToToken::new( mint_params, payer.pubkey(), compressed_mint_account.tree_info.tree, diff --git a/sdk-tests/sdk-ctoken-test/tests/test_approve_revoke.rs b/sdk-tests/sdk-light-token-test/tests/test_approve_revoke.rs similarity index 97% rename from sdk-tests/sdk-ctoken-test/tests/test_approve_revoke.rs rename to sdk-tests/sdk-light-token-test/tests/test_approve_revoke.rs index b63418825b..0574e4e44a 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_approve_revoke.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_approve_revoke.rs @@ -4,9 +4,9 @@ mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_token_interface::state::Token; use light_program_test::{LightProgramTest, ProgramTestConfig}; -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; +use light_token_interface::state::Token; use native_ctoken_examples::{ApproveData, InstructionType, ID, TOKEN_ACCOUNT_SEED}; use shared::*; use solana_sdk::{ @@ -44,7 +44,7 @@ async fn test_approve_invoke() { }; approve_data.serialize(&mut instruction_data).unwrap(); - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let instruction = Instruction { program_id: ID, accounts: vec![ @@ -103,7 +103,7 @@ async fn test_approve_invoke_signed() { }; approve_data.serialize(&mut instruction_data).unwrap(); - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let instruction = Instruction { program_id: ID, accounts: vec![ @@ -156,7 +156,7 @@ async fn test_revoke_invoke() { let ata = ata_pubkeys[0]; let delegate = Keypair::new(); let approve_amount = 100u64; - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); // First approve a delegate let mut approve_instruction_data = vec![InstructionType::ApproveInvoke as u8]; @@ -242,7 +242,7 @@ async fn test_revoke_invoke_signed() { let ata = ata_pubkeys[0]; let delegate = Keypair::new(); let approve_amount = 100u64; - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); // First approve a delegate using invoke_signed let mut approve_instruction_data = vec![InstructionType::ApproveInvokeSigned as u8]; diff --git a/sdk-tests/sdk-ctoken-test/tests/test_burn.rs b/sdk-tests/sdk-light-token-test/tests/test_burn.rs similarity index 96% rename from sdk-tests/sdk-ctoken-test/tests/test_burn.rs rename to sdk-tests/sdk-light-token-test/tests/test_burn.rs index 63a6a6a367..8308e87827 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_burn.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_burn.rs @@ -4,9 +4,9 @@ mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_token_interface::state::Token; use light_program_test::{LightProgramTest, ProgramTestConfig}; -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; +use light_token_interface::state::Token; use native_ctoken_examples::{BurnData, InstructionType, ID, TOKEN_ACCOUNT_SEED}; use shared::*; use solana_sdk::{ @@ -48,7 +48,7 @@ async fn test_burn_invoke() { }; burn_data.serialize(&mut instruction_data).unwrap(); - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let instruction = Instruction { program_id: ID, accounts: vec![ @@ -114,7 +114,7 @@ async fn test_burn_invoke_signed() { }; burn_data.serialize(&mut instruction_data).unwrap(); - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let instruction = Instruction { program_id: ID, accounts: vec![ diff --git a/sdk-tests/sdk-ctoken-test/tests/test_close.rs b/sdk-tests/sdk-light-token-test/tests/test_close.rs similarity index 91% rename from sdk-tests/sdk-ctoken-test/tests/test_close.rs rename to sdk-tests/sdk-light-token-test/tests/test_close.rs index 9ff68e8401..89212270e7 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_close.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_close.rs @@ -3,8 +3,8 @@ mod shared; use light_client::rpc::Rpc; -use light_ctoken_sdk::ctoken::{rent_sponsor_pda, CTOKEN_PROGRAM_ID}; use light_program_test::{LightProgramTest, ProgramTestConfig}; +use light_token_sdk::token::{rent_sponsor_pda, LIGHT_TOKEN_PROGRAM_ID}; use native_ctoken_examples::{InstructionType, ID, TOKEN_ACCOUNT_SEED}; use shared::*; use solana_sdk::{ @@ -45,11 +45,11 @@ async fn test_close_invoke() { let instruction = Instruction { program_id: ID, accounts: vec![ - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), // token_program - AccountMeta::new(ata, false), // account to close - AccountMeta::new(payer.pubkey(), false), // destination - AccountMeta::new(payer.pubkey(), true), // owner (signer) - AccountMeta::new(rent_sponsor, false), // rent_sponsor + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), // token_program + AccountMeta::new(ata, false), // account to close + AccountMeta::new(payer.pubkey(), false), // destination + AccountMeta::new(payer.pubkey(), true), // owner (signer) + AccountMeta::new(rent_sponsor, false), // rent_sponsor ], data: instruction_data, }; @@ -102,9 +102,9 @@ async fn test_close_invoke_signed() { let instruction = Instruction { program_id: ID, accounts: vec![ - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), // token_program - AccountMeta::new(ata, false), // account to close - AccountMeta::new(payer.pubkey(), false), // destination + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), // token_program + AccountMeta::new(ata, false), // account to close + AccountMeta::new(payer.pubkey(), false), // destination AccountMeta::new(pda_owner, false), // owner (PDA, mutable for write_top_up) AccountMeta::new(rent_sponsor, false), // rent_sponsor ], diff --git a/sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs b/sdk-tests/sdk-light-token-test/tests/test_create_ata.rs similarity index 91% rename from sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs rename to sdk-tests/sdk-light-token-test/tests/test_create_ata.rs index 5080cc4cce..288b4d1b83 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_create_ata.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_create_ata.rs @@ -4,8 +4,8 @@ mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_ctoken_sdk::ctoken::CTOKEN_PROGRAM_ID; use light_program_test::{LightProgramTest, ProgramTestConfig}; +use light_token_sdk::token::LIGHT_TOKEN_PROGRAM_ID; use native_ctoken_examples::{CreateAtaData, ATA_SEED, ID}; use shared::setup_create_compressed_mint; use solana_sdk::{ @@ -33,8 +33,8 @@ async fn test_create_ata_invoke() { // Derive the ATA address let owner = payer.pubkey(); - use light_ctoken_sdk::ctoken::derive_ctoken_ata; - let (ata_address, bump) = derive_ctoken_ata(&owner, &mint_pda); + use light_token_sdk::token::derive_token_ata; + let (ata_address, bump) = derive_token_ata(&owner, &mint_pda); // Build CreateAtaData (owner and mint are passed as accounts) let create_ata_data = CreateAtaData { @@ -45,7 +45,7 @@ async fn test_create_ata_invoke() { // Discriminator 4 = CreateAtaInvoke let instruction_data = [vec![4u8], create_ata_data.try_to_vec().unwrap()].concat(); - use light_ctoken_sdk::ctoken::{config_pda, rent_sponsor_pda}; + use light_token_sdk::token::{config_pda, rent_sponsor_pda}; let config = config_pda(); let rent_sponsor = rent_sponsor_pda(); @@ -60,7 +60,7 @@ async fn test_create_ata_invoke() { AccountMeta::new_readonly(Pubkey::default(), false), // system_program AccountMeta::new_readonly(config, false), AccountMeta::new(rent_sponsor, false), - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), ], data: instruction_data, }; @@ -119,8 +119,8 @@ async fn test_create_ata_invoke_signed() { .unwrap(); // Derive the ATA address for the PDA owner - use light_ctoken_sdk::ctoken::derive_ctoken_ata; - let (ata_address, bump) = derive_ctoken_ata(&pda_owner, &mint_pda); + use light_token_sdk::token::derive_token_ata; + let (ata_address, bump) = derive_token_ata(&pda_owner, &mint_pda); // Build CreateAtaData with PDA as owner (owner and mint are passed as accounts) let create_ata_data = CreateAtaData { @@ -131,7 +131,7 @@ async fn test_create_ata_invoke_signed() { // Discriminator 5 = CreateAtaInvokeSigned let instruction_data = [vec![5u8], create_ata_data.try_to_vec().unwrap()].concat(); - use light_ctoken_sdk::ctoken::{config_pda, rent_sponsor_pda}; + use light_token_sdk::token::{config_pda, rent_sponsor_pda}; let config = config_pda(); let rent_sponsor = rent_sponsor_pda(); @@ -146,7 +146,7 @@ async fn test_create_ata_invoke_signed() { AccountMeta::new_readonly(Pubkey::default(), false), // system_program AccountMeta::new_readonly(config, false), AccountMeta::new(rent_sponsor, false), - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), ], data: instruction_data, }; diff --git a/sdk-tests/sdk-ctoken-test/tests/test_create_cmint.rs b/sdk-tests/sdk-light-token-test/tests/test_create_cmint.rs similarity index 93% rename from sdk-tests/sdk-ctoken-test/tests/test_create_cmint.rs rename to sdk-tests/sdk-light-token-test/tests/test_create_cmint.rs index a74ec335bd..8a2cc05c9e 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_create_cmint.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_create_cmint.rs @@ -4,14 +4,14 @@ mod shared; use borsh::BorshSerialize; use light_client::{indexer::Indexer, rpc::Rpc}; +use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_token_interface::{ instructions::extensions::{ token_metadata::TokenMetadataInstructionData, ExtensionInstructionData, }, state::AdditionalMetadata, }; -use light_ctoken_sdk::compressed_token::mint_action::MintActionMetaConfig; -use light_program_test::{LightProgramTest, ProgramTestConfig}; +use light_token_sdk::compressed_token::mint_action::MintActionMetaConfig; use native_ctoken_examples::{CreateCmintData, ID, MINT_SIGNER_SEED}; use solana_sdk::{ instruction::{AccountMeta, Instruction}, @@ -42,12 +42,12 @@ async fn test_create_compressed_mint() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); // Use SDK helper to derive the compression address correctly - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_signer.pubkey(), &address_tree.tree, ); - let mint_pda = light_ctoken_sdk::ctoken::find_cmint_address(&mint_signer.pubkey()).0; + let mint_pda = light_token_sdk::token::find_cmint_address(&mint_signer.pubkey()).0; let rpc_result = rpc .get_validity_proof( @@ -150,12 +150,12 @@ async fn test_create_compressed_mint_invoke_signed() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); // Use SDK helper to derive the compression address correctly - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_signer_pda, &address_tree.tree, ); - let mint_pda = light_ctoken_sdk::ctoken::find_cmint_address(&mint_signer_pda).0; + let mint_pda = light_token_sdk::token::find_cmint_address(&mint_signer_pda).0; let rpc_result = rpc .get_validity_proof( @@ -186,7 +186,7 @@ async fn test_create_compressed_mint_invoke_signed() { // Build accounts manually since SDK marks mint_signer as signer, but we need it as non-signer // for invoke_signed (the wrapper program signs via CPI) - let system_accounts = light_ctoken_sdk::ctoken::SystemAccounts::default(); + let system_accounts = light_token_sdk::token::SystemAccounts::default(); let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), AccountMeta::new_readonly(system_accounts.light_system_program, false), diff --git a/sdk-tests/sdk-ctoken-test/tests/test_create_token_account.rs b/sdk-tests/sdk-light-token-test/tests/test_create_token_account.rs similarity index 90% rename from sdk-tests/sdk-ctoken-test/tests/test_create_token_account.rs rename to sdk-tests/sdk-light-token-test/tests/test_create_token_account.rs index 31b51f5768..c27a5fd155 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_create_token_account.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_create_token_account.rs @@ -1,11 +1,11 @@ -// Tests for CreateCTokenAccountCpi (CreateTokenAccount instructions) +// Tests for CreateTokenAccountCpi (CreateTokenAccount instructions) mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_ctoken_sdk::ctoken::CTOKEN_PROGRAM_ID; use light_program_test::{LightProgramTest, ProgramTestConfig}; +use light_token_sdk::token::LIGHT_TOKEN_PROGRAM_ID; use native_ctoken_examples::{CreateTokenAccountData, ID}; use shared::setup_create_compressed_mint; use solana_sdk::{ @@ -15,7 +15,7 @@ use solana_sdk::{ signer::Signer, }; -/// Test creating a token account using CreateCTokenAccountCpi::invoke() +/// Test creating a token account using CreateTokenAccountCpi::invoke() #[tokio::test] async fn test_create_token_account_invoke() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -43,7 +43,7 @@ async fn test_create_token_account_invoke() { }; let instruction_data = [vec![2u8], create_token_account_data.try_to_vec().unwrap()].concat(); - use light_ctoken_sdk::ctoken::{config_pda, rent_sponsor_pda}; + use light_token_sdk::token::{config_pda, rent_sponsor_pda}; let config = config_pda(); let rent_sponsor = rent_sponsor_pda(); @@ -56,7 +56,7 @@ async fn test_create_token_account_invoke() { AccountMeta::new_readonly(config, false), AccountMeta::new_readonly(Pubkey::default(), false), // system_program AccountMeta::new(rent_sponsor, false), - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), ], data: instruction_data, }; @@ -88,7 +88,7 @@ async fn test_create_token_account_invoke() { assert_eq!(account_state.amount, 0, "Initial amount should be 0"); } -/// Test creating a PDA-owned token account using CreateCTokenAccountCpi::invoke_signed() +/// Test creating a PDA-owned token account using CreateTokenAccountCpi::invoke_signed() #[tokio::test] async fn test_create_token_account_invoke_signed() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -119,7 +119,7 @@ async fn test_create_token_account_invoke_signed() { // Discriminator 3 = CreateTokenAccountInvokeSigned let instruction_data = [vec![3u8], create_token_account_data.try_to_vec().unwrap()].concat(); - use light_ctoken_sdk::ctoken::{config_pda, rent_sponsor_pda}; + use light_token_sdk::token::{config_pda, rent_sponsor_pda}; let config = config_pda(); let rent_sponsor = rent_sponsor_pda(); @@ -132,7 +132,7 @@ async fn test_create_token_account_invoke_signed() { AccountMeta::new_readonly(config, false), AccountMeta::new_readonly(Pubkey::default(), false), // system_program AccountMeta::new(rent_sponsor, false), - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), ], data: instruction_data, }; diff --git a/sdk-tests/sdk-ctoken-test/tests/test_ctoken_mint_to.rs b/sdk-tests/sdk-light-token-test/tests/test_ctoken_mint_to.rs similarity index 91% rename from sdk-tests/sdk-ctoken-test/tests/test_ctoken_mint_to.rs rename to sdk-tests/sdk-light-token-test/tests/test_ctoken_mint_to.rs index b31b4f357e..98aa7bc3c7 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_ctoken_mint_to.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_ctoken_mint_to.rs @@ -4,9 +4,9 @@ mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_token_interface::state::Token; use light_program_test::{LightProgramTest, ProgramTestConfig}; -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; +use light_token_interface::state::Token; use native_ctoken_examples::{InstructionType, MintToData, ID, MINT_AUTHORITY_SEED}; use shared::*; use solana_sdk::{ @@ -48,7 +48,7 @@ async fn test_ctoken_mint_to_invoke() { }; mint_data.serialize(&mut instruction_data).unwrap(); - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let system_program = Pubkey::default(); let instruction = Instruction { program_id: ID, @@ -93,7 +93,7 @@ async fn test_ctoken_mint_to_invoke_signed() { use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; - use light_ctoken_sdk::ctoken::CreateAssociatedCTokenAccount; + use light_token_sdk::token::CreateAssociatedTokenAccount; use native_ctoken_examples::{ CreateCmintData, DecompressCmintData, InstructionType as WrapperInstructionType, MINT_SIGNER_SEED, @@ -112,12 +112,12 @@ async fn test_ctoken_mint_to_invoke_signed() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using the PDA mint_signer - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_signer_pda, &address_tree.tree, ); - let mint_pda = light_ctoken_sdk::ctoken::find_cmint_address(&mint_signer_pda).0; + let mint_pda = light_token_sdk::token::find_cmint_address(&mint_signer_pda).0; // Step 1: Create compressed mint with PDA authority using wrapper program (discriminator 14) { @@ -136,7 +136,7 @@ async fn test_ctoken_mint_to_invoke_signed() { let compressed_token_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); - let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); + let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); let create_cmint_data = CreateCmintData { decimals, @@ -214,9 +214,9 @@ async fn test_ctoken_mint_to_invoke_signed() { mint: Some(compressed_mint.try_into().unwrap()), }; - let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); - let compressible_config = light_ctoken_sdk::ctoken::config_pda(); - let rent_sponsor = light_ctoken_sdk::ctoken::rent_sponsor_pda(); + let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); + let compressible_config = light_token_sdk::token::config_pda(); + let rent_sponsor = light_token_sdk::token::rent_sponsor_pda(); let decompress_data = DecompressCmintData { compressed_mint_with_context, @@ -249,7 +249,8 @@ async fn test_ctoken_mint_to_invoke_signed() { // 13: account_compression_program (readonly) // 14: system_program (readonly) // 15: ctoken_program (readonly) - required for CPI - let ctoken_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); + let light_token_program_id = + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let wrapper_accounts = vec![ AccountMeta::new_readonly(mint_signer_pda, false), AccountMeta::new_readonly(pda_mint_authority, false), @@ -266,7 +267,7 @@ async fn test_ctoken_mint_to_invoke_signed() { AccountMeta::new_readonly(default_pubkeys.account_compression_authority, false), AccountMeta::new_readonly(default_pubkeys.account_compression_program, false), AccountMeta::new_readonly(default_pubkeys.system_program, false), - AccountMeta::new_readonly(ctoken_program_id, false), + AccountMeta::new_readonly(light_token_program_id, false), ]; let decompress_ix = Instruction { @@ -282,10 +283,9 @@ async fn test_ctoken_mint_to_invoke_signed() { // Step 3: Create ATA for payer let ata = { - let (ata_address, _) = - light_ctoken_sdk::ctoken::derive_ctoken_ata(&payer.pubkey(), &mint_pda); + let (ata_address, _) = light_token_sdk::token::derive_token_ata(&payer.pubkey(), &mint_pda); let create_ata = - CreateAssociatedCTokenAccount::new(payer.pubkey(), payer.pubkey(), mint_pda); + CreateAssociatedTokenAccount::new(payer.pubkey(), payer.pubkey(), mint_pda); let ata_instruction = create_ata.instruction().unwrap(); rpc.create_and_send_transaction(&[ata_instruction], &payer.pubkey(), &[&payer]) @@ -308,7 +308,7 @@ async fn test_ctoken_mint_to_invoke_signed() { }; mint_data.serialize(&mut instruction_data).unwrap(); - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let system_program = Pubkey::default(); let instruction = Instruction { program_id: ID, diff --git a/sdk-tests/sdk-ctoken-test/tests/test_decompress_cmint.rs b/sdk-tests/sdk-light-token-test/tests/test_decompress_cmint.rs similarity index 96% rename from sdk-tests/sdk-ctoken-test/tests/test_decompress_cmint.rs rename to sdk-tests/sdk-light-token-test/tests/test_decompress_cmint.rs index a964a0f771..b073fd3ca8 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_decompress_cmint.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_decompress_cmint.rs @@ -5,11 +5,11 @@ mod shared; use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; use light_compressible::compression_info::CompressionInfo; +use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; -use light_ctoken_sdk::ctoken::{find_cmint_address, DecompressCMint}; -use light_program_test::{LightProgramTest, ProgramTestConfig}; +use light_token_sdk::token::{find_cmint_address, DecompressCMint}; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; /// Test decompressing a compressed mint to CMint account @@ -228,14 +228,14 @@ async fn setup_create_compressed_mint_with_freeze_authority_only( freeze_authority: Option, decimals: u8, ) -> (Pubkey, [u8; 32], Keypair) { - use light_ctoken_sdk::ctoken::{CreateCMint, CreateCMintParams}; + use light_token_sdk::token::{CreateCMint, CreateCMintParams}; let mint_seed = Keypair::new(); let address_tree = rpc.get_address_tree_v2(); let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); @@ -435,14 +435,14 @@ async fn setup_create_compressed_mint_with_extensions( decimals: u8, extensions: Vec, ) -> (Pubkey, [u8; 32], Keypair) { - use light_ctoken_sdk::ctoken::{CreateCMint, CreateCMintParams}; + use light_token_sdk::token::{CreateCMint, CreateCMintParams}; let mint_seed = Keypair::new(); let address_tree = rpc.get_address_tree_v2(); let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); @@ -528,7 +528,7 @@ async fn test_decompress_cmint_cpi_invoke_signed() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using the PDA mint_signer - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_signer_pda, &address_tree.tree, ); @@ -552,7 +552,7 @@ async fn test_decompress_cmint_cpi_invoke_signed() { let compressed_token_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); - let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); + let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); let create_cmint_data = CreateCmintData { decimals, @@ -637,9 +637,9 @@ async fn test_decompress_cmint_cpi_invoke_signed() { mint: Some(compressed_mint.clone().try_into().unwrap()), }; - let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); - let compressible_config = light_ctoken_sdk::ctoken::config_pda(); - let rent_sponsor = light_ctoken_sdk::ctoken::rent_sponsor_pda(); + let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); + let compressible_config = light_token_sdk::token::config_pda(); + let rent_sponsor = light_token_sdk::token::rent_sponsor_pda(); let decompress_data = DecompressCmintData { compressed_mint_with_context, @@ -655,7 +655,8 @@ async fn test_decompress_cmint_cpi_invoke_signed() { ] .concat(); - let ctoken_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); + let light_token_program_id = + Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let wrapper_accounts = vec![ AccountMeta::new_readonly(mint_signer_pda, false), AccountMeta::new_readonly(pda_mint_authority, false), @@ -672,7 +673,7 @@ async fn test_decompress_cmint_cpi_invoke_signed() { AccountMeta::new_readonly(default_pubkeys.account_compression_authority, false), AccountMeta::new_readonly(default_pubkeys.account_compression_program, false), AccountMeta::new_readonly(default_pubkeys.system_program, false), - AccountMeta::new_readonly(ctoken_program_id, false), + AccountMeta::new_readonly(light_token_program_id, false), ]; let decompress_ix = Instruction { diff --git a/sdk-tests/sdk-ctoken-test/tests/test_freeze_thaw.rs b/sdk-tests/sdk-light-token-test/tests/test_freeze_thaw.rs similarity index 97% rename from sdk-tests/sdk-ctoken-test/tests/test_freeze_thaw.rs rename to sdk-tests/sdk-light-token-test/tests/test_freeze_thaw.rs index dc0d2d4734..00dcee19cf 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_freeze_thaw.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_freeze_thaw.rs @@ -4,9 +4,9 @@ mod shared; use borsh::BorshDeserialize; use light_client::rpc::Rpc; -use light_token_interface::state::{AccountState, Token}; use light_program_test::{LightProgramTest, ProgramTestConfig}; -use light_sdk_types::C_TOKEN_PROGRAM_ID; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; +use light_token_interface::state::{AccountState, Token}; use native_ctoken_examples::{InstructionType, FREEZE_AUTHORITY_SEED, ID}; use shared::*; use solana_sdk::{ @@ -51,7 +51,7 @@ async fn test_freeze_invoke() { // Build freeze instruction via wrapper program let instruction_data = vec![InstructionType::FreezeInvoke as u8]; - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let instruction = Instruction { program_id: ID, accounts: vec![ @@ -110,7 +110,7 @@ async fn test_freeze_invoke_signed() { // Build freeze instruction via wrapper program using invoke_signed let instruction_data = vec![InstructionType::FreezeInvokeSigned as u8]; - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); let instruction = Instruction { program_id: ID, accounts: vec![ @@ -146,7 +146,7 @@ async fn test_thaw_invoke() { let payer = rpc.get_payer().insecure_clone(); let freeze_authority = Keypair::new(); - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); // Create a compressed mint with freeze_authority and an ATA for the payer with 1000 tokens let (mint_pda, _compression_address, ata_pubkeys) = @@ -233,7 +233,7 @@ async fn test_thaw_invoke_signed() { // Derive the PDA that will be the freeze authority let (pda_freeze_authority, _bump) = Pubkey::find_program_address(&[FREEZE_AUTHORITY_SEED], &ID); - let ctoken_program = Pubkey::from(C_TOKEN_PROGRAM_ID); + let ctoken_program = Pubkey::from(LIGHT_TOKEN_PROGRAM_ID); // Create a compressed mint with PDA freeze_authority and an ATA for the payer with 1000 tokens let (mint_pda, _compression_address, ata_pubkeys) = diff --git a/sdk-tests/sdk-ctoken-test/tests/test_mint_to_ctoken.rs b/sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs similarity index 95% rename from sdk-tests/sdk-ctoken-test/tests/test_mint_to_ctoken.rs rename to sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs index 310e31f95d..fec8f0a63e 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_mint_to_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs @@ -4,10 +4,10 @@ mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::{indexer::Indexer, rpc::Rpc}; -use light_ctoken_sdk::{ - compressed_token::mint_action::MintActionMetaConfig, ctoken::CTOKEN_PROGRAM_ID, -}; use light_program_test::{LightProgramTest, ProgramTestConfig}; +use light_token_sdk::{ + compressed_token::mint_action::MintActionMetaConfig, ctoken::LIGHT_TOKEN_PROGRAM_ID, +}; use native_ctoken_examples::{ CreateCmintData, CreateTokenAccountData, MintToCTokenData, ID, MINT_AUTHORITY_SEED, MINT_SIGNER_SEED, @@ -49,7 +49,7 @@ async fn test_mint_to_ctoken() { let instruction_data = [vec![2u8], create_token_account_data.try_to_vec().unwrap()].concat(); - use light_ctoken_sdk::ctoken::{config_pda, rent_sponsor_pda}; + use light_token_sdk::token::{config_pda, rent_sponsor_pda}; let config = config_pda(); let rent_sponsor = rent_sponsor_pda(); @@ -62,7 +62,7 @@ async fn test_mint_to_ctoken() { AccountMeta::new_readonly(config, false), AccountMeta::new_readonly(Pubkey::default(), false), // system_program AccountMeta::new(rent_sponsor, false), - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), // token_program + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), // token_program ], data: instruction_data, }; @@ -200,12 +200,12 @@ async fn test_mint_to_ctoken_invoke_signed() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using the PDA mint_signer - let compression_address = light_ctoken_sdk::ctoken::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_cmint_compressed_address( &mint_signer_pda, &address_tree.tree, ); - let mint_pda = light_ctoken_sdk::ctoken::find_cmint_address(&mint_signer_pda).0; + let mint_pda = light_token_sdk::token::find_cmint_address(&mint_signer_pda).0; let rpc_result = rpc .get_validity_proof( @@ -222,7 +222,7 @@ async fn test_mint_to_ctoken_invoke_signed() { let compressed_token_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); - let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); + let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); // Step 1: Create compressed mint with PDA authority using wrapper program (discriminator 14) { @@ -284,7 +284,7 @@ async fn test_mint_to_ctoken_invoke_signed() { let instruction_data = [vec![2u8], create_token_account_data.try_to_vec().unwrap()].concat(); - use light_ctoken_sdk::ctoken::{config_pda, rent_sponsor_pda}; + use light_token_sdk::token::{config_pda, rent_sponsor_pda}; let config = config_pda(); let rent_sponsor = rent_sponsor_pda(); @@ -297,7 +297,7 @@ async fn test_mint_to_ctoken_invoke_signed() { AccountMeta::new_readonly(config, false), AccountMeta::new_readonly(Pubkey::default(), false), // system_program AccountMeta::new(rent_sponsor, false), - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), ], data: instruction_data, }; @@ -363,7 +363,7 @@ async fn test_mint_to_ctoken_invoke_signed() { // for invoke_signed (the wrapper program signs via CPI) let compressed_token_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); - let default_pubkeys = light_ctoken_sdk::utils::CTokenDefaultAccounts::default(); + let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer.rs similarity index 95% rename from sdk-tests/sdk-ctoken-test/tests/test_transfer.rs rename to sdk-tests/sdk-light-token-test/tests/test_transfer.rs index 3068975a15..0e1a8e261d 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer.rs @@ -4,8 +4,8 @@ mod shared; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_ctoken_sdk::ctoken::CTOKEN_PROGRAM_ID; use light_program_test::{LightProgramTest, ProgramTestConfig}; +use light_token_sdk::token::LIGHT_TOKEN_PROGRAM_ID; use native_ctoken_examples::{InstructionType, TransferData, ID, TOKEN_ACCOUNT_SEED}; use shared::*; use solana_sdk::{ @@ -50,7 +50,7 @@ async fn test_ctoken_transfer_invoke() { AccountMeta::new(source_ata, false), AccountMeta::new(dest_ata, false), AccountMeta::new_readonly(source_owner, true), - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), ], data: instruction_data, }; @@ -107,7 +107,7 @@ async fn test_ctoken_transfer_invoke_signed() { AccountMeta::new(source_ata, false), AccountMeta::new(dest_ata, false), AccountMeta::new_readonly(pda_owner, false), // PDA authority, not signer - AccountMeta::new_readonly(CTOKEN_PROGRAM_ID, false), + AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), ], data: instruction_data, }; diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer_checked.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs similarity index 93% rename from sdk-tests/sdk-ctoken-test/tests/test_transfer_checked.rs rename to sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs index c2baa8cb8a..757db21c45 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer_checked.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs @@ -4,16 +4,16 @@ mod shared; use anchor_spl::token::{spl_token, Mint}; use borsh::{BorshDeserialize, BorshSerialize}; use light_client::rpc::Rpc; -use light_token_interface::state::Token; -use light_ctoken_sdk::{ - ctoken::{derive_ctoken_ata, CreateAssociatedCTokenAccount, TransferSplToCtoken}, - spl_interface::{find_spl_interface_pda_with_index, CreateSplInterfacePda}, -}; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{ mint_2022::{create_mint_22_with_extensions, create_token_22_account, mint_spl_tokens_22}, spl::{create_token_account, mint_spl_tokens}, }; +use light_token_interface::state::Token; +use light_token_sdk::{ + ctoken::{derive_token_ata, CreateAssociatedCTokenAccount, TransferSplToToken}, + spl_interface::{find_spl_interface_pda_with_index, CreateSplInterfacePda}, +}; use native_ctoken_examples::{InstructionType, TransferCheckedData, ID}; use shared::*; use solana_sdk::{ @@ -96,8 +96,8 @@ async fn test_ctoken_transfer_checked_spl_mint() { let source_owner = payer.pubkey(); let dest_owner = Pubkey::new_unique(); - let (source_ata, _) = derive_ctoken_ata(&source_owner, &mint); - let (dest_ata, _) = derive_ctoken_ata(&dest_owner, &mint); + let (source_ata, _) = derive_token_ata(&source_owner, &mint); + let (dest_ata, _) = derive_token_ata(&dest_owner, &mint); let create_source_ata = CreateAssociatedCTokenAccount::new(payer.pubkey(), source_owner, mint) .instruction() @@ -117,7 +117,7 @@ async fn test_ctoken_transfer_checked_spl_mint() { // Transfer SPL tokens to source cToken ATA let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); - let transfer_to_ctoken = TransferSplToCtoken { + let transfer_to_ctoken = TransferSplToToken { amount: 1000, spl_interface_pda_bump, decimals, @@ -144,7 +144,7 @@ async fn test_ctoken_transfer_checked_spl_mint() { let mut instruction_data = vec![InstructionType::CTokenTransferCheckedInvoke as u8]; transfer_data.serialize(&mut instruction_data).unwrap(); - let ctoken_program = light_ctoken_sdk::ctoken::CTOKEN_PROGRAM_ID; + let ctoken_program = light_token_sdk::token::LIGHT_TOKEN_PROGRAM_ID; let instruction = Instruction { program_id: ID, accounts: vec![ @@ -193,10 +193,10 @@ async fn test_ctoken_transfer_checked_t22_mint() { let source_owner = payer.pubkey(); let dest_owner = Pubkey::new_unique(); - let (source_ata, _) = derive_ctoken_ata(&source_owner, &mint); - let (dest_ata, _) = derive_ctoken_ata(&dest_owner, &mint); + let (source_ata, _) = derive_token_ata(&source_owner, &mint); + let (dest_ata, _) = derive_token_ata(&dest_owner, &mint); - use light_ctoken_sdk::ctoken::CompressibleParams; + use light_token_sdk::token::CompressibleParams; let compressible_params = CompressibleParams { compression_only: true, ..Default::default() @@ -222,7 +222,7 @@ async fn test_ctoken_transfer_checked_t22_mint() { // Transfer T22 tokens to source cToken ATA (use restricted=true for mints with restricted extensions) let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, true); - let transfer_to_ctoken = TransferSplToCtoken { + let transfer_to_ctoken = TransferSplToToken { amount: 1000, spl_interface_pda_bump, decimals, @@ -249,7 +249,7 @@ async fn test_ctoken_transfer_checked_t22_mint() { let mut instruction_data = vec![InstructionType::CTokenTransferCheckedInvoke as u8]; transfer_data.serialize(&mut instruction_data).unwrap(); - let ctoken_program = light_ctoken_sdk::ctoken::CTOKEN_PROGRAM_ID; + let ctoken_program = light_token_sdk::token::LIGHT_TOKEN_PROGRAM_ID; let instruction = Instruction { program_id: ID, accounts: vec![ @@ -310,7 +310,7 @@ async fn test_ctoken_transfer_checked_cmint() { let mut instruction_data = vec![InstructionType::CTokenTransferCheckedInvoke as u8]; transfer_data.serialize(&mut instruction_data).unwrap(); - let ctoken_program = light_ctoken_sdk::ctoken::CTOKEN_PROGRAM_ID; + let ctoken_program = light_token_sdk::token::LIGHT_TOKEN_PROGRAM_ID; let instruction = Instruction { program_id: ID, accounts: vec![ diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs similarity index 97% rename from sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs rename to sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs index 5343835a8d..4c0861a9ea 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer_interface.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs @@ -4,15 +4,15 @@ mod shared; use borsh::BorshSerialize; use light_client::rpc::Rpc; -use light_ctoken_sdk::{ - ctoken::{derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount}, - spl_interface::find_spl_interface_pda_with_index, -}; -use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::spl::{ create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, }; +use light_token_sdk::{ + ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, + spl_interface::find_spl_interface_pda_with_index, +}; +use light_token_types::CPI_AUTHORITY_PDA; use native_ctoken_examples::{TransferInterfaceData, ID, TRANSFER_INTERFACE_AUTHORITY_SEED}; use solana_sdk::{ instruction::{AccountMeta, Instruction}, @@ -74,7 +74,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let ctoken_account = derive_ctoken_ata(&recipient.pubkey(), &mint).0; + let ctoken_account = derive_token_ata(&recipient.pubkey(), &mint).0; // Get token pool PDA let (spl_interface_pda, spl_interface_pda_bump) = @@ -167,7 +167,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let ctoken_account = derive_ctoken_ata(&owner.pubkey(), &mint).0; + let ctoken_account = derive_token_ata(&owner.pubkey(), &mint).0; // Fund CToken via temporary SPL account let temp_spl_keypair = Keypair::new(); @@ -303,7 +303,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let sender_ctoken = derive_ctoken_ata(&sender.pubkey(), &mint).0; + let sender_ctoken = derive_token_ata(&sender.pubkey(), &mint).0; // Create recipient CToken ATA let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) @@ -312,7 +312,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let recipient_ctoken = derive_ctoken_ata(&recipient.pubkey(), &mint).0; + let recipient_ctoken = derive_token_ata(&recipient.pubkey(), &mint).0; // Fund sender CToken via SPL let temp_spl_keypair = Keypair::new(); @@ -477,7 +477,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke_signed() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let ctoken_account = derive_ctoken_ata(&recipient.pubkey(), &mint).0; + let ctoken_account = derive_token_ata(&recipient.pubkey(), &mint).0; let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); @@ -568,7 +568,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { .unwrap(); // Create CToken ATA owned by PDA - let (ctoken_account, bump) = derive_ctoken_ata(&authority_pda, &mint); + let (ctoken_account, bump) = derive_token_ata(&authority_pda, &mint); let instruction = CreateAssociatedCTokenAccount { idempotent: false, bump, @@ -713,7 +713,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { let transfer_amount = 5000u64; // Create source CToken ATA owned by PDA - let (source_ctoken, bump) = derive_ctoken_ata(&authority_pda, &mint); + let (source_ctoken, bump) = derive_token_ata(&authority_pda, &mint); let instruction = CreateAssociatedCTokenAccount { idempotent: false, bump, @@ -740,7 +740,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let dest_ctoken = derive_ctoken_ata(&recipient.pubkey(), &mint).0; + let dest_ctoken = derive_token_ata(&recipient.pubkey(), &mint).0; // Fund source CToken via temporary SPL account let temp_spl_keypair = Keypair::new(); diff --git a/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs similarity index 95% rename from sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs rename to sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs index b981506832..fa7f8e49d5 100644 --- a/sdk-tests/sdk-ctoken-test/tests/test_transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs @@ -1,20 +1,20 @@ -// Tests for TransferSplToCtokenCpi and TransferCTokenToSplCpi +// Tests for TransferSplToTokenCpi and TransferTokenToSplCpi mod shared; use borsh::BorshSerialize; use light_client::rpc::Rpc; -use light_ctoken_sdk::{ - ctoken::{derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount}, - spl_interface::find_spl_interface_pda_with_index, -}; -use light_token_types::CPI_AUTHORITY_PDA; use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::spl::{ create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, }; +use light_token_sdk::{ + ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, + spl_interface::find_spl_interface_pda_with_index, +}; +use light_token_types::CPI_AUTHORITY_PDA; use native_ctoken_examples::{ - TransferCTokenToSplData, TransferSplToCtokenData, ID, TRANSFER_AUTHORITY_SEED, + TransferSplToTokenData, TransferTokenToSplData, ID, TRANSFER_AUTHORITY_SEED, }; use solana_sdk::{ instruction::{AccountMeta, Instruction}, @@ -23,7 +23,7 @@ use solana_sdk::{ signer::Signer, }; -/// Test transferring SPL tokens to CToken using TransferSplToCtokenCpi::invoke() +/// Test transferring SPL tokens to CToken using TransferSplToTokenCpi::invoke() #[tokio::test] async fn test_spl_to_ctoken_invoke() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -73,7 +73,7 @@ async fn test_spl_to_ctoken_invoke() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let ctoken_account = derive_ctoken_ata(&recipient.pubkey(), &mint).0; + let ctoken_account = derive_token_ata(&recipient.pubkey(), &mint).0; // Get initial balances use spl_token_2022::pod::PodAccount; @@ -95,7 +95,7 @@ async fn test_spl_to_ctoken_invoke() { let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Build wrapper instruction for SPL to CToken transfer - let data = TransferSplToCtokenData { + let data = TransferSplToTokenData { amount: transfer_amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, @@ -161,7 +161,7 @@ async fn test_spl_to_ctoken_invoke() { println!("SPL to CToken invoke test passed"); } -/// Test transferring CToken to SPL tokens using TransferCTokenToSplCpi::invoke() +/// Test transferring CToken to SPL tokens using TransferTokenToSplCpi::invoke() #[tokio::test] async fn test_ctoken_to_spl_invoke() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -195,7 +195,7 @@ async fn test_ctoken_to_spl_invoke() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let ctoken_account = derive_ctoken_ata(&owner.pubkey(), &mint).0; + let ctoken_account = derive_token_ata(&owner.pubkey(), &mint).0; // Create a temporary SPL account to mint tokens then transfer to ctoken let temp_spl_account_keypair = Keypair::new(); @@ -222,7 +222,7 @@ async fn test_ctoken_to_spl_invoke() { let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); { - let data = TransferSplToCtokenData { + let data = TransferSplToTokenData { amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, @@ -260,7 +260,7 @@ async fn test_ctoken_to_spl_invoke() { assert_eq!(u64::from(ctoken_state.amount), amount); // Now test CToken to SPL transfer - let data = TransferCTokenToSplData { + let data = TransferTokenToSplData { amount: transfer_amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, @@ -385,7 +385,7 @@ async fn test_spl_to_ctoken_invoke_signed() { rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) .await .unwrap(); - let ctoken_account = derive_ctoken_ata(&recipient.pubkey(), &mint).0; + let ctoken_account = derive_token_ata(&recipient.pubkey(), &mint).0; // Get SPL interface PDA let (spl_interface_pda, spl_interface_pda_bump) = @@ -395,7 +395,7 @@ async fn test_spl_to_ctoken_invoke_signed() { let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Build wrapper instruction for SPL to CToken transfer with PDA authority - let data = TransferSplToCtokenData { + let data = TransferSplToTokenData { amount: transfer_amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, @@ -484,7 +484,7 @@ async fn test_ctoken_to_spl_invoke_signed() { .unwrap(); // Create ctoken ATA owned by the PDA - let (ctoken_account, bump) = derive_ctoken_ata(&authority_pda, &mint); + let (ctoken_account, bump) = derive_token_ata(&authority_pda, &mint); let instruction = CreateAssociatedCTokenAccount { idempotent: false, bump, @@ -535,7 +535,7 @@ async fn test_ctoken_to_spl_invoke_signed() { let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); { - let data = TransferSplToCtokenData { + let data = TransferSplToTokenData { amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, @@ -573,7 +573,7 @@ async fn test_ctoken_to_spl_invoke_signed() { assert_eq!(u64::from(ctoken_state.amount), amount); // Now test CToken to SPL transfer with PDA authority - let data = TransferCTokenToSplData { + let data = TransferTokenToSplData { amount: transfer_amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, diff --git a/sdk-tests/sdk-token-test/Cargo.toml b/sdk-tests/sdk-token-test/Cargo.toml index 4b4aaa63dc..c866c55d14 100644 --- a/sdk-tests/sdk-token-test/Cargo.toml +++ b/sdk-tests/sdk-token-test/Cargo.toml @@ -18,20 +18,20 @@ cpi = ["no-entrypoint"] test-sbf = ["profile-program"] default = [] profile-program = [ - "light-ctoken-sdk/profile-program", + "light-token-sdk/profile-program", "light-program-profiler/profile-program", "light-compressed-account/profile-program", "light-token-interface/profile-program", ] profile-heap = [ - "light-ctoken-sdk/profile-heap", + "light-token-sdk/profile-heap", "light-program-profiler/profile-heap", "light-compressed-account/profile-heap", "light-token-interface/profile-heap", ] [dependencies] -light-ctoken-sdk = { workspace = true, features = ["anchor", "cpi-context", "v1"] } +light-token-sdk = { workspace = true, features = ["anchor", "cpi-context", "v1"] } light-token-types = { workspace = true } anchor-lang = { workspace = true } light-hasher = { workspace = true } diff --git a/sdk-tests/sdk-token-test/src/ctoken_pda/create_pda.rs b/sdk-tests/sdk-token-test/src/ctoken_pda/create_pda.rs index 5f4615ec8e..baefbfc80c 100644 --- a/sdk-tests/sdk-token-test/src/ctoken_pda/create_pda.rs +++ b/sdk-tests/sdk-token-test/src/ctoken_pda/create_pda.rs @@ -1,5 +1,4 @@ use anchor_lang::prelude::*; -use light_ctoken_sdk::ValidityProof; use light_sdk::{ account::LightAccount, cpi::{ @@ -7,6 +6,7 @@ use light_sdk::{ InvokeLightSystemProgram, LightCpiInstruction, }, }; +use light_token_sdk::ValidityProof; use crate::process_update_deposit::CompressedEscrowPda; diff --git a/sdk-tests/sdk-token-test/src/ctoken_pda/mint.rs b/sdk-tests/sdk-token-test/src/ctoken_pda/mint.rs index 18314a1e2a..7b12e5a950 100644 --- a/sdk-tests/sdk-token-test/src/ctoken_pda/mint.rs +++ b/sdk-tests/sdk-token-test/src/ctoken_pda/mint.rs @@ -1,11 +1,11 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; +use light_sdk::cpi::v2::CpiAccounts; use light_token_interface::instructions::mint_action::{ MintActionCompressedInstructionData, MintToCompressedAction, UpdateAuthority, }; -use light_ctoken_sdk::compressed_token::{ +use light_token_sdk::compressed_token::{ ctoken_instruction::CTokenInstruction, mint_action::MintActionCpiWriteAccounts, }; -use light_sdk::cpi::v2::CpiAccounts; use super::CTokenPda; use crate::ChainedCtokenInstructionData; diff --git a/sdk-tests/sdk-token-test/src/ctoken_pda/processor.rs b/sdk-tests/sdk-token-test/src/ctoken_pda/processor.rs index 78560a5d0e..58a5a24851 100644 --- a/sdk-tests/sdk-token-test/src/ctoken_pda/processor.rs +++ b/sdk-tests/sdk-token-test/src/ctoken_pda/processor.rs @@ -1,5 +1,5 @@ use anchor_lang::prelude::*; -use light_ctoken_sdk::ValidityProof; +use light_token_sdk::ValidityProof; use super::{create_pda::process_create_escrow_pda, mint::process_mint_action, CTokenPda}; use crate::ChainedCtokenInstructionData; diff --git a/sdk-tests/sdk-token-test/src/lib.rs b/sdk-tests/sdk-token-test/src/lib.rs index b7cf1c7b51..560cb7c44e 100644 --- a/sdk-tests/sdk-token-test/src/lib.rs +++ b/sdk-tests/sdk-token-test/src/lib.rs @@ -3,11 +3,11 @@ #![allow(deprecated)] use anchor_lang::prelude::*; -use light_ctoken_sdk::{ +use light_sdk::instruction::{PackedAddressTreeInfo, ValidityProof as LightValidityProof}; +use light_token_sdk::{ compressed_token::{batch_compress::Recipient, TokenAccountMeta}, ValidityProof, }; -use light_sdk::instruction::{PackedAddressTreeInfo, ValidityProof as LightValidityProof}; mod ctoken_pda; pub mod mint_compressed_tokens_cpi_write; @@ -126,8 +126,8 @@ pub mod sdk_token_test { /// This decompresses the entire balance to destination ctoken accounts pub fn decompress_full_cpi<'info>( ctx: Context<'_, '_, '_, 'info, Generic<'info>>, - indices: Vec, - validity_proof: light_ctoken_sdk::ValidityProof, + indices: Vec, + validity_proof: light_token_sdk::ValidityProof, ) -> Result<()> { process_decompress_full_cpi_context(ctx, indices, validity_proof, None) } @@ -136,8 +136,8 @@ pub mod sdk_token_test { /// This decompresses the entire balance to destination ctoken accounts pub fn decompress_full_cpi_with_cpi_context<'info>( ctx: Context<'_, '_, '_, 'info, Generic<'info>>, - indices: Vec, - validity_proof: light_ctoken_sdk::ValidityProof, + indices: Vec, + validity_proof: light_token_sdk::ValidityProof, params: Option, ) -> Result<()> { process_decompress_full_cpi_context(ctx, indices, validity_proof, params) diff --git a/sdk-tests/sdk-token-test/src/mint_compressed_tokens_cpi_write.rs b/sdk-tests/sdk-token-test/src/mint_compressed_tokens_cpi_write.rs index d891b6258f..1872e830ab 100644 --- a/sdk-tests/sdk-token-test/src/mint_compressed_tokens_cpi_write.rs +++ b/sdk-tests/sdk-token-test/src/mint_compressed_tokens_cpi_write.rs @@ -3,7 +3,7 @@ use light_token_interface::instructions::mint_action::{ CompressedMintWithContext, MintActionCompressedInstructionData, MintToCompressedAction, Recipient, }; -use light_ctoken_sdk::compressed_token::{ +use light_token_sdk::compressed_token::{ ctoken_instruction::CTokenInstruction, mint_action::MintActionCpiWriteAccounts, transfer2::Transfer2CpiAccounts, }; diff --git a/sdk-tests/sdk-token-test/src/pda_ctoken/create_pda.rs b/sdk-tests/sdk-token-test/src/pda_ctoken/create_pda.rs index b19fe36f7c..1a3f93d4ea 100644 --- a/sdk-tests/sdk-token-test/src/pda_ctoken/create_pda.rs +++ b/sdk-tests/sdk-token-test/src/pda_ctoken/create_pda.rs @@ -1,5 +1,4 @@ use anchor_lang::prelude::*; -use light_ctoken_sdk::ValidityProof; use light_sdk::{ account::LightAccount, cpi::{ @@ -8,6 +7,7 @@ use light_sdk::{ }, }; use light_sdk_types::cpi_context_write::CpiContextWriteAccounts; +use light_token_sdk::ValidityProof; use crate::{process_update_deposit::CompressedEscrowPda, LIGHT_CPI_SIGNER}; diff --git a/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs b/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs index bf34987195..d755acd0f0 100644 --- a/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs +++ b/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs @@ -1,12 +1,11 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; +use light_sdk_types::cpi_accounts::v2::CpiAccounts; use light_token_interface::instructions::mint_action::{ - MintActionCompressedInstructionData, MintToTokenAction, MintToCompressedAction, - UpdateAuthority, + MintActionCompressedInstructionData, MintToCompressedAction, MintToTokenAction, UpdateAuthority, }; -use light_ctoken_sdk::compressed_token::{ +use light_token_sdk::compressed_token::{ ctoken_instruction::CTokenInstruction, mint_action::MintActionCpiAccounts, }; -use light_sdk_types::cpi_accounts::v2::CpiAccounts; use super::{processor::ChainedCtokenInstructionData, PdaCToken}; diff --git a/sdk-tests/sdk-token-test/src/pda_ctoken/processor.rs b/sdk-tests/sdk-token-test/src/pda_ctoken/processor.rs index 100bbc1c5d..f22dd0c2ae 100644 --- a/sdk-tests/sdk-token-test/src/pda_ctoken/processor.rs +++ b/sdk-tests/sdk-token-test/src/pda_ctoken/processor.rs @@ -1,6 +1,6 @@ use anchor_lang::prelude::*; use light_token_interface::instructions::mint_action::{CompressedMintWithContext, Recipient}; -use light_ctoken_sdk::ValidityProof; +use light_token_sdk::ValidityProof; use super::{ create_pda::process_create_escrow_pda_with_cpi_context, mint::process_mint_action, PdaCToken, diff --git a/sdk-tests/sdk-token-test/src/process_batch_compress_tokens.rs b/sdk-tests/sdk-token-test/src/process_batch_compress_tokens.rs index 88ec1671b8..2543e76b24 100644 --- a/sdk-tests/sdk-token-test/src/process_batch_compress_tokens.rs +++ b/sdk-tests/sdk-token-test/src/process_batch_compress_tokens.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_sdk::compressed_token::batch_compress::{ +use light_token_sdk::compressed_token::batch_compress::{ create_batch_compress_instruction, BatchCompressInputs, Recipient, }; use light_token_types::account_infos::BatchCompressAccountInfos; diff --git a/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs b/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs index de1e3cc516..bd6214f176 100644 --- a/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs +++ b/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs @@ -1,5 +1,6 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_sdk::{ +use light_sdk_types::cpi_accounts::{v2::CpiAccounts, CpiAccountsConfig}; +use light_token_sdk::{ compressed_token::{ transfer2::{ account_metas::Transfer2AccountsMetaConfig, create_transfer2_instruction, @@ -9,7 +10,6 @@ use light_ctoken_sdk::{ }, ctoken::CloseCTokenAccount, }; -use light_sdk_types::cpi_accounts::{v2::CpiAccounts, CpiAccountsConfig}; use crate::Generic; diff --git a/sdk-tests/sdk-token-test/src/process_compress_tokens.rs b/sdk-tests/sdk-token-test/src/process_compress_tokens.rs index 1cb3743252..a416cebaca 100644 --- a/sdk-tests/sdk-token-test/src/process_compress_tokens.rs +++ b/sdk-tests/sdk-token-test/src/process_compress_tokens.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_sdk::compressed_token::transfer::{ +use light_token_sdk::compressed_token::transfer::{ instruction::{compress, CompressInputs}, TransferAccountInfos, }; diff --git a/sdk-tests/sdk-token-test/src/process_create_compressed_account.rs b/sdk-tests/sdk-token-test/src/process_create_compressed_account.rs index 6b5668aad5..09bbfa8a1f 100644 --- a/sdk-tests/sdk-token-test/src/process_create_compressed_account.rs +++ b/sdk-tests/sdk-token-test/src/process_create_compressed_account.rs @@ -1,9 +1,5 @@ use anchor_lang::{prelude::*, solana_program::log::sol_log_compute_units}; use light_compressed_account::instruction_data::cpi_context::CompressedCpiContext; -use light_ctoken_sdk::compressed_token::{ - transfer::instruction::{TransferConfig, TransferInputs}, - CTokenAccount, TokenAccountMeta, -}; use light_sdk::{ account::LightAccount, cpi::{ @@ -14,6 +10,10 @@ use light_sdk::{ light_account_checks::AccountInfoTrait, LightDiscriminator, LightHasher, }; +use light_token_sdk::compressed_token::{ + transfer::instruction::{TransferConfig, TransferInputs}, + CTokenAccount, TokenAccountMeta, +}; #[event] #[derive(Clone, Debug, Default, LightHasher, LightDiscriminator)] @@ -96,7 +96,7 @@ pub fn deposit_tokens<'a, 'info>( amount, }; let instruction = - light_ctoken_sdk::compressed_token::transfer::instruction::transfer(transfer_inputs) + light_token_sdk::compressed_token::transfer::instruction::transfer(transfer_inputs) .unwrap(); // msg!("instruction {:?}", instruction); // We can use the property that account infos don't have to be in order if you use diff --git a/sdk-tests/sdk-token-test/src/process_create_ctoken_with_compress_to_pubkey.rs b/sdk-tests/sdk-token-test/src/process_create_ctoken_with_compress_to_pubkey.rs index 23d00cab18..51548db252 100644 --- a/sdk-tests/sdk-token-test/src/process_create_ctoken_with_compress_to_pubkey.rs +++ b/sdk-tests/sdk-token-test/src/process_create_ctoken_with_compress_to_pubkey.rs @@ -1,6 +1,6 @@ use anchor_lang::{prelude::*, solana_program::program::invoke_signed}; use light_token_interface::instructions::extensions::CompressToPubkey; -use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; +use light_token_sdk::token::{CompressibleParams, CreateTokenAccount}; use crate::Generic; @@ -30,7 +30,7 @@ pub fn process_create_ctoken_with_compress_to_pubkey<'info>( compression_only: false, }; - let instruction = CreateCTokenAccount::new( + let instruction = CreateTokenAccount::new( *ctx.accounts.signer.key, token_account_pubkey, mint, diff --git a/sdk-tests/sdk-token-test/src/process_decompress_full_cpi_context.rs b/sdk-tests/sdk-token-test/src/process_decompress_full_cpi_context.rs index 347df552cd..bfe18d49ae 100644 --- a/sdk-tests/sdk-token-test/src/process_decompress_full_cpi_context.rs +++ b/sdk-tests/sdk-token-test/src/process_decompress_full_cpi_context.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_sdk::compressed_token::{ +use light_token_sdk::compressed_token::{ decompress_full::{decompress_full_ctoken_accounts_with_indices, DecompressFullIndices}, transfer2::Transfer2CpiAccounts, }; @@ -16,7 +16,7 @@ use crate::{ pub fn process_decompress_full_cpi_context<'info>( ctx: Context<'_, '_, '_, 'info, Generic<'info>>, indices: Vec, - validity_proof: light_ctoken_sdk::ValidityProof, + validity_proof: light_token_sdk::ValidityProof, params: Option, ) -> Result<()> { // Parse CPI accounts following the established pattern diff --git a/sdk-tests/sdk-token-test/src/process_decompress_tokens.rs b/sdk-tests/sdk-token-test/src/process_decompress_tokens.rs index 05a4c63b6f..1afb82563b 100644 --- a/sdk-tests/sdk-token-test/src/process_decompress_tokens.rs +++ b/sdk-tests/sdk-token-test/src/process_decompress_tokens.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::{ transfer::{ instruction::{decompress, DecompressInputs}, diff --git a/sdk-tests/sdk-token-test/src/process_four_invokes.rs b/sdk-tests/sdk-token-test/src/process_four_invokes.rs index 55402243d7..ab64db5865 100644 --- a/sdk-tests/sdk-token-test/src/process_four_invokes.rs +++ b/sdk-tests/sdk-token-test/src/process_four_invokes.rs @@ -1,14 +1,14 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; use light_compressed_account::instruction_data::cpi_context::CompressedCpiContext; -use light_ctoken_sdk::compressed_token::{ - transfer::instruction::{compress, transfer, CompressInputs, TransferConfig, TransferInputs}, - CTokenAccount, TokenAccountMeta, -}; use light_sdk::{ cpi::v2::CpiAccounts, instruction::ValidityProof as LightValidityProof, light_account_checks::AccountInfoTrait, }; use light_sdk_types::cpi_accounts::CpiAccountsConfig; +use light_token_sdk::compressed_token::{ + transfer::instruction::{compress, transfer, CompressInputs, TransferConfig, TransferInputs}, + CTokenAccount, TokenAccountMeta, +}; use crate::{process_update_deposit::process_update_escrow_pda, PdaParams}; diff --git a/sdk-tests/sdk-token-test/src/process_four_transfer2.rs b/sdk-tests/sdk-token-test/src/process_four_transfer2.rs index f628d8249f..c9c8cc9891 100644 --- a/sdk-tests/sdk-token-test/src/process_four_transfer2.rs +++ b/sdk-tests/sdk-token-test/src/process_four_transfer2.rs @@ -1,12 +1,4 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_token_interface::instructions::transfer2::MultiInputTokenDataWithContext; -use light_ctoken_sdk::compressed_token::{ - transfer2::{ - account_metas::Transfer2AccountsMetaConfig, create_transfer2_instruction, Transfer2Config, - Transfer2Inputs, - }, - CTokenAccount2, -}; use light_sdk::{ account::LightAccount, cpi::{v2::LightSystemProgramCpi, InvokeLightSystemProgram, LightCpiInstruction}, @@ -16,6 +8,14 @@ use light_sdk_types::{ cpi_accounts::{v2::CpiAccounts as CpiAccountsSmall, CpiAccountsConfig}, cpi_context_write::CpiContextWriteAccounts, }; +use light_token_interface::instructions::transfer2::MultiInputTokenDataWithContext; +use light_token_sdk::compressed_token::{ + transfer2::{ + account_metas::Transfer2AccountsMetaConfig, create_transfer2_instruction, Transfer2Config, + Transfer2Inputs, + }, + CTokenAccount2, +}; use crate::{process_update_deposit::CompressedEscrowPda, PdaParams, LIGHT_CPI_SIGNER}; diff --git a/sdk-tests/sdk-token-test/src/process_transfer_tokens.rs b/sdk-tests/sdk-token-test/src/process_transfer_tokens.rs index 0e3310bbe2..670c2793b5 100644 --- a/sdk-tests/sdk-token-test/src/process_transfer_tokens.rs +++ b/sdk-tests/sdk-token-test/src/process_transfer_tokens.rs @@ -1,5 +1,5 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::{ transfer::{ instruction::{transfer, TransferInputs}, diff --git a/sdk-tests/sdk-token-test/src/process_update_deposit.rs b/sdk-tests/sdk-token-test/src/process_update_deposit.rs index ca82da5842..39d64bd816 100644 --- a/sdk-tests/sdk-token-test/src/process_update_deposit.rs +++ b/sdk-tests/sdk-token-test/src/process_update_deposit.rs @@ -1,10 +1,6 @@ use anchor_lang::prelude::*; use light_batched_merkle_tree::queue::BatchedQueueAccount; use light_compressed_account::instruction_data::cpi_context::CompressedCpiContext; -use light_ctoken_sdk::compressed_token::{ - transfer::instruction::{TransferConfig, TransferInputs}, - CTokenAccount, TokenAccountMeta, -}; use light_sdk::{ account::LightAccount, cpi::{ @@ -16,6 +12,10 @@ use light_sdk::{ LightDiscriminator, LightHasher, }; use light_sdk_types::cpi_accounts::CpiAccountsConfig; +use light_token_sdk::compressed_token::{ + transfer::instruction::{TransferConfig, TransferInputs}, + CTokenAccount, TokenAccountMeta, +}; use crate::{PdaParams, TokenParams}; @@ -105,7 +105,7 @@ fn merge_escrow_token_accounts<'info>( amount: total_escrowed_amount, }; let instruction = - light_ctoken_sdk::compressed_token::transfer::instruction::transfer(transfer_inputs) + light_token_sdk::compressed_token::transfer::instruction::transfer(transfer_inputs) .unwrap(); let account_infos = [&[fee_payer, authority][..], remaining_accounts].concat(); @@ -195,7 +195,7 @@ pub fn transfer_tokens_to_escrow_pda<'a, 'info>( amount, }; let instruction = - light_ctoken_sdk::compressed_token::transfer::instruction::transfer(transfer_inputs) + light_token_sdk::compressed_token::transfer::instruction::transfer(transfer_inputs) .unwrap(); let account_infos = [&[cpi_accounts.fee_payer().clone()][..], remaining_accounts].concat(); diff --git a/sdk-tests/sdk-token-test/tests/ctoken_pda.rs b/sdk-tests/sdk-token-test/tests/ctoken_pda.rs index f208b35c0f..8a97c000be 100644 --- a/sdk-tests/sdk-token-test/tests/ctoken_pda.rs +++ b/sdk-tests/sdk-token-test/tests/ctoken_pda.rs @@ -1,6 +1,8 @@ use anchor_lang::{AnchorDeserialize, InstructionData, ToAccountMetas}; use light_client::indexer::Indexer; use light_compressed_account::{address::derive_address, hash_to_bn254_field_size_be}; +use light_program_test::{LightProgramTest, ProgramTestConfig, Rpc, RpcError}; +use light_sdk::instruction::{PackedAccounts, SystemAccountMetaConfig}; use light_token_interface::{ instructions::{ extensions::token_metadata::TokenMetadataInstructionData, @@ -9,12 +11,10 @@ use light_token_interface::{ state::{extensions::AdditionalMetadata, CompressedMintMetadata}, LIGHT_TOKEN_PROGRAM_ID, }; -use light_ctoken_sdk::compressed_token::create_compressed_mint::{ +use light_token_sdk::compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }; use light_token_types::CPI_AUTHORITY_PDA; -use light_program_test::{LightProgramTest, ProgramTestConfig, Rpc, RpcError}; -use light_sdk::instruction::{PackedAccounts, SystemAccountMetaConfig}; use sdk_token_test::{ChainedCtokenInstructionData, PdaCreationData, ID}; use solana_sdk::{ pubkey::Pubkey, diff --git a/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs b/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs index db4162b22c..b1c5118292 100644 --- a/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs +++ b/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs @@ -4,14 +4,14 @@ use anchor_lang::{AnchorDeserialize, InstructionData}; /// Test input range for multi-input tests const TEST_INPUT_RANGE: [usize; 4] = [1, 2, 3, 4]; -use light_token_interface::instructions::mint_action::{CompressedMintWithContext, Recipient}; -use light_ctoken_sdk::compressed_token::{ - create_compressed_mint::find_cmint_address, decompress_full::DecompressFullAccounts, -}; use light_program_test::{Indexer, LightProgramTest, ProgramTestConfig, Rpc}; use light_sdk::instruction::PackedAccounts; use light_test_utils::airdrop_lamports; use light_token_client::{actions::mint_action_comprehensive, instructions::mint_action::NewMint}; +use light_token_interface::instructions::mint_action::{CompressedMintWithContext, Recipient}; +use light_token_sdk::compressed_token::{ + create_compressed_mint::find_cmint_address, decompress_full::DecompressFullAccounts, +}; use sdk_token_test::mint_compressed_tokens_cpi_write::MintCompressedTokensCpiWriteParams; use solana_sdk::{ instruction::{AccountMeta, Instruction}, @@ -54,8 +54,8 @@ async fn setup_decompress_full_test(num_inputs: usize) -> (LightProgramTest, Tes .await .unwrap(); - use light_ctoken_sdk::ctoken::{ - derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount, + use light_token_sdk::token::{ + derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount, }; let mut destination_accounts = Vec::with_capacity(num_inputs); @@ -71,7 +71,7 @@ async fn setup_decompress_full_test(num_inputs: usize) -> (LightProgramTest, Tes additional_owner.pubkey() }; - let (destination_account, _) = derive_ctoken_ata(&destination_owner, &mint_pubkey); + let (destination_account, _) = derive_token_ata(&destination_owner, &mint_pubkey); let compressible_params = CompressibleParams { compressible_config: rpc @@ -240,7 +240,7 @@ async fn test_decompress_full_cpi() { .zip(ctx.destination_accounts.iter()) .zip(versions.iter()) .map(|(((token, tree_info), &dest_pubkey), &version)| { - light_ctoken_sdk::compressed_token::decompress_full::pack_for_decompress_full( + light_token_sdk::compressed_token::decompress_full::pack_for_decompress_full( token, tree_info, dest_pubkey, @@ -350,7 +350,7 @@ async fn test_decompress_full_cpi_with_context() { let address_tree_info = rpc.get_address_tree_v2(); let compressed_mint_address = - light_ctoken_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address( + light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address( &ctx.mint_seed.pubkey(), &address_tree_info.tree, ); @@ -447,7 +447,7 @@ async fn test_decompress_full_cpi_with_context() { .zip(ctx.destination_accounts.iter()) .zip(versions.iter()) .map(|(((token, tree_info), &dest_pubkey), &version)| { - light_ctoken_sdk::compressed_token::decompress_full::pack_for_decompress_full( + light_token_sdk::compressed_token::decompress_full::pack_for_decompress_full( token, tree_info, dest_pubkey, diff --git a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs index dae2863c8f..da1fa4e000 100644 --- a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs +++ b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs @@ -4,6 +4,8 @@ use anchor_lang::{ use anchor_spl::token_interface::spl_token_2022; use light_client::indexer::Indexer; use light_compressed_account::{address::derive_address, hash_to_bn254_field_size_be}; +use light_program_test::{LightProgramTest, ProgramTestConfig, Rpc, RpcError}; +use light_sdk::instruction::{PackedAccounts, SystemAccountMetaConfig}; use light_token_interface::{ instructions::{ extensions::token_metadata::TokenMetadataInstructionData, @@ -12,15 +14,13 @@ use light_token_interface::{ state::{extensions::AdditionalMetadata, CompressedMintMetadata}, LIGHT_TOKEN_PROGRAM_ID, }; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }, - ctoken::{derive_ctoken_ata, CompressibleParams, CreateAssociatedCTokenAccount}, + ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, }; use light_token_types::CPI_AUTHORITY_PDA; -use light_program_test::{LightProgramTest, ProgramTestConfig, Rpc, RpcError}; -use light_sdk::instruction::{PackedAccounts, SystemAccountMetaConfig}; use sdk_token_test::{ChainedCtokenInstructionData, PdaCreationData, ID}; use solana_sdk::{ pubkey::Pubkey, @@ -200,7 +200,7 @@ pub async fn create_mint( let (mint, _) = find_cmint_address(&mint_seed.pubkey()); // Create compressed token associated token account for the mint authority - let (token_account, _) = derive_ctoken_ata(&mint_authority.pubkey(), &mint); + let (token_account, _) = derive_token_ata(&mint_authority.pubkey(), &mint); println!("Created token_account (ATA): {:?}", token_account); let compressible_params = CompressibleParams { diff --git a/sdk-tests/sdk-token-test/tests/test.rs b/sdk-tests/sdk-token-test/tests/test.rs index a4f6bd5cac..4beff199fd 100644 --- a/sdk-tests/sdk-token-test/tests/test.rs +++ b/sdk-tests/sdk-token-test/tests/test.rs @@ -3,7 +3,13 @@ use anchor_lang::{AccountDeserialize, InstructionData}; use anchor_spl::token::TokenAccount; use light_client::indexer::CompressedTokenAccount; -use light_ctoken_sdk::{ +use light_program_test::{Indexer, LightProgramTest, ProgramTestConfig, Rpc}; +use light_sdk::instruction::PackedAccounts; +use light_test_utils::{ + spl::{create_mint_helper, create_token_account, mint_spl_tokens}, + RpcError, +}; +use light_token_sdk::{ compressed_token::{ batch_compress::{ get_batch_compress_instruction_account_metas, BatchCompressMetaConfig, Recipient, @@ -15,12 +21,6 @@ use light_ctoken_sdk::{ spl_interface::{find_spl_interface_pda_with_index, get_spl_interface_pda}, }; use light_token_types::{TokenAccountMeta, SPL_TOKEN_PROGRAM_ID}; -use light_program_test::{Indexer, LightProgramTest, ProgramTestConfig, Rpc}; -use light_sdk::instruction::PackedAccounts; -use light_test_utils::{ - spl::{create_mint_helper, create_token_account, mint_spl_tokens}, - RpcError, -}; use solana_sdk::{ instruction::Instruction, pubkey::Pubkey, diff --git a/sdk-tests/sdk-token-test/tests/test_4_invocations.rs b/sdk-tests/sdk-token-test/tests/test_4_invocations.rs index 237765410e..15385135c9 100644 --- a/sdk-tests/sdk-token-test/tests/test_4_invocations.rs +++ b/sdk-tests/sdk-token-test/tests/test_4_invocations.rs @@ -1,5 +1,14 @@ use anchor_lang::{prelude::AccountMeta, AccountDeserialize, InstructionData}; -use light_ctoken_sdk::{ +use light_program_test::{AddressWithTree, Indexer, LightProgramTest, ProgramTestConfig, Rpc}; +use light_sdk::{ + address::v1::derive_address, + instruction::{PackedAccounts, SystemAccountMetaConfig}, +}; +use light_test_utils::{ + spl::{create_mint_helper, create_token_account, mint_spl_tokens}, + RpcError, +}; +use light_token_sdk::{ compressed_token::{ transfer::account_metas::{ get_transfer_instruction_account_metas, TokenAccountsMetaConfig, @@ -10,15 +19,6 @@ use light_ctoken_sdk::{ utils::CTokenDefaultAccounts, }; use light_token_types::SPL_TOKEN_PROGRAM_ID; -use light_program_test::{AddressWithTree, Indexer, LightProgramTest, ProgramTestConfig, Rpc}; -use light_sdk::{ - address::v1::derive_address, - instruction::{PackedAccounts, SystemAccountMetaConfig}, -}; -use light_test_utils::{ - spl::{create_mint_helper, create_token_account, mint_spl_tokens}, - RpcError, -}; use solana_sdk::{ instruction::Instruction, pubkey::Pubkey, diff --git a/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs b/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs index 2c3f51b01f..e7ffa520af 100644 --- a/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs +++ b/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs @@ -1,4 +1,10 @@ use anchor_lang::{prelude::AccountMeta, InstructionData}; +use light_program_test::{AddressWithTree, Indexer, LightProgramTest, ProgramTestConfig, Rpc}; +use light_sdk::{ + address::v1::derive_address, + instruction::{PackedAccounts, PackedStateTreeInfo, SystemAccountMetaConfig}, +}; +use light_test_utils::RpcError; use light_token_interface::{ instructions::{ mint_action::{CompressedMintWithContext, Recipient}, @@ -7,7 +13,7 @@ use light_token_interface::{ state::{BaseMint, CompressedMintMetadata, ACCOUNT_TYPE_MINT}, COMPRESSED_MINT_SEED, }; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::{ create_compressed_mint::{create_compressed_mint, CreateCompressedMintInputs}, mint_to_compressed::{create_mint_to_compressed_instruction, MintToCompressedInputs}, @@ -15,12 +21,6 @@ use light_ctoken_sdk::{ ctoken::CreateAssociatedCTokenAccount, utils::CTokenDefaultAccounts, }; -use light_program_test::{AddressWithTree, Indexer, LightProgramTest, ProgramTestConfig, Rpc}; -use light_sdk::{ - address::v1::derive_address, - instruction::{PackedAccounts, PackedStateTreeInfo, SystemAccountMetaConfig}, -}; -use light_test_utils::RpcError; use solana_sdk::{ instruction::Instruction, pubkey::Pubkey, @@ -95,7 +95,7 @@ async fn create_compressed_mints_and_tokens( // Create associated token account for mint1 decompression let (token_account1_pubkey, _bump) = - light_ctoken_sdk::ctoken::derive_ctoken_ata(&payer.pubkey(), &mint1_pda); + light_token_sdk::token::derive_token_ata(&payer.pubkey(), &mint1_pda); let create_ata_instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), payer.pubkey(), mint1_pda) .instruction() diff --git a/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs b/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs index 39ae7a9ca1..5f49ebd3be 100644 --- a/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs +++ b/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs @@ -2,6 +2,9 @@ use anchor_lang::{ prelude::{AccountMeta, Pubkey}, InstructionData, }; +use light_program_test::{Indexer, LightProgramTest, ProgramTestConfig, Rpc}; +use light_sdk::instruction::{PackedAccounts, SystemAccountMetaConfig}; +use light_token_client::instructions::transfer2::create_decompress_instruction; use light_token_interface::{ instructions::mint_action::{CompressedMintWithContext, Recipient}, state::{ @@ -9,19 +12,16 @@ use light_token_interface::{ }, COMPRESSED_MINT_SEED, LIGHT_TOKEN_PROGRAM_ID, }; -use light_ctoken_sdk::{ +use light_token_sdk::{ compressed_token::{ create_compressed_mint::{create_compressed_mint, CreateCompressedMintInputs}, mint_to_compressed::{create_mint_to_compressed_instruction, MintToCompressedInputs}, }, ctoken::{ - config_pda, derive_ctoken_ata, rent_sponsor_pda, CompressibleParams, + config_pda, derive_token_ata, rent_sponsor_pda, CompressibleParams, CreateAssociatedCTokenAccount, }, }; -use light_program_test::{Indexer, LightProgramTest, ProgramTestConfig, Rpc}; -use light_sdk::instruction::{PackedAccounts, SystemAccountMetaConfig}; -use light_token_client::instructions::transfer2::create_decompress_instruction; use sdk_token_test::instruction; use serial_test::serial; use solana_sdk::{ @@ -179,7 +179,7 @@ async fn test_compress_full_and_close() { println!("✅ Minted {} compressed tokens to recipient", mint_amount); // Step 4: Create compressible associated token account for decompression - let (ctoken_ata_pubkey, bump) = derive_ctoken_ata(&recipient, &mint_pda); + let (ctoken_ata_pubkey, bump) = derive_token_ata(&recipient, &mint_pda); let compressible_params = CompressibleParams { token_account_version: TokenDataVersion::ShaFlat, pre_pay_num_epochs: 2, diff --git a/sdk-tests/sdk-token-test/tests/test_compress_to_pubkey.rs b/sdk-tests/sdk-token-test/tests/test_compress_to_pubkey.rs index 1c162165ee..a861514e5d 100644 --- a/sdk-tests/sdk-token-test/tests/test_compress_to_pubkey.rs +++ b/sdk-tests/sdk-token-test/tests/test_compress_to_pubkey.rs @@ -1,10 +1,10 @@ use anchor_lang::InstructionData; -use light_ctoken_sdk::ctoken::CTOKEN_PROGRAM_ID; use light_program_test::{ program_test::TestRpc, Indexer, LightProgramTest, ProgramTestConfig, Rpc, }; use light_sdk::instruction::PackedAccounts; use light_test_utils::spl::create_mint_helper; +use light_token_sdk::token::LIGHT_TOKEN_PROGRAM_ID; use solana_sdk::{ instruction::{AccountMeta, Instruction}, pubkey::Pubkey, @@ -53,7 +53,7 @@ async fn test_compress_to_pubkey() { )); // System program remaining_accounts.add_pre_accounts_meta(AccountMeta::new(rent_sponsor, false)); // Rent recipient remaining_accounts - .add_pre_accounts_meta(AccountMeta::new_readonly(CTOKEN_PROGRAM_ID.into(), false)); + .add_pre_accounts_meta(AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false)); let (account_metas, _, _) = remaining_accounts.to_account_metas(); let instruction_data = sdk_token_test::instruction::CreateCtokenWithCompressToPubkey { diff --git a/sdk-tests/sdk-token-test/tests/test_deposit.rs b/sdk-tests/sdk-token-test/tests/test_deposit.rs index 34bd4db502..b6662f3f12 100644 --- a/sdk-tests/sdk-token-test/tests/test_deposit.rs +++ b/sdk-tests/sdk-token-test/tests/test_deposit.rs @@ -1,13 +1,5 @@ use anchor_lang::InstructionData; use light_client::indexer::{CompressedAccount, CompressedTokenAccount, IndexerRpcConfig}; -use light_ctoken_sdk::{ - compressed_token::batch_compress::{ - get_batch_compress_instruction_account_metas, BatchCompressMetaConfig, Recipient, - }, - spl_interface::find_spl_interface_pda_with_index, - utils::CTokenDefaultAccounts, -}; -use light_token_types::{TokenAccountMeta, SPL_TOKEN_PROGRAM_ID}; use light_program_test::{AddressWithTree, Indexer, LightProgramTest, ProgramTestConfig, Rpc}; use light_sdk::{ address::v1::derive_address, @@ -17,6 +9,14 @@ use light_test_utils::{ spl::{create_mint_helper, create_token_account, mint_spl_tokens}, RpcError, }; +use light_token_sdk::{ + compressed_token::batch_compress::{ + get_batch_compress_instruction_account_metas, BatchCompressMetaConfig, Recipient, + }, + spl_interface::find_spl_interface_pda_with_index, + utils::CTokenDefaultAccounts, +}; +use light_token_types::{TokenAccountMeta, SPL_TOKEN_PROGRAM_ID}; use solana_sdk::{ instruction::{AccountMeta, Instruction}, pubkey::Pubkey, diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index dc68bb4ddd..3c21e458b0 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -37,5 +37,5 @@ light-batched-merkle-tree = { workspace = true } light-registry = { workspace = true } light-compressible = { workspace = true } anchor-lang = { workspace = true } -light-ctoken-sdk = { workspace = true } +light-token-sdk = { workspace = true } chrono = "0.4" diff --git a/xtask/src/create_ctoken_account.rs b/xtask/src/create_ctoken_account.rs index be9097d43c..6aa3363ecd 100644 --- a/xtask/src/create_ctoken_account.rs +++ b/xtask/src/create_ctoken_account.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use clap::Parser; use dirs::home_dir; use light_client::rpc::{LightClient, LightClientConfig, Rpc}; -use light_ctoken_sdk::ctoken::{CompressibleParams, CreateCTokenAccount}; +use light_token_sdk::token::{CompressibleParams, CreateTokenAccount}; use solana_sdk::{ signature::{read_keypair_file, Keypair, Signer}, transaction::Transaction, @@ -81,7 +81,7 @@ pub async fn create_ctoken_account(options: Options) -> anyhow::Result<()> { }; let create_ix = - CreateCTokenAccount::new(payer.pubkey(), account_keypair.pubkey(), mint, owner) + CreateTokenAccount::new(payer.pubkey(), account_keypair.pubkey(), mint, owner) .with_compressible(compressible_params) .instruction()?; From 11044ed53431c67c2729fac034e4a37c94beaf34 Mon Sep 17 00:00:00 2001 From: ananas Date: Tue, 13 Jan 2026 00:26:43 +0000 Subject: [PATCH 5/9] more fixes --- .github/workflows/rust.yml | 2 +- program-libs/account-checks/CLAUDE.md | 2 +- program-libs/compressible/src/config.rs | 12 +- .../tests/ctoken/shared.rs | 2 +- .../tests/mint/failing.rs | 2 +- .../tests/mint/functional.rs | 4 +- .../registry-test/tests/compressible.rs | 36 +- programs/registry/src/lib.rs | 2 +- scripts/lint.sh | 8 +- .../macros/src/compressible/instructions.rs | 4 +- .../macros/src/compressible/seed_providers.rs | 4 +- sdk-libs/program-test/src/compressible.rs | 2 +- .../src/forester/claim_forester.rs | 4 +- .../forester/compress_and_close_forester.rs | 2 +- sdk-libs/token-client/src/actions/mod.rs | 4 +- .../{ctoken_transfer.rs => transfer.rs} | 10 +- .../src/instructions/mint_action.rs | 4 +- .../compressed_token/v2/compress_and_close.rs | 12 +- .../compressed_token/v2/decompress_full.rs | 4 +- .../v2/mint_action/account_metas.rs | 2 +- .../src/compressible/decompress_runtime.rs | 2 +- sdk-libs/token-sdk/src/token/mint_to.rs | 2 +- sdk-libs/token-sdk/src/token/mod.rs | 2 +- .../token-types/src/account_infos/transfer.rs | 2 +- sdk-tests/CLAUDE.md | 4 +- .../decompress_accounts_idempotent.rs | 2 +- sdk-tests/sdk-light-token-test/Cargo.lock | 8546 ----------------- sdk-tests/sdk-light-token-test/README.md | 8 +- .../tests/test_mint_to_ctoken.rs | 2 +- sdk-tests/sdk-token-test/CLAUDE.md | 6 +- .../process_decompress_full_cpi_context.rs | 4 +- 31 files changed, 78 insertions(+), 8624 deletions(-) rename sdk-libs/token-client/src/actions/{ctoken_transfer.rs => transfer.rs} (90%) delete mode 100644 sdk-tests/sdk-light-token-test/Cargo.lock diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0aa164e2dc..1059723c6c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -59,7 +59,7 @@ jobs: cargo test -p light-hash-set --all-features cargo test -p batched-merkle-tree-test -- --skip test_simulate_transactions --skip test_e2e cargo test -p light-concurrent-merkle-tree - cargo test -p light-ctoken-interface --features poseidon + cargo test -p light-token-interface --features poseidon cargo test -p light-compressible --all-features - name: program-libs-slow packages: light-bloom-filter light-indexed-merkle-tree batched-merkle-tree-test diff --git a/program-libs/account-checks/CLAUDE.md b/program-libs/account-checks/CLAUDE.md index 1b79608e64..c807bb00b4 100644 --- a/program-libs/account-checks/CLAUDE.md +++ b/program-libs/account-checks/CLAUDE.md @@ -16,7 +16,7 @@ - `light-sdk` - Core SDK account validation utilities - `light-sdk-pinocchio` - Pinocchio-specific SDK validation - `light-sdk-types` - Uses AccountInfoTrait for CPI context and tree info -- `light-ctoken-types` - Uses AccountInfoTrait for instruction account structures +- `light-token-types` - Uses AccountInfoTrait for instruction account structures # Navigation - This file: Overview and module organization diff --git a/program-libs/compressible/src/config.rs b/program-libs/compressible/src/config.rs index 09536e951f..8f8ae32e69 100644 --- a/program-libs/compressible/src/config.rs +++ b/program-libs/compressible/src/config.rs @@ -150,8 +150,8 @@ impl Discriminator for CompressibleConfig { impl CompressibleConfig { pub const LEN: usize = std::mem::size_of::(); - pub fn ctoken_v1(update_authority: Pubkey, withdrawal_authority: Pubkey) -> Self { - Self::new_ctoken( + pub fn light_token_v1(update_authority: Pubkey, withdrawal_authority: Pubkey) -> Self { + Self::new_light_token( 1, true, update_authority, @@ -160,7 +160,7 @@ impl CompressibleConfig { ) } - pub fn new_ctoken( + pub fn new_light_token( version: u16, active: bool, update_authority: Pubkey, @@ -245,7 +245,7 @@ impl CompressibleConfig { } /// Derives the default config PDA address (config_bump = 1) - pub fn ctoken_v1_config_pda() -> Pubkey { + pub fn light_token_v1_config_pda() -> Pubkey { Self::derive_pda(&pubkey!("Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX"), 1).0 } @@ -272,7 +272,7 @@ impl CompressibleConfig { } /// Derives the default ctoken compression authority PDA (version = 1) - pub fn ctoken_v1_compression_authority_pda() -> Pubkey { + pub fn light_token_v1_compression_authority_pda() -> Pubkey { Self::derive_compression_authority_pda( &pubkey!("Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX"), 1, @@ -280,7 +280,7 @@ impl CompressibleConfig { .0 } /// Derives the default ctoken rent sponsor PDA (version = 1) - pub fn ctoken_v1_rent_sponsor_pda() -> Pubkey { + pub fn light_token_v1_rent_sponsor_pda() -> Pubkey { Self::derive_rent_sponsor_pda(&pubkey!("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m"), 1).0 } } diff --git a/program-tests/compressed-token-test/tests/ctoken/shared.rs b/program-tests/compressed-token-test/tests/ctoken/shared.rs index 48cd99e15b..3740e44e10 100644 --- a/program-tests/compressed-token-test/tests/ctoken/shared.rs +++ b/program-tests/compressed-token-test/tests/ctoken/shared.rs @@ -682,7 +682,7 @@ pub async fn compress_and_close_forester_with_invalid_output( let current_epoch = 0; let (registered_forester_pda, _) = get_forester_epoch_pda_from_authority(&forester_keypair.pubkey(), current_epoch); - let config = CompressibleConfig::ctoken_v1(Pubkey::default(), Pubkey::default()); + let config = CompressibleConfig::light_token_v1(Pubkey::default(), Pubkey::default()); let compressible_config = CompressibleConfig::derive_v1_config_pda(®istry_program_id).0; let compression_authority = config.compression_authority; diff --git a/program-tests/compressed-token-test/tests/mint/failing.rs b/program-tests/compressed-token-test/tests/mint/failing.rs index e2c2017e80..42f781fa1c 100644 --- a/program-tests/compressed-token-test/tests/mint/failing.rs +++ b/program-tests/compressed-token-test/tests/mint/failing.rs @@ -935,7 +935,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { rpc_proof_result.accounts[0].tree_info.queue, rpc_proof_result.accounts[0].tree_info.queue, ) - .with_ctoken_accounts(vec![ctoken_ata]); + .with_token_accounts(vec![ctoken_ata]); let account_metas = config.to_account_metas(); diff --git a/program-tests/compressed-token-test/tests/mint/functional.rs b/program-tests/compressed-token-test/tests/mint/functional.rs index f6babf9671..e044014622 100644 --- a/program-tests/compressed-token-test/tests/mint/functional.rs +++ b/program-tests/compressed-token-test/tests/mint/functional.rs @@ -14,7 +14,7 @@ use light_test_utils::{ Rpc, }; use light_token_client::{ - actions::{create_mint, mint_to_compressed, transfer2, transfer_ctoken}, + actions::{create_mint, mint_to_compressed, transfer2, transfer_token}, instructions::{ mint_action::{DecompressMintParams, MintActionType}, transfer2::{ @@ -834,7 +834,7 @@ async fn test_ctoken_transfer() { second_recipient_ata_balance ); // Execute the decompressed transfer - let transfer_result = transfer_ctoken( + let transfer_result = transfer_token( &mut rpc, recipient_ata, // Source account (has 1000 tokens) second_recipient_ata, // Destination account diff --git a/program-tests/registry-test/tests/compressible.rs b/program-tests/registry-test/tests/compressible.rs index 976d372a02..cb4aafe6ca 100644 --- a/program-tests/registry-test/tests/compressible.rs +++ b/program-tests/registry-test/tests/compressible.rs @@ -29,7 +29,7 @@ use light_test_utils::{ }; use light_token_client::{ actions::{ - create_compressible_token_account, mint_action_comprehensive, transfer_ctoken, + create_compressible_token_account, mint_action_comprehensive, transfer_token, CreateCompressibleTokenAccountInputs, }, instructions::mint_action::{DecompressMintParams, NewMint}, @@ -63,10 +63,10 @@ async fn withdraw_funding_pool_via_registry( Pubkey::from_str("Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX").unwrap(); let compressed_token_program_id = Pubkey::from_str("cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m").unwrap(); - let config = CompressibleConfig::ctoken_v1(Default::default(), Default::default()); + let config = CompressibleConfig::light_token_v1(Default::default(), Default::default()); let compression_authority = config.compression_authority; let rent_sponsor = config.rent_sponsor; - let compressible_config = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config = CompressibleConfig::light_token_v1_config_pda(); // Build accounts using Anchor's account abstraction let withdraw_accounts = WithdrawFundingPoolAccounts { @@ -333,7 +333,7 @@ async fn pause_compressible_config( ) -> Result { let registry_program_id = Pubkey::from_str("Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX").unwrap(); - let compressible_config = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config = CompressibleConfig::light_token_v1_config_pda(); let accounts = UpdateCompressibleConfigAccounts { update_authority: update_authority.pubkey(), @@ -367,7 +367,7 @@ async fn unpause_compressible_config( ) -> Result { let registry_program_id = Pubkey::from_str("Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX").unwrap(); - let compressible_config = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config = CompressibleConfig::light_token_v1_config_pda(); let accounts = UpdateCompressibleConfigAccounts { update_authority: update_authority.pubkey(), @@ -401,7 +401,7 @@ async fn deprecate_compressible_config( ) -> Result { let registry_program_id = Pubkey::from_str("Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX").unwrap(); - let compressible_config = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config = CompressibleConfig::light_token_v1_config_pda(); let accounts = UpdateCompressibleConfigAccounts { update_authority: update_authority.pubkey(), @@ -435,7 +435,7 @@ async fn update_compressible_config_authorities( new_withdrawal_authority: Option<&Keypair>, payer: &Keypair, ) -> Result { - let compressible_config = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config = CompressibleConfig::light_token_v1_config_pda(); let accounts = UpdateCompressibleConfigAccounts { update_authority: update_authority.pubkey(), @@ -484,7 +484,7 @@ async fn test_pause_compressible_config_with_valid_authority() -> Result<(), Rpc .unwrap(); // Verify the config state is paused (state = 0) - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data = rpc .get_account(compressible_config_pda) .await? @@ -580,7 +580,7 @@ async fn test_pause_compressible_config_with_invalid_authority() -> Result<(), R ); // Verify the config state is still active (state = 1) - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data = rpc .get_account(compressible_config_pda) .await? @@ -607,7 +607,7 @@ async fn test_unpause_compressible_config_with_valid_authority() -> Result<(), R .unwrap(); // Verify it's paused - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data = rpc .get_account(compressible_config_pda) .await? @@ -717,7 +717,7 @@ async fn test_unpause_compressible_config_with_invalid_authority() -> Result<(), .unwrap(); // Verify the config state is still paused (state = 0) - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data = rpc .get_account(compressible_config_pda) .await? @@ -777,7 +777,7 @@ async fn test_deprecate_compressible_config_with_valid_authority() -> Result<(), .unwrap(); // Verify the config state is deprecated (state = 2) - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data = rpc .get_account(compressible_config_pda) .await? @@ -884,7 +884,7 @@ async fn test_deprecate_compressible_config_with_invalid_authority() -> Result<( ); // Verify the config state is still active (state = 1) - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data = rpc .get_account(compressible_config_pda) .await? @@ -923,7 +923,7 @@ async fn test_update_compressible_config_update_authority() -> Result<(), RpcErr .unwrap(); // Verify the update_authority was updated - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data = rpc .get_account(compressible_config_pda) .await? @@ -949,7 +949,7 @@ async fn test_update_compressible_config_withdrawal_authority() -> Result<(), Rp let payer = rpc.get_payer().insecure_clone(); // Store original withdrawal authority - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data_before = rpc .get_account(compressible_config_pda) .await? @@ -1031,7 +1031,7 @@ async fn test_update_compressible_config_both_authorities() -> Result<(), RpcErr .unwrap(); // Verify both authorities were updated - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data = rpc .get_account(compressible_config_pda) .await? @@ -1091,7 +1091,7 @@ async fn test_update_compressible_config_invalid_authority() -> Result<(), RpcEr .unwrap(); // Verify the update_authority was NOT updated - let compressible_config_pda = CompressibleConfig::ctoken_v1_config_pda(); + let compressible_config_pda = CompressibleConfig::light_token_v1_config_pda(); let account_data = rpc .get_account(compressible_config_pda) .await? @@ -1441,7 +1441,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { }; // Transfer all tokens from source to dest - transfer_ctoken( + transfer_token( &mut rpc, source, dest, diff --git a/programs/registry/src/lib.rs b/programs/registry/src/lib.rs index 78c164a37b..201d78ff16 100644 --- a/programs/registry/src/lib.rs +++ b/programs/registry/src/lib.rs @@ -700,7 +700,7 @@ pub mod light_registry { ) -> Result<()> { ctx.accounts .compressible_config - .set_inner(CompressibleConfig::new_ctoken( + .set_inner(CompressibleConfig::new_light_token( ctx.accounts.config_counter.counter, params.active, params.update_authority, diff --git a/scripts/lint.sh b/scripts/lint.sh index 6b2cde79ca..3358832702 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -33,8 +33,8 @@ NO_DEFAULT_CRATES=( "light-sdk-types" "light-sdk-pinocchio" "light-sdk-macros" - "light-ctoken-sdk" - "light-ctoken-types" + "light-token-sdk" + "light-token-types" "light-sdk" "sdk-compressible-test" "csdk-anchor-derived-test" @@ -100,8 +100,8 @@ ANCHOR_CRATES=( "light-compressible" "light-sdk-types" "light-sdk" - "light-ctoken-sdk" - "light-ctoken-types" + "light-token-sdk" + "light-token-types" ) for crate in "${ANCHOR_CRATES[@]}"; do diff --git a/sdk-libs/macros/src/compressible/instructions.rs b/sdk-libs/macros/src/compressible/instructions.rs index 04243ff8a2..620b6d225c 100644 --- a/sdk-libs/macros/src/compressible/instructions.rs +++ b/sdk-libs/macros/src/compressible/instructions.rs @@ -331,7 +331,7 @@ pub fn add_compressible_instructions( let ctoken_enum = if let Some(ref token_seed_specs) = token_seeds { if !token_seed_specs.is_empty() { - crate::compressible::seed_providers::generate_ctoken_account_variant_enum( + crate::compressible::seed_providers::generate_token_account_variant_enum( token_seed_specs, )? } else { @@ -844,7 +844,7 @@ pub fn add_compressible_instructions( if let Some(ref seeds) = token_seeds { if !seeds.is_empty() { let impl_code = - crate::compressible::seed_providers::generate_ctoken_seed_provider_implementation( + crate::compressible::seed_providers::generate_token_seed_provider_implementation( seeds, )?; let ctoken_impl: syn::ItemImpl = syn::parse2(impl_code).map_err(|e| { diff --git a/sdk-libs/macros/src/compressible/seed_providers.rs b/sdk-libs/macros/src/compressible/seed_providers.rs index 0b55225fed..52379b9a52 100644 --- a/sdk-libs/macros/src/compressible/seed_providers.rs +++ b/sdk-libs/macros/src/compressible/seed_providers.rs @@ -6,7 +6,7 @@ use syn::{spanned::Spanned, Ident, Result}; use crate::compressible::instructions::{InstructionDataSpec, SeedElement, TokenSeedSpec}; -pub fn generate_ctoken_account_variant_enum(token_seeds: &[TokenSeedSpec]) -> Result { +pub fn generate_token_account_variant_enum(token_seeds: &[TokenSeedSpec]) -> Result { let variants = token_seeds.iter().enumerate().map(|(index, spec)| { let variant_name = &spec.variant; let index_u8 = index as u8; @@ -24,7 +24,7 @@ pub fn generate_ctoken_account_variant_enum(token_seeds: &[TokenSeedSpec]) -> Re }) } -pub fn generate_ctoken_seed_provider_implementation( +pub fn generate_token_seed_provider_implementation( token_seeds: &[TokenSeedSpec], ) -> Result { let mut get_seeds_match_arms = Vec::new(); diff --git a/sdk-libs/program-test/src/compressible.rs b/sdk-libs/program-test/src/compressible.rs index 13a1d87dce..92a8461778 100644 --- a/sdk-libs/program-test/src/compressible.rs +++ b/sdk-libs/program-test/src/compressible.rs @@ -100,7 +100,7 @@ pub struct FundingPoolConfig { #[cfg(feature = "devenv")] impl FundingPoolConfig { pub fn new(version: u16) -> Self { - let config = CtokenCompressibleConfig::new_ctoken( + let config = CtokenCompressibleConfig::new_light_token( version, true, Pubkey::default(), diff --git a/sdk-libs/program-test/src/forester/claim_forester.rs b/sdk-libs/program-test/src/forester/claim_forester.rs index d44d1d1d68..53f53bdd6b 100644 --- a/sdk-libs/program-test/src/forester/claim_forester.rs +++ b/sdk-libs/program-test/src/forester/claim_forester.rs @@ -46,8 +46,8 @@ pub async fn claim_forester( // Derive registered forester PDA for the current epoch let (registered_forester_pda, _) = get_forester_epoch_pda_from_authority(&authority.pubkey(), current_epoch); - let config = CompressibleConfig::ctoken_v1(Default::default(), Default::default()); - let compressible_config = CompressibleConfig::ctoken_v1_config_pda(); + let config = CompressibleConfig::light_token_v1(Default::default(), Default::default()); + let compressible_config = CompressibleConfig::light_token_v1_config_pda(); let rent_sponsor = config.rent_sponsor; let compression_authority = config.compression_authority; diff --git a/sdk-libs/program-test/src/forester/compress_and_close_forester.rs b/sdk-libs/program-test/src/forester/compress_and_close_forester.rs index c08b950af5..822066d5ce 100644 --- a/sdk-libs/program-test/src/forester/compress_and_close_forester.rs +++ b/sdk-libs/program-test/src/forester/compress_and_close_forester.rs @@ -53,7 +53,7 @@ pub async fn compress_and_close_forester( let (registered_forester_pda, _) = get_forester_epoch_pda_from_authority(&authority.pubkey(), current_epoch); - let config = CompressibleConfig::ctoken_v1(Pubkey::default(), Pubkey::default()); + let config = CompressibleConfig::light_token_v1(Pubkey::default(), Pubkey::default()); let compressible_config = CompressibleConfig::derive_v1_config_pda(®istry_program_id).0; diff --git a/sdk-libs/token-client/src/actions/mod.rs b/sdk-libs/token-client/src/actions/mod.rs index 9578a66cc6..712b0172af 100644 --- a/sdk-libs/token-client/src/actions/mod.rs +++ b/sdk-libs/token-client/src/actions/mod.rs @@ -1,16 +1,16 @@ mod create_compressible_token_account; mod create_mint; -mod ctoken_transfer; mod mint_action; mod mint_to_compressed; mod spl_interface; +mod transfer; pub mod transfer2; mod update_compressed_mint; pub use create_compressible_token_account::*; pub use create_mint::*; -pub use ctoken_transfer::*; pub use mint_action::*; pub use mint_to_compressed::*; pub use spl_interface::*; +pub use transfer::*; pub use update_compressed_mint::*; diff --git a/sdk-libs/token-client/src/actions/ctoken_transfer.rs b/sdk-libs/token-client/src/actions/transfer.rs similarity index 90% rename from sdk-libs/token-client/src/actions/ctoken_transfer.rs rename to sdk-libs/token-client/src/actions/transfer.rs index 9781d62e91..56220a266a 100644 --- a/sdk-libs/token-client/src/actions/ctoken_transfer.rs +++ b/sdk-libs/token-client/src/actions/transfer.rs @@ -7,7 +7,7 @@ use solana_signer::Signer; const SYSTEM_PROGRAM_ID: [u8; 32] = [0u8; 32]; -/// Transfer from one c-token account to another. +/// Transfer from one token account to another. /// /// # Arguments /// * `rpc` - RPC client @@ -19,7 +19,7 @@ const SYSTEM_PROGRAM_ID: [u8; 32] = [0u8; 32]; /// /// # Returns /// `Result` - The transaction signature -pub async fn transfer_ctoken( +pub async fn transfer_token( rpc: &mut R, source: Pubkey, destination: Pubkey, @@ -28,7 +28,7 @@ pub async fn transfer_ctoken( payer: &Keypair, ) -> Result { let transfer_instruction = - create_transfer_ctoken_instruction(source, destination, amount, authority.pubkey())?; + create_transfer_token_instruction(source, destination, amount, authority.pubkey())?; let mut signers = vec![payer]; if authority.pubkey() != payer.pubkey() { @@ -40,7 +40,7 @@ pub async fn transfer_ctoken( } // TODO: consume the variant from compressed-token-sdk instead -/// Create a ctoken transfer instruction. +/// Create a token transfer instruction. /// /// # Arguments /// * `source` - Source token account @@ -51,7 +51,7 @@ pub async fn transfer_ctoken( /// # Returns /// `Result` #[allow(clippy::result_large_err)] -pub fn create_transfer_ctoken_instruction( +pub fn create_transfer_token_instruction( source: Pubkey, destination: Pubkey, amount: u64, diff --git a/sdk-libs/token-client/src/instructions/mint_action.rs b/sdk-libs/token-client/src/instructions/mint_action.rs index 8a6ad34c33..2a887aa693 100644 --- a/sdk-libs/token-client/src/instructions/mint_action.rs +++ b/sdk-libs/token-client/src/instructions/mint_action.rs @@ -345,14 +345,14 @@ pub async fn create_mint_action_instruction( // Add ctoken accounts if any MintToCToken actions were present if !ctoken_accounts.is_empty() { - config = config.with_ctoken_accounts(ctoken_accounts); + config = config.with_token_accounts(ctoken_accounts); } // Add compressible CMint accounts if DecompressMint or CompressAndCloseCMint action is present if has_decompress_mint || has_compress_and_close_cmint { let (cmint_pda, _) = find_cmint_address(¶ms.mint_seed); // Get config and rent_sponsor from v1 config PDA - let config_address = CompressibleConfig::ctoken_v1_config_pda(); + let config_address = CompressibleConfig::light_token_v1_config_pda(); let compressible_config: CompressibleConfig = rpc .get_anchor_account(&config_address) .await? diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs b/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs index d7037081eb..ae435450d3 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs @@ -133,7 +133,7 @@ fn find_account_indices( /// # Returns /// An instruction that compresses and closes all provided token accounts #[profile] -pub fn compress_and_close_ctoken_accounts_with_indices<'info>( +pub fn compress_and_close_token_accounts_with_indices<'info>( fee_payer: Pubkey, cpi_context_pubkey: Option, indices: &[CompressAndCloseIndices], @@ -234,7 +234,7 @@ pub fn compress_and_close_ctoken_accounts_with_indices<'info>( /// # Returns /// An instruction that compresses and closes all provided token accounts #[profile] -pub fn compress_and_close_ctoken_accounts<'info>( +pub fn compress_and_close_token_accounts<'info>( fee_payer: Pubkey, output_queue: AccountInfo<'info>, ctoken_solana_accounts: &[&AccountInfo<'info>], @@ -298,7 +298,7 @@ pub fn compress_and_close_ctoken_accounts<'info>( packed_accounts_vec.push(output_queue); packed_accounts_vec.extend_from_slice(packed_accounts); - compress_and_close_ctoken_accounts_with_indices( + compress_and_close_token_accounts_with_indices( fee_payer, None, &indices_vec, @@ -308,7 +308,7 @@ pub fn compress_and_close_ctoken_accounts<'info>( /// Compress and close ctoken accounts, and invoke cpi. /// -/// Wraps `compress_and_close_ctoken_accounts`, builds the instruction, and +/// Wraps `compress_and_close_token_accounts`, builds the instruction, and /// calls `invoke_signed` with provided seeds. /// /// `remaining_accounts` must include required Light system accounts for @@ -317,7 +317,7 @@ pub fn compress_and_close_ctoken_accounts<'info>( #[allow(clippy::too_many_arguments)] #[profile] #[allow(clippy::extra_unused_lifetimes)] -pub fn compress_and_close_ctoken_accounts_signed<'b, 'info>( +pub fn compress_and_close_token_accounts_signed<'b, 'info>( token_accounts_to_compress: &[AccountInfoToCompress<'info>], fee_payer: AccountInfo<'info>, output_queue: AccountInfo<'info>, @@ -337,7 +337,7 @@ pub fn compress_and_close_ctoken_accounts_signed<'b, 'info>( .map(|t| t.account_info.as_ref()) .collect(); - let instruction = compress_and_close_ctoken_accounts( + let instruction = compress_and_close_token_accounts( *fee_payer.key, output_queue, &ctoken_infos, diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs b/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs index 7e351d01cd..9b6733fb30 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs @@ -47,7 +47,7 @@ pub struct DecompressFullIndices { /// # Returns /// An instruction that decompresses the full balance of all provided token accounts #[profile] -pub fn decompress_full_ctoken_accounts_with_indices<'info>( +pub fn decompress_full_token_accounts_with_indices<'info>( fee_payer: Pubkey, validity_proof: ValidityProof, cpi_context_pubkey: Option, @@ -154,7 +154,7 @@ pub fn decompress_full_ctoken_accounts_with_indices<'info>( /// * `version` - TokenDataVersion (1=V1, 2=V2, 3=ShaFlat) for hash computation /// /// # Returns -/// Vec of DecompressFullIndices ready to use with decompress_full_ctoken_accounts_with_indices +/// Vec of DecompressFullIndices ready to use with decompress_full_token_accounts_with_indices #[profile] pub fn pack_for_decompress_full( token: &TokenData, diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs index 062975f3db..a67d188ff2 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs @@ -105,7 +105,7 @@ impl MintActionMetaConfig { self } - pub fn with_ctoken_accounts(mut self, accounts: Vec) -> Self { + pub fn with_token_accounts(mut self, accounts: Vec) -> Self { self.ctoken_accounts = accounts; self } diff --git a/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs b/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs index 614b0f9e35..1256bc68dd 100644 --- a/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs +++ b/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs @@ -181,7 +181,7 @@ where } let ctoken_ix = - crate::compressed_token::decompress_full::decompress_full_ctoken_accounts_with_indices( + crate::compressed_token::decompress_full::decompress_full_token_accounts_with_indices( *fee_payer.key, proof, cpi_context_pubkey, diff --git a/sdk-libs/token-sdk/src/token/mint_to.rs b/sdk-libs/token-sdk/src/token/mint_to.rs index de19f660f6..f181d4431b 100644 --- a/sdk-libs/token-sdk/src/token/mint_to.rs +++ b/sdk-libs/token-sdk/src/token/mint_to.rs @@ -152,7 +152,7 @@ impl MintToToken { self.input_queue, self.output_queue, ) - .with_ctoken_accounts(self.ctoken_accounts) + .with_token_accounts(self.ctoken_accounts) }; let account_metas = meta_config.to_account_metas(); diff --git a/sdk-libs/token-sdk/src/token/mod.rs b/sdk-libs/token-sdk/src/token/mod.rs index 75a72195db..69ca624ffa 100644 --- a/sdk-libs/token-sdk/src/token/mod.rs +++ b/sdk-libs/token-sdk/src/token/mod.rs @@ -228,7 +228,7 @@ pub fn rent_sponsor_pda() -> Pubkey { } pub fn compression_authority_pda() -> Pubkey { - CompressibleConfig::ctoken_v1_compression_authority_pda() + CompressibleConfig::light_token_v1_compression_authority_pda() } // Backwards compatibility aliases for old type names diff --git a/sdk-libs/token-types/src/account_infos/transfer.rs b/sdk-libs/token-types/src/account_infos/transfer.rs index 7fa094cc81..9cff48627e 100644 --- a/sdk-libs/token-types/src/account_infos/transfer.rs +++ b/sdk-libs/token-types/src/account_infos/transfer.rs @@ -122,7 +122,7 @@ impl<'a, T: AccountInfoTrait + Clone> TransferAccountInfos<'a, T> { self.authority } - pub fn ctoken_program(&self) -> Result<&'a T> { + pub fn light_token_program(&self) -> Result<&'a T> { let index = TransferAccountInfosIndex::CTokenProgram as usize; self.accounts .get(index) diff --git a/sdk-tests/CLAUDE.md b/sdk-tests/CLAUDE.md index 2329cb409e..e55e188874 100644 --- a/sdk-tests/CLAUDE.md +++ b/sdk-tests/CLAUDE.md @@ -93,8 +93,8 @@ cargo test -p light-sdk --all-features cargo test -p light-program-test cargo test -p light-client cargo test -p light-sparse-merkle-tree -cargo test -p light-ctoken-types -cargo test -p light-ctoken-sdk +cargo test -p light-token-types +cargo test -p light-token-sdk ``` ## Test Categories diff --git a/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs b/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs index c9fa12ac27..89cc0024ce 100644 --- a/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs +++ b/sdk-tests/sdk-compressible-test/src/instructions/decompress_accounts_idempotent.rs @@ -266,7 +266,7 @@ pub fn decompress_accounts_idempotent<'info>( } let ctoken_ix = - light_token_sdk::compressed_token::decompress_full::decompress_full_ctoken_accounts_with_indices( + light_token_sdk::compressed_token::decompress_full::decompress_full_token_accounts_with_indices( fee_payer.key(), proof, if has_pdas { diff --git a/sdk-tests/sdk-light-token-test/Cargo.lock b/sdk-tests/sdk-light-token-test/Cargo.lock deleted file mode 100644 index d30c23b5f9..0000000000 --- a/sdk-tests/sdk-light-token-test/Cargo.lock +++ /dev/null @@ -1,8546 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "aes-gcm-siv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae0784134ba9375416d469ec31e7c5f9fa94405049cf08c5ce5b4698be673e0d" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "polyval", - "subtle", - "zeroize", -] - -[[package]] -name = "agave-feature-set" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a2c365c0245cbb8959de725fc2b44c754b673fdf34c9a7f9d4a25c35a7bf1" -dependencies = [ - "ahash", - "solana-epoch-schedule", - "solana-hash", - "solana-pubkey", - "solana-sha256-hasher", - "solana-svm-feature-set", -] - -[[package]] -name = "agave-precompiles" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d60d73657792af7f2464e9181d13c3979e94bb09841d9ffa014eef4ef0492b77" -dependencies = [ - "agave-feature-set", - "bincode", - "digest 0.10.7", - "ed25519-dalek", - "libsecp256k1", - "openssl", - "sha3", - "solana-ed25519-program", - "solana-message", - "solana-precompile-error", - "solana-pubkey", - "solana-sdk-ids", - "solana-secp256k1-program", - "solana-secp256r1-program", -] - -[[package]] -name = "agave-reserved-account-keys" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8289c8a8a2ef5aa10ce49a070f360f4e035ee3410b8d8f3580fb39d8cf042581" -dependencies = [ - "agave-feature-set", - "solana-pubkey", - "solana-sdk-ids", -] - -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "getrandom 0.3.4", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" -dependencies = [ - "memchr", -] - -[[package]] -name = "aligned-sized" -version = "1.1.0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] -name = "anchor-attribute-access-control" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f70fd141a4d18adf11253026b32504f885447048c7494faf5fa83b01af9c0cf" -dependencies = [ - "anchor-syn", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-account" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715a261c57c7679581e06f07a74fa2af874ac30f86bd8ea07cca4a7e5388a064" -dependencies = [ - "anchor-syn", - "bs58", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-constant" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "730d6df8ae120321c5c25e0779e61789e4b70dc8297102248902022f286102e4" -dependencies = [ - "anchor-syn", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-error" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27e6e449cc3a37b2880b74dcafb8e5a17b954c0e58e376432d7adc646fb333ef" -dependencies = [ - "anchor-syn", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-event" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7710e4c54adf485affcd9be9adec5ef8846d9c71d7f31e16ba86ff9fc1dd49f" -dependencies = [ - "anchor-syn", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-attribute-program" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ecfd49b2aeadeb32f35262230db402abed76ce87e27562b34f61318b2ec83c" -dependencies = [ - "anchor-lang-idl", - "anchor-syn", - "anyhow", - "bs58", - "heck 0.3.3", - "proc-macro2", - "quote", - "serde_json", - "syn 1.0.109", -] - -[[package]] -name = "anchor-derive-accounts" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be89d160793a88495af462a7010b3978e48e30a630c91de47ce2c1d3cb7a6149" -dependencies = [ - "anchor-syn", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-derive-serde" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abc6ee78acb7bfe0c2dd2abc677aaa4789c0281a0c0ef01dbf6fe85e0fd9e6e4" -dependencies = [ - "anchor-syn", - "borsh-derive-internal", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-derive-space" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134a01c0703f6fd355a0e472c033f6f3e41fac1ef6e370b20c50f4c8d022cea7" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "anchor-lang" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6bab117055905e930f762c196e08f861f8dfe7241b92cee46677a3b15561a0a" -dependencies = [ - "anchor-attribute-access-control", - "anchor-attribute-account", - "anchor-attribute-constant", - "anchor-attribute-error", - "anchor-attribute-event", - "anchor-attribute-program", - "anchor-derive-accounts", - "anchor-derive-serde", - "anchor-derive-space", - "anchor-lang-idl", - "base64 0.21.7", - "bincode", - "borsh 0.10.4", - "bytemuck", - "solana-program", - "thiserror 1.0.69", -] - -[[package]] -name = "anchor-lang-idl" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e8599d21995f68e296265aa5ab0c3cef582fd58afec014d01bd0bce18a4418" -dependencies = [ - "anchor-lang-idl-spec", - "anyhow", - "heck 0.3.3", - "regex", - "serde", - "serde_json", - "sha2 0.10.9", -] - -[[package]] -name = "anchor-lang-idl-spec" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bdf143115440fe621bdac3a29a1f7472e09f6cd82b2aa569429a0c13f103838" -dependencies = [ - "anyhow", - "serde", -] - -[[package]] -name = "anchor-syn" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc7a6d90cc643df0ed2744862cdf180587d1e5d28936538c18fc8908489ed67" -dependencies = [ - "anyhow", - "bs58", - "cargo_toml", - "heck 0.3.3", - "proc-macro2", - "quote", - "serde", - "serde_json", - "sha2 0.10.9", - "syn 1.0.109", - "thiserror 1.0.69", -] - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" - -[[package]] -name = "ark-bn254" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" -dependencies = [ - "ark-ec 0.4.2", - "ark-ff 0.4.2", - "ark-std 0.4.0", -] - -[[package]] -name = "ark-bn254" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" -dependencies = [ - "ark-ec 0.5.0", - "ark-ff 0.5.0", - "ark-std 0.5.0", -] - -[[package]] -name = "ark-ec" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" -dependencies = [ - "ark-ff 0.4.2", - "ark-poly 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", - "derivative", - "hashbrown 0.13.2", - "itertools 0.10.5", - "num-traits", - "zeroize", -] - -[[package]] -name = "ark-ec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" -dependencies = [ - "ahash", - "ark-ff 0.5.0", - "ark-poly 0.5.0", - "ark-serialize 0.5.0", - "ark-std 0.5.0", - "educe 0.6.0", - "fnv", - "hashbrown 0.15.2", - "itertools 0.13.0", - "num-bigint 0.4.6", - "num-integer", - "num-traits", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" -dependencies = [ - "ark-ff-asm 0.4.2", - "ark-ff-macros 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", - "derivative", - "digest 0.10.7", - "itertools 0.10.5", - "num-bigint 0.4.6", - "num-traits", - "paste", - "rustc_version", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" -dependencies = [ - "ark-ff-asm 0.5.0", - "ark-ff-macros 0.5.0", - "ark-serialize 0.5.0", - "ark-std 0.5.0", - "arrayvec", - "digest 0.10.7", - "educe 0.6.0", - "itertools 0.13.0", - "num-bigint 0.4.6", - "num-traits", - "paste", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-asm" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" -dependencies = [ - "quote", - "syn 2.0.110", -] - -[[package]] -name = "ark-ff-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" -dependencies = [ - "num-bigint 0.4.6", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" -dependencies = [ - "num-bigint 0.4.6", - "num-traits", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "ark-poly" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" -dependencies = [ - "ark-ff 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", - "derivative", - "hashbrown 0.13.2", -] - -[[package]] -name = "ark-poly" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" -dependencies = [ - "ahash", - "ark-ff 0.5.0", - "ark-serialize 0.5.0", - "ark-std 0.5.0", - "educe 0.6.0", - "fnv", - "hashbrown 0.15.2", -] - -[[package]] -name = "ark-serialize" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" -dependencies = [ - "ark-serialize-derive 0.4.2", - "ark-std 0.4.0", - "digest 0.10.7", - "num-bigint 0.4.6", -] - -[[package]] -name = "ark-serialize" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" -dependencies = [ - "ark-serialize-derive 0.5.0", - "ark-std 0.5.0", - "arrayvec", - "digest 0.10.7", - "num-bigint 0.4.6", -] - -[[package]] -name = "ark-serialize-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-serialize-derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "ark-std" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - -[[package]] -name = "ark-std" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" -dependencies = [ - "num-traits", - "rand 0.8.5", - "rayon", -] - -[[package]] -name = "arrayref" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" - -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - -[[package]] -name = "ascii" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" - -[[package]] -name = "async-compression" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c1f86859c1af3d514fa19e8323147ff10ea98684e6c7b307912509f50e67b2" -dependencies = [ - "compression-codecs", - "compression-core", - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "async-trait" -version = "0.1.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" -dependencies = [ - "serde_core", -] - -[[package]] -name = "blake3" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "digest 0.10.7", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "borsh" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115e54d64eb62cdebad391c19efc9dce4981c690c85a33a12199d99bb9546fee" -dependencies = [ - "borsh-derive 0.10.4", - "hashbrown 0.13.2", -] - -[[package]] -name = "borsh" -version = "1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" -dependencies = [ - "borsh-derive 1.5.7", - "cfg_aliases", -] - -[[package]] -name = "borsh-derive" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "borsh-derive" -version = "1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" -dependencies = [ - "once_cell", - "proc-macro-crate 3.4.0", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65d6ba50644c98714aa2a70d13d7df3cd75cd2b523a2b452bf010443800976b3" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276691d96f063427be83e6692b86148e488ebba9f48f77788724ca027ba3b6d4" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "brotli" -version = "8.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd8b9603c7aa97359dbd97ecf258968c95f3adddd6db2f7e7a5bef101c84560" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bs58" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "bumpalo" -version = "3.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" - -[[package]] -name = "bv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" -dependencies = [ - "feature-probe", - "serde", -] - -[[package]] -name = "bytecount" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" - -[[package]] -name = "bytemuck" -version = "1.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" - -[[package]] -name = "cargo_toml" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be" -dependencies = [ - "serde", - "toml 0.8.23", -] - -[[package]] -name = "cc" -version = "1.2.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" -dependencies = [ - "find-msvc-tools", - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - -[[package]] -name = "cfg_eval" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45565fc9416b9896014f5732ac776f810ee53a66730c17e4020c3ec064a8f88f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "chrono" -version = "0.4.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-link", -] - -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - -[[package]] -name = "combine" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" -dependencies = [ - "ascii", - "byteorder", - "either", - "memchr", - "unreachable", -] - -[[package]] -name = "compression-codecs" -version = "0.4.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "680dc087785c5230f8e8843e2e57ac7c1c90488b6a91b88caa265410568f441b" -dependencies = [ - "brotli", - "compression-core", - "flate2", - "memchr", -] - -[[package]] -name = "compression-core" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9b614a5787ef0c8802a55766480563cb3a93b435898c422ed2a359cf811582" - -[[package]] -name = "console" -version = "0.15.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" -dependencies = [ - "encode_unicode", - "libc", - "once_cell", - "unicode-width", - "windows-sys 0.59.0", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89f72f65e8501878b8a004d5a1afb780987e2ce2b4532c562e367a72c57499f" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "constant_time_eq" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "4.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest 0.10.7", - "fiat-crypto", - "rand_core 0.6.4", - "rustc_version", - "serde", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "darling" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.110", -] - -[[package]] -name = "darling_macro" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "deranged" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" -dependencies = [ - "powerfmt", - "serde_core", -] - -[[package]] -name = "derivation-path" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0" - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer 0.10.4", - "crypto-common", - "subtle", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "dyn-clone" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" - -[[package]] -name = "eager" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abe71d579d1812060163dff96056261deb5bf6729b100fa2e36a68b9649ba3d3" - -[[package]] -name = "ed25519" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" -dependencies = [ - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek 3.2.0", - "ed25519", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "ed25519-dalek-bip32" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2be62a4061b872c8c0873ee4fc6f101ce7b889d039f019c5fa2af471a59908" -dependencies = [ - "derivation-path", - "ed25519-dalek", - "hmac 0.12.1", - "sha2 0.10.9", -] - -[[package]] -name = "educe" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0042ff8246a363dbe77d2ceedb073339e85a804b9a47636c6e016a9a32c05f" -dependencies = [ - "enum-ordinalize 3.1.15", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "educe" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" -dependencies = [ - "enum-ordinalize 4.3.2", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "encode_unicode" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" - -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enum-iterator" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd242f399be1da0a5354aa462d57b4ab2b4ee0683cc552f7c007d2d12d36e94" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685adfa4d6f3d765a26bc5dbc936577de9abf756c1feeb3089b01dd395034842" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "enum-ordinalize" -version = "3.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" -dependencies = [ - "num-bigint 0.4.6", - "num-traits", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "enum-ordinalize" -version = "4.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" -dependencies = [ - "enum-ordinalize-derive", -] - -[[package]] -name = "enum-ordinalize-derive" -version = "4.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - -[[package]] -name = "feature-probe" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" - -[[package]] -name = "fiat-crypto" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" - -[[package]] -name = "find-msvc-tools" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" - -[[package]] -name = "five8" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75b8549488b4715defcb0d8a8a1c1c76a80661b5fa106b4ca0e7fce59d7d875" -dependencies = [ - "five8_core", -] - -[[package]] -name = "five8_const" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26dec3da8bc3ef08f2c04f61eab298c3ab334523e55f076354d6d6f613799a7b" -dependencies = [ - "five8_core", -] - -[[package]] -name = "five8_core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2551bf44bc5f776c15044b9b94153a00198be06743e262afaaa61f11ac7523a5" - -[[package]] -name = "flate2" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-executor" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "gethostname" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "r-efi", - "wasip2", - "wasm-bindgen", -] - -[[package]] -name = "h2" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap 2.12.1", - "slab", - "tokio", - "tokio-util 0.7.17", - "tracing", -] - -[[package]] -name = "h2" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http 1.3.1", - "indexmap 2.12.1", - "slab", - "tokio", - "tokio-util 0.7.17", - "tracing", -] - -[[package]] -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array", - "hmac 0.8.1", -] - -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http 1.3.1", -] - -[[package]] -name = "http-body-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" -dependencies = [ - "bytes", - "futures-core", - "http 1.3.1", - "http-body 1.0.1", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "humantime" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" - -[[package]] -name = "hyper" -version = "0.14.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.27", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.5.10", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" -dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "h2 0.4.12", - "http 1.3.1", - "http-body 1.0.1", - "httparse", - "itoa", - "pin-project-lite", - "pin-utils", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" -dependencies = [ - "futures-util", - "http 0.2.12", - "hyper 0.14.32", - "rustls 0.21.12", - "tokio", - "tokio-rustls 0.24.1", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" -dependencies = [ - "http 1.3.1", - "hyper 1.8.1", - "hyper-util", - "rustls 0.23.35", - "rustls-pki-types", - "tokio", - "tokio-rustls 0.26.4", - "tower-service", - "webpki-roots 1.0.4", -] - -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper 0.14.32", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper 1.8.1", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" -dependencies = [ - "base64 0.22.1", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http 1.3.1", - "http-body 1.0.1", - "hyper 1.8.1", - "ipnet", - "libc", - "percent-encoding", - "pin-project-lite", - "socket2 0.6.1", - "system-configuration 0.6.1", - "tokio", - "tower-service", - "tracing", - "windows-registry", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "icu_collections" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" - -[[package]] -name = "icu_properties" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" - -[[package]] -name = "icu_provider" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" -dependencies = [ - "equivalent", - "hashbrown 0.16.1", - "serde", - "serde_core", -] - -[[package]] -name = "indicatif" -version = "0.17.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" -dependencies = [ - "console", - "number_prefix", - "portable-atomic", - "unicode-width", - "web-time", -] - -[[package]] -name = "inout" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" -dependencies = [ - "generic-array", -] - -[[package]] -name = "ipnet" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" - -[[package]] -name = "iri-string" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "jobserver" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" -dependencies = [ - "getrandom 0.3.4", - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "jsonrpc-core" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" -dependencies = [ - "futures", - "futures-executor", - "futures-util", - "log", - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "kaigan" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba15de5aeb137f0f65aa3bf82187647f1285abfe5b20c80c2c37f7007ad519a" -dependencies = [ - "borsh 0.10.4", - "serde", -] - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.177" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" - -[[package]] -name = "libsecp256k1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" -dependencies = [ - "arrayref", - "base64 0.12.3", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "light-account-checks" -version = "0.5.1" -dependencies = [ - "solana-account-info", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "solana-sysvar", - "thiserror 2.0.17", -] - -[[package]] -name = "light-array-map" -version = "0.1.0" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "light-bounded-vec" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cfa375d028164719e3ffef93d2e5c27855cc8a5bb5bf257b868d17c12a3e66" -dependencies = [ - "bytemuck", - "memoffset", - "solana-program-error", - "thiserror 1.0.69", -] - -[[package]] -name = "light-client" -version = "0.16.0" -dependencies = [ - "async-trait", - "base64 0.13.1", - "borsh 0.10.4", - "bs58", - "bytemuck", - "lazy_static", - "light-compressed-account", - "light-ctoken-sdk", - "light-concurrent-merkle-tree", - "light-event", - "light-hasher", - "light-indexed-merkle-tree", - "light-merkle-tree-metadata", - "light-prover-client", - "light-sdk", - "litesvm", - "num-bigint 0.4.6", - "num-traits", - "photon-api", - "rand 0.8.5", - "solana-account", - "solana-account-decoder-client-types", - "solana-address-lookup-table-interface", - "solana-banks-client", - "solana-clock", - "solana-commitment-config", - "solana-compute-budget-interface", - "solana-epoch-info", - "solana-hash", - "solana-instruction", - "solana-keypair", - "solana-message", - "solana-program-error", - "solana-pubkey", - "solana-rpc-client", - "solana-rpc-client-api", - "solana-signature", - "solana-signer", - "solana-transaction", - "solana-transaction-error", - "solana-transaction-status-client-types", - "thiserror 2.0.17", - "tokio", - "tracing", -] - -[[package]] -name = "light-compressed-account" -version = "0.6.2" -dependencies = [ - "anchor-lang", - "borsh 0.10.4", - "bytemuck", - "light-hasher", - "light-macros", - "light-poseidon 0.3.0", - "light-program-profiler", - "light-zero-copy", - "pinocchio", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "thiserror 2.0.17", - "tinyvec", - "zerocopy", -] - -[[package]] -name = "light-ctoken-sdk" -version = "0.1.0" -dependencies = [ - "arrayvec", - "borsh 0.10.4", - "light-account-checks", - "light-compressed-account", - "light-ctoken-types", - "light-compressible", - "light-ctoken-interface", - "light-macros", - "light-program-profiler", - "light-sdk", - "light-sdk-types", - "light-zero-copy", - "solana-account-info", - "solana-cpi", - "solana-instruction", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "spl-pod", - "spl-token-2022 7.0.0", - "thiserror 2.0.17", -] - -[[package]] -name = "light-ctoken-types" -version = "0.1.0" -dependencies = [ - "borsh 0.10.4", - "light-account-checks", - "light-compressed-account", - "light-macros", - "light-sdk-types", - "solana-msg", - "thiserror 2.0.17", -] - -[[package]] -name = "light-compressible" -version = "0.1.0" -dependencies = [ - "aligned-sized", - "borsh 0.10.4", - "bytemuck", - "light-account-checks", - "light-compressed-account", - "light-hasher", - "light-macros", - "light-program-profiler", - "light-zero-copy", - "pinocchio", - "pinocchio-pubkey", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "solana-sysvar", - "thiserror 2.0.17", - "zerocopy", -] - -[[package]] -name = "light-compressible-client" -version = "0.13.1" -dependencies = [ - "anchor-lang", - "borsh 0.10.4", - "light-client", - "light-sdk", - "solana-account", - "solana-instruction", - "solana-pubkey", - "thiserror 2.0.17", -] - -[[package]] -name = "light-concurrent-merkle-tree" -version = "4.0.1" -dependencies = [ - "borsh 0.10.4", - "light-bounded-vec", - "light-hasher", - "memoffset", - "solana-program-error", - "thiserror 2.0.17", -] - -[[package]] -name = "light-ctoken-interface" -version = "0.1.0" -dependencies = [ - "aligned-sized", - "borsh 0.10.4", - "bytemuck", - "light-array-map", - "light-compressed-account", - "light-compressible", - "light-hasher", - "light-macros", - "light-program-profiler", - "light-zero-copy", - "pinocchio", - "pinocchio-pubkey", - "solana-account-info", - "solana-pubkey", - "spl-pod", - "spl-token-2022 7.0.0", - "thiserror 2.0.17", - "tinyvec", - "zerocopy", -] - -[[package]] -name = "light-event" -version = "0.1.1" -dependencies = [ - "borsh 0.10.4", - "light-compressed-account", - "light-hasher", - "light-zero-copy", - "thiserror 2.0.17", -] - -[[package]] -name = "light-hasher" -version = "5.0.0" -dependencies = [ - "ark-bn254 0.5.0", - "ark-ff 0.5.0", - "borsh 0.10.4", - "light-poseidon 0.3.0", - "num-bigint 0.4.6", - "sha2 0.10.9", - "sha3", - "solana-program-error", - "thiserror 2.0.17", - "tinyvec", -] - -[[package]] -name = "light-indexed-array" -version = "0.3.0" -dependencies = [ - "light-hasher", - "num-bigint 0.4.6", - "num-traits", - "thiserror 2.0.17", -] - -[[package]] -name = "light-indexed-merkle-tree" -version = "4.0.1" -dependencies = [ - "light-bounded-vec", - "light-concurrent-merkle-tree", - "light-hasher", - "light-merkle-tree-reference", - "num-bigint 0.4.6", - "num-traits", - "solana-program-error", - "thiserror 2.0.17", -] - -[[package]] -name = "light-macros" -version = "2.2.0" -dependencies = [ - "bs58", - "proc-macro2", - "quote", - "solana-pubkey", - "syn 2.0.110", -] - -[[package]] -name = "light-merkle-tree-metadata" -version = "0.6.0" -dependencies = [ - "anchor-lang", - "borsh 0.10.4", - "bytemuck", - "light-compressed-account", - "solana-msg", - "solana-program-error", - "solana-sysvar", - "thiserror 2.0.17", - "zerocopy", -] - -[[package]] -name = "light-merkle-tree-reference" -version = "4.0.0" -dependencies = [ - "light-hasher", - "light-indexed-array", - "num-bigint 0.4.6", - "num-traits", - "thiserror 2.0.17", -] - -[[package]] -name = "light-poseidon" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" -dependencies = [ - "ark-bn254 0.4.0", - "ark-ff 0.4.2", - "num-bigint 0.4.6", - "thiserror 1.0.69", -] - -[[package]] -name = "light-poseidon" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3d87542063daaccbfecd78b60f988079b6ec4e089249658b9455075c78d42" -dependencies = [ - "ark-bn254 0.5.0", - "ark-ff 0.5.0", - "num-bigint 0.4.6", - "thiserror 1.0.69", -] - -[[package]] -name = "light-profiler-macro" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a8be18fe4de58a6f754caa74a3fbc6d8a758a26f1f3c24d5b0f5b55df5f5408" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "light-program-profiler" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1d345871581aebd8825868a3f08410290aa1cdddcb189ca7f7e588f61d79fcf" -dependencies = [ - "light-profiler-macro", -] - -[[package]] -name = "light-program-test" -version = "0.16.0" -dependencies = [ - "anchor-lang", - "async-trait", - "base64 0.22.1", - "borsh 0.10.4", - "bs58", - "bytemuck", - "chrono", - "light-client", - "light-compressed-account", - "light-ctoken-sdk", - "light-compressible-client", - "light-event", - "light-hasher", - "light-indexed-array", - "light-indexed-merkle-tree", - "light-merkle-tree-metadata", - "light-merkle-tree-reference", - "light-prover-client", - "light-sdk", - "light-sdk-types", - "light-zero-copy", - "litesvm", - "log", - "num-bigint 0.4.6", - "num-traits", - "photon-api", - "rand 0.8.5", - "reqwest 0.12.24", - "serde", - "serde_json", - "solana-account", - "solana-banks-client", - "solana-compute-budget", - "solana-instruction", - "solana-pubkey", - "solana-rpc-client-api", - "solana-sdk", - "solana-transaction", - "solana-transaction-status", - "solana-transaction-status-client-types", - "spl-token-2022 7.0.0", - "tabled", - "tokio", -] - -[[package]] -name = "light-prover-client" -version = "4.0.0" -dependencies = [ - "ark-bn254 0.5.0", - "ark-serialize 0.5.0", - "ark-std 0.5.0", - "light-hasher", - "light-indexed-array", - "light-sparse-merkle-tree", - "num-bigint 0.4.6", - "num-traits", - "reqwest 0.11.27", - "serde", - "serde_json", - "solana-bn254", - "thiserror 2.0.17", - "tokio", - "tracing", -] - -[[package]] -name = "light-sdk" -version = "0.16.0" -dependencies = [ - "anchor-lang", - "bincode", - "borsh 0.10.4", - "light-account-checks", - "light-compressed-account", - "light-ctoken-interface", - "light-hasher", - "light-macros", - "light-sdk-macros", - "light-sdk-types", - "light-zero-copy", - "num-bigint 0.4.6", - "solana-account-info", - "solana-clock", - "solana-cpi", - "solana-instruction", - "solana-loader-v3-interface", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "solana-system-interface", - "solana-sysvar", - "thiserror 2.0.17", -] - -[[package]] -name = "light-sdk-macros" -version = "0.16.0" -dependencies = [ - "light-hasher", - "proc-macro2", - "quote", - "solana-pubkey", - "syn 2.0.110", -] - -[[package]] -name = "light-sdk-types" -version = "0.16.0" -dependencies = [ - "anchor-lang", - "borsh 0.10.4", - "light-account-checks", - "light-compressed-account", - "light-hasher", - "light-macros", - "solana-msg", - "thiserror 2.0.17", -] - -[[package]] -name = "light-sparse-merkle-tree" -version = "0.3.0" -dependencies = [ - "light-hasher", - "light-indexed-array", - "num-bigint 0.4.6", - "num-traits", - "thiserror 2.0.17", -] - -[[package]] -name = "light-zero-copy" -version = "0.5.0" -dependencies = [ - "light-zero-copy-derive", - "zerocopy", -] - -[[package]] -name = "light-zero-copy-derive" -version = "0.5.0" -dependencies = [ - "lazy_static", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "linux-raw-sys" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" - -[[package]] -name = "litemap" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" - -[[package]] -name = "litesvm" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bca37ac374948b348e29c74b324dc36f18bbbd1ccf80e2046d967521cbd143" -dependencies = [ - "agave-feature-set", - "agave-precompiles", - "agave-reserved-account-keys", - "ansi_term", - "bincode", - "indexmap 2.12.1", - "itertools 0.14.0", - "log", - "solana-account", - "solana-address-lookup-table-interface", - "solana-bpf-loader-program", - "solana-builtins", - "solana-clock", - "solana-compute-budget", - "solana-compute-budget-instruction", - "solana-epoch-rewards", - "solana-epoch-schedule", - "solana-fee", - "solana-fee-structure", - "solana-hash", - "solana-instruction", - "solana-instructions-sysvar", - "solana-keypair", - "solana-last-restart-slot", - "solana-loader-v3-interface", - "solana-loader-v4-interface", - "solana-log-collector", - "solana-message", - "solana-native-token 3.0.0", - "solana-nonce", - "solana-nonce-account", - "solana-precompile-error", - "solana-program-error", - "solana-program-runtime", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-sha256-hasher", - "solana-signature", - "solana-signer", - "solana-slot-hashes", - "solana-slot-history", - "solana-stake-interface", - "solana-svm-callback", - "solana-svm-transaction", - "solana-system-interface", - "solana-system-program", - "solana-sysvar", - "solana-sysvar-id", - "solana-timings", - "solana-transaction", - "solana-transaction-context", - "solana-transaction-error", - "solana-vote-program", - "thiserror 2.0.17", -] - -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" - -[[package]] -name = "lru-slab" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" - -[[package]] -name = "memchr" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" - -[[package]] -name = "memmap2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - -[[package]] -name = "merlin" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.6.4", - "zeroize", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mime_guess" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" -dependencies = [ - "mime", - "unicase", -] - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "mio" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" -dependencies = [ - "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.61.2", -] - -[[package]] -name = "native-ctoken-examples" -version = "0.1.0" -dependencies = [ - "borsh 0.10.4", - "light-client", - "light-compressed-account", - "light-ctoken-sdk", - "light-ctoken-types", - "light-compressible-client", - "light-ctoken-interface", - "light-program-test", - "light-sdk", - "light-sdk-types", - "solana-program", - "solana-sdk", - "tokio", -] - -[[package]] -name = "native-tls" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "num" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" -dependencies = [ - "num-bigint 0.2.6", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", - "serde", -] - -[[package]] -name = "num-complex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint 0.2.6", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_enum" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" -dependencies = [ - "num_enum_derive", - "rustversion", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" -dependencies = [ - "proc-macro-crate 3.4.0", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - -[[package]] -name = "openssl" -version = "0.10.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" -dependencies = [ - "bitflags 2.10.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "openssl-src" -version = "300.5.4+3.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507b3792995dae9b0df8a1c1e3771e8418b7c2d9f0baeba32e6fe8b06c7cb72" -dependencies = [ - "cc", -] - -[[package]] -name = "openssl-sys" -version = "0.9.111" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" -dependencies = [ - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "opentelemetry" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" -dependencies = [ - "async-trait", - "crossbeam-channel", - "futures-channel", - "futures-executor", - "futures-util", - "js-sys", - "lazy_static", - "percent-encoding", - "pin-project", - "rand 0.8.5", - "thiserror 1.0.69", -] - -[[package]] -name = "papergrid" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6978128c8b51d8f4080631ceb2302ab51e32cc6e8615f735ee2f83fd269ae3f1" -dependencies = [ - "bytecount", - "fnv", - "unicode-width", -] - -[[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-link", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "percentage" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd23b938276f14057220b707937bcb42fa76dda7560e57a2da30cb52d557937" -dependencies = [ - "num", -] - -[[package]] -name = "photon-api" -version = "0.52.0" -dependencies = [ - "reqwest 0.12.24", - "serde", - "serde_derive", - "serde_json", - "serde_with", - "url", - "uuid", -] - -[[package]] -name = "pin-project" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pinocchio" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b971851087bc3699b001954ad02389d50c41405ece3548cbcafc88b3e20017a" - -[[package]] -name = "pinocchio-pubkey" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0225638cadcbebae8932cb7f49cb5da7c15c21beb19f048f05a5ca7d93f065" -dependencies = [ - "five8_const", - "pinocchio", - "sha2-const-stable", -] - -[[package]] -name = "pkg-config" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - -[[package]] -name = "polyval" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "portable-atomic" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" - -[[package]] -name = "potential_utf" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" -dependencies = [ - "zerovec", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml 0.5.11", -] - -[[package]] -name = "proc-macro-crate" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" -dependencies = [ - "toml_edit 0.23.7", -] - -[[package]] -name = "proc-macro-error-attr2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" -dependencies = [ - "proc-macro2", - "quote", -] - -[[package]] -name = "proc-macro-error2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" -dependencies = [ - "proc-macro-error-attr2", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "proc-macro2" -version = "1.0.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "qstring" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "qualifier_attr" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "quinn" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" -dependencies = [ - "bytes", - "cfg_aliases", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash", - "rustls 0.23.35", - "socket2 0.6.1", - "thiserror 2.0.17", - "tokio", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-proto" -version = "0.11.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" -dependencies = [ - "bytes", - "getrandom 0.3.4", - "lru-slab", - "rand 0.9.2", - "ring", - "rustc-hash", - "rustls 0.23.35", - "rustls-pki-types", - "slab", - "thiserror 2.0.17", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2 0.6.1", - "tracing", - "windows-sys 0.60.2", -] - -[[package]] -name = "quote" -version = "1.0.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" -dependencies = [ - "rand_chacha 0.9.0", - "rand_core 0.9.3", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core 0.9.3", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.16", -] - -[[package]] -name = "rand_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" -dependencies = [ - "getrandom 0.3.4", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rayon" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags 2.10.0", -] - -[[package]] -name = "ref-cast" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "regex" -version = "1.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" - -[[package]] -name = "reqwest" -version = "0.11.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" -dependencies = [ - "base64 0.21.7", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2 0.3.27", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.32", - "hyper-rustls 0.24.2", - "hyper-tls 0.5.0", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls 0.21.12", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper 0.1.2", - "system-configuration 0.5.1", - "tokio", - "tokio-native-tls", - "tokio-rustls 0.24.1", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots 0.25.4", - "winreg", -] - -[[package]] -name = "reqwest" -version = "0.12.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" -dependencies = [ - "async-compression", - "base64 0.22.1", - "bytes", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.4.12", - "http 1.3.1", - "http-body 1.0.1", - "http-body-util", - "hyper 1.8.1", - "hyper-rustls 0.27.7", - "hyper-tls 0.6.0", - "hyper-util", - "js-sys", - "log", - "mime", - "mime_guess", - "native-tls", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls 0.23.35", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper 1.0.2", - "tokio", - "tokio-native-tls", - "tokio-rustls 0.26.4", - "tokio-util 0.7.17", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots 1.0.4", -] - -[[package]] -name = "reqwest-middleware" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57f17d28a6e6acfe1733fe24bcd30774d13bffa4b8a22535b4c8c98423088d4e" -dependencies = [ - "anyhow", - "async-trait", - "http 1.3.1", - "reqwest 0.12.24", - "serde", - "thiserror 1.0.69", - "tower-service", -] - -[[package]] -name = "ring" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.16", - "libc", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" - -[[package]] -name = "rustc-hash" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" -dependencies = [ - "bitflags 2.10.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustls" -version = "0.21.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" -dependencies = [ - "log", - "ring", - "rustls-webpki 0.101.7", - "sct", -] - -[[package]] -name = "rustls" -version = "0.23.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" -dependencies = [ - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki 0.103.8", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - -[[package]] -name = "rustls-pki-types" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" -dependencies = [ - "web-time", - "zeroize", -] - -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "rustls-webpki" -version = "0.103.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "schannel" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "schemars" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.10.0", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde-big-array" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11fc7cc2c76d73e0f27ee52abbd64eec84d46f370c88371120433196934e4b7f" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "serde_json" -version = "1.0.145" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", - "serde_core", -] - -[[package]] -name = "serde_spanned" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10574371d41b0d9b2cff89418eda27da52bcaff2cc8741db26382a77c29131f1" -dependencies = [ - "base64 0.22.1", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.12.1", - "schemars 0.9.0", - "schemars 1.1.0", - "serde_core", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a72d8216842fdd57820dc78d840bef99248e35fb2554ff923319e60f2d686b" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha2-const-stable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9" - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.7", - "keccak", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" -dependencies = [ - "libc", -] - -[[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" - -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - -[[package]] -name = "slab" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" - -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" - -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "socket2" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] - -[[package]] -name = "solana-account" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f949fe4edaeaea78c844023bfc1c898e0b1f5a100f8a8d2d0f85d0a7b090258" -dependencies = [ - "bincode", - "serde", - "serde_bytes", - "serde_derive", - "solana-account-info", - "solana-clock", - "solana-instruction", - "solana-pubkey", - "solana-sdk-ids", - "solana-sysvar", -] - -[[package]] -name = "solana-account-decoder" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba71c97fa4d85ce4a1e0e79044ad0406c419382be598c800202903a7688ce71a" -dependencies = [ - "Inflector", - "base64 0.22.1", - "bincode", - "bs58", - "bv", - "serde", - "serde_derive", - "serde_json", - "solana-account", - "solana-account-decoder-client-types", - "solana-address-lookup-table-interface", - "solana-clock", - "solana-config-program-client", - "solana-epoch-schedule", - "solana-fee-calculator", - "solana-instruction", - "solana-loader-v3-interface", - "solana-nonce", - "solana-program-option", - "solana-program-pack", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-slot-hashes", - "solana-slot-history", - "solana-stake-interface", - "solana-sysvar", - "solana-vote-interface", - "spl-generic-token", - "spl-token 8.0.0", - "spl-token-2022 8.0.1", - "spl-token-group-interface 0.6.0", - "spl-token-metadata-interface 0.7.0", - "thiserror 2.0.17", - "zstd", -] - -[[package]] -name = "solana-account-decoder-client-types" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5519e8343325b707f17fbed54fcefb325131b692506d0af9e08a539d15e4f8cf" -dependencies = [ - "base64 0.22.1", - "bs58", - "serde", - "serde_derive", - "serde_json", - "solana-account", - "solana-pubkey", - "zstd", -] - -[[package]] -name = "solana-account-info" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8f5152a288ef1912300fc6efa6c2d1f9bb55d9398eb6c72326360b8063987da" -dependencies = [ - "bincode", - "serde", - "solana-program-error", - "solana-program-memory", - "solana-pubkey", -] - -[[package]] -name = "solana-address-lookup-table-interface" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1673f67efe870b64a65cb39e6194be5b26527691ce5922909939961a6e6b395" -dependencies = [ - "bincode", - "bytemuck", - "serde", - "serde_derive", - "solana-clock", - "solana-instruction", - "solana-pubkey", - "solana-sdk-ids", - "solana-slot-hashes", -] - -[[package]] -name = "solana-atomic-u64" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52e52720efe60465b052b9e7445a01c17550666beec855cce66f44766697bc2" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "solana-banks-client" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68548570c38a021c724b5aa0112f45a54bdf7ff1b041a042848e034a95a96994" -dependencies = [ - "borsh 1.5.7", - "futures", - "solana-account", - "solana-banks-interface", - "solana-clock", - "solana-commitment-config", - "solana-hash", - "solana-message", - "solana-program-pack", - "solana-pubkey", - "solana-rent", - "solana-signature", - "solana-sysvar", - "solana-transaction", - "solana-transaction-context", - "solana-transaction-error", - "tarpc", - "thiserror 2.0.17", - "tokio", - "tokio-serde", -] - -[[package]] -name = "solana-banks-interface" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6d90edc435bf488ef7abed4dcb1f94fa1970102cbabb25688f58417fd948286" -dependencies = [ - "serde", - "serde_derive", - "solana-account", - "solana-clock", - "solana-commitment-config", - "solana-hash", - "solana-message", - "solana-pubkey", - "solana-signature", - "solana-transaction", - "solana-transaction-context", - "solana-transaction-error", - "tarpc", -] - -[[package]] -name = "solana-big-mod-exp" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75db7f2bbac3e62cfd139065d15bcda9e2428883ba61fc8d27ccb251081e7567" -dependencies = [ - "num-bigint 0.4.6", - "num-traits", - "solana-define-syscall", -] - -[[package]] -name = "solana-bincode" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19a3787b8cf9c9fe3dd360800e8b70982b9e5a8af9e11c354b6665dd4a003adc" -dependencies = [ - "bincode", - "serde", - "solana-instruction", -] - -[[package]] -name = "solana-blake3-hasher" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0801e25a1b31a14494fc80882a036be0ffd290efc4c2d640bfcca120a4672" -dependencies = [ - "blake3", - "solana-define-syscall", - "solana-hash", - "solana-sanitize", -] - -[[package]] -name = "solana-bn254" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4420f125118732833f36facf96a27e7b78314b2d642ba07fa9ffdacd8d79e243" -dependencies = [ - "ark-bn254 0.4.0", - "ark-ec 0.4.2", - "ark-ff 0.4.2", - "ark-serialize 0.4.2", - "bytemuck", - "solana-define-syscall", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-borsh" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718333bcd0a1a7aed6655aa66bef8d7fb047944922b2d3a18f49cbc13e73d004" -dependencies = [ - "borsh 0.10.4", - "borsh 1.5.7", -] - -[[package]] -name = "solana-bpf-loader-program" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aec57dcd80d0f6879956cad28854a6eebaed6b346ce56908ea01a9f36ab259" -dependencies = [ - "bincode", - "libsecp256k1", - "num-traits", - "qualifier_attr", - "scopeguard", - "solana-account", - "solana-account-info", - "solana-big-mod-exp", - "solana-bincode", - "solana-blake3-hasher", - "solana-bn254", - "solana-clock", - "solana-cpi", - "solana-curve25519", - "solana-hash", - "solana-instruction", - "solana-keccak-hasher", - "solana-loader-v3-interface", - "solana-loader-v4-interface", - "solana-log-collector", - "solana-measure", - "solana-packet", - "solana-poseidon", - "solana-program-entrypoint", - "solana-program-runtime", - "solana-pubkey", - "solana-sbpf", - "solana-sdk-ids", - "solana-secp256k1-recover", - "solana-sha256-hasher", - "solana-stable-layout", - "solana-svm-feature-set", - "solana-system-interface", - "solana-sysvar", - "solana-sysvar-id", - "solana-timings", - "solana-transaction-context", - "solana-type-overrides", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-builtins" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d61a31b63b52b0d268cbcd56c76f50314867d7f8e07a0f2c62ee7c9886e07b2" -dependencies = [ - "agave-feature-set", - "solana-bpf-loader-program", - "solana-compute-budget-program", - "solana-hash", - "solana-loader-v4-program", - "solana-program-runtime", - "solana-pubkey", - "solana-sdk-ids", - "solana-stake-program", - "solana-system-program", - "solana-vote-program", - "solana-zk-elgamal-proof-program", - "solana-zk-token-proof-program", -] - -[[package]] -name = "solana-builtins-default-costs" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ca69a299a6c969b18ea381a02b40c9e4dda04b2af0d15a007c1184c82163bbb" -dependencies = [ - "agave-feature-set", - "ahash", - "log", - "solana-bpf-loader-program", - "solana-compute-budget-program", - "solana-loader-v4-program", - "solana-pubkey", - "solana-sdk-ids", - "solana-stake-program", - "solana-system-program", - "solana-vote-program", -] - -[[package]] -name = "solana-client-traits" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83f0071874e629f29e0eb3dab8a863e98502ac7aba55b7e0df1803fc5cac72a7" -dependencies = [ - "solana-account", - "solana-commitment-config", - "solana-epoch-info", - "solana-hash", - "solana-instruction", - "solana-keypair", - "solana-message", - "solana-pubkey", - "solana-signature", - "solana-signer", - "solana-system-interface", - "solana-transaction", - "solana-transaction-error", -] - -[[package]] -name = "solana-clock" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bb482ab70fced82ad3d7d3d87be33d466a3498eb8aa856434ff3c0dfc2e2e31" -dependencies = [ - "serde", - "serde_derive", - "solana-sdk-ids", - "solana-sdk-macro", - "solana-sysvar-id", -] - -[[package]] -name = "solana-cluster-type" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ace9fea2daa28354d107ea879cff107181d85cd4e0f78a2bedb10e1a428c97e" -dependencies = [ - "serde", - "serde_derive", - "solana-hash", -] - -[[package]] -name = "solana-commitment-config" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac49c4dde3edfa832de1697e9bcdb7c3b3f7cb7a1981b7c62526c8bb6700fb73" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "solana-compute-budget" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f4fc63bc2276a1618ca0bfc609da7448534ecb43a1cb387cdf9eaa2dc7bc272" -dependencies = [ - "solana-fee-structure", - "solana-program-runtime", -] - -[[package]] -name = "solana-compute-budget-instruction" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "503d94430f6d3c5ac1e1fa6a342c1c714d5b03c800999e7b6cf235298f0b5341" -dependencies = [ - "agave-feature-set", - "log", - "solana-borsh", - "solana-builtins-default-costs", - "solana-compute-budget", - "solana-compute-budget-interface", - "solana-instruction", - "solana-packet", - "solana-pubkey", - "solana-sdk-ids", - "solana-svm-transaction", - "solana-transaction-error", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-compute-budget-interface" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8432d2c4c22d0499aa06d62e4f7e333f81777b3d7c96050ae9e5cb71a8c3aee4" -dependencies = [ - "borsh 1.5.7", - "serde", - "serde_derive", - "solana-instruction", - "solana-sdk-ids", -] - -[[package]] -name = "solana-compute-budget-program" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072b02beed1862c6b7b7a8a699379594c4470a9371c711856a0a3c266dcf57e5" -dependencies = [ - "solana-program-runtime", -] - -[[package]] -name = "solana-config-program-client" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53aceac36f105fd4922e29b4f0c1f785b69d7b3e7e387e384b8985c8e0c3595e" -dependencies = [ - "bincode", - "borsh 0.10.4", - "kaigan", - "serde", - "solana-program", -] - -[[package]] -name = "solana-cpi" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dc71126edddc2ba014622fc32d0f5e2e78ec6c5a1e0eb511b85618c09e9ea11" -dependencies = [ - "solana-account-info", - "solana-define-syscall", - "solana-instruction", - "solana-program-error", - "solana-pubkey", - "solana-stable-layout", -] - -[[package]] -name = "solana-curve25519" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae4261b9a8613d10e77ac831a8fa60b6fa52b9b103df46d641deff9f9812a23" -dependencies = [ - "bytemuck", - "bytemuck_derive", - "curve25519-dalek 4.1.3", - "solana-define-syscall", - "subtle", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-decode-error" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c781686a18db2f942e70913f7ca15dc120ec38dcab42ff7557db2c70c625a35" -dependencies = [ - "num-traits", -] - -[[package]] -name = "solana-define-syscall" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ae3e2abcf541c8122eafe9a625d4d194b4023c20adde1e251f94e056bb1aee2" - -[[package]] -name = "solana-derivation-path" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "939756d798b25c5ec3cca10e06212bdca3b1443cb9bb740a38124f58b258737b" -dependencies = [ - "derivation-path", - "qstring", - "uriparse", -] - -[[package]] -name = "solana-ed25519-program" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feafa1691ea3ae588f99056f4bdd1293212c7ece28243d7da257c443e84753" -dependencies = [ - "bytemuck", - "bytemuck_derive", - "ed25519-dalek", - "solana-feature-set", - "solana-instruction", - "solana-precompile-error", - "solana-sdk-ids", -] - -[[package]] -name = "solana-epoch-info" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ef6f0b449290b0b9f32973eefd95af35b01c5c0c34c569f936c34c5b20d77b" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "solana-epoch-rewards" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b575d3dd323b9ea10bb6fe89bf6bf93e249b215ba8ed7f68f1a3633f384db7" -dependencies = [ - "serde", - "serde_derive", - "solana-hash", - "solana-sdk-ids", - "solana-sdk-macro", - "solana-sysvar-id", -] - -[[package]] -name = "solana-epoch-rewards-hasher" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c5fd2662ae7574810904585fd443545ed2b568dbd304b25a31e79ccc76e81b" -dependencies = [ - "siphasher", - "solana-hash", - "solana-pubkey", -] - -[[package]] -name = "solana-epoch-schedule" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fce071fbddecc55d727b1d7ed16a629afe4f6e4c217bc8d00af3b785f6f67ed" -dependencies = [ - "serde", - "serde_derive", - "solana-sdk-ids", - "solana-sdk-macro", - "solana-sysvar-id", -] - -[[package]] -name = "solana-example-mocks" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84461d56cbb8bb8d539347151e0525b53910102e4bced875d49d5139708e39d3" -dependencies = [ - "serde", - "serde_derive", - "solana-address-lookup-table-interface", - "solana-clock", - "solana-hash", - "solana-instruction", - "solana-keccak-hasher", - "solana-message", - "solana-nonce", - "solana-pubkey", - "solana-sdk-ids", - "solana-system-interface", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-feature-gate-interface" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f5c5382b449e8e4e3016fb05e418c53d57782d8b5c30aa372fc265654b956d" -dependencies = [ - "bincode", - "serde", - "serde_derive", - "solana-account", - "solana-account-info", - "solana-instruction", - "solana-program-error", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-system-interface", -] - -[[package]] -name = "solana-feature-set" -version = "2.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93b93971e289d6425f88e6e3cb6668c4b05df78b3c518c249be55ced8efd6b6d" -dependencies = [ - "ahash", - "lazy_static", - "solana-epoch-schedule", - "solana-hash", - "solana-pubkey", - "solana-sha256-hasher", -] - -[[package]] -name = "solana-fee" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16beda37597046b1edd1cea6fa7caaed033c091f99ec783fe59c82828bc2adb8" -dependencies = [ - "agave-feature-set", - "solana-fee-structure", - "solana-svm-transaction", -] - -[[package]] -name = "solana-fee-calculator" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89bc408da0fb3812bc3008189d148b4d3e08252c79ad810b245482a3f70cd8d" -dependencies = [ - "log", - "serde", - "serde_derive", -] - -[[package]] -name = "solana-fee-structure" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33adf673581c38e810bf618f745bf31b683a0a4a4377682e6aaac5d9a058dd4e" -dependencies = [ - "serde", - "serde_derive", - "solana-message", - "solana-native-token 2.3.0", -] - -[[package]] -name = "solana-genesis-config" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3725085d47b96d37fef07a29d78d2787fc89a0b9004c66eed7753d1e554989f" -dependencies = [ - "bincode", - "chrono", - "memmap2", - "serde", - "serde_derive", - "solana-account", - "solana-clock", - "solana-cluster-type", - "solana-epoch-schedule", - "solana-fee-calculator", - "solana-hash", - "solana-inflation", - "solana-keypair", - "solana-logger", - "solana-poh-config", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-sha256-hasher", - "solana-shred-version", - "solana-signer", - "solana-time-utils", -] - -[[package]] -name = "solana-hard-forks" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c28371f878e2ead55611d8ba1b5fb879847156d04edea13693700ad1a28baf" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "solana-hash" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b96e9f0300fa287b545613f007dfe20043d7812bee255f418c1eb649c93b63" -dependencies = [ - "borsh 1.5.7", - "bytemuck", - "bytemuck_derive", - "five8", - "js-sys", - "serde", - "serde_derive", - "solana-atomic-u64", - "solana-sanitize", - "wasm-bindgen", -] - -[[package]] -name = "solana-inflation" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23eef6a09eb8e568ce6839573e4966850e85e9ce71e6ae1a6c930c1c43947de3" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "solana-instruction" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab5682934bd1f65f8d2c16f21cb532526fcc1a09f796e2cacdb091eee5774ad" -dependencies = [ - "bincode", - "borsh 1.5.7", - "getrandom 0.2.16", - "js-sys", - "num-traits", - "serde", - "serde_derive", - "serde_json", - "solana-define-syscall", - "solana-pubkey", - "wasm-bindgen", -] - -[[package]] -name = "solana-instructions-sysvar" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0e85a6fad5c2d0c4f5b91d34b8ca47118fc593af706e523cdbedf846a954f57" -dependencies = [ - "bitflags 2.10.0", - "solana-account-info", - "solana-instruction", - "solana-program-error", - "solana-pubkey", - "solana-sanitize", - "solana-sdk-ids", - "solana-serialize-utils", - "solana-sysvar-id", -] - -[[package]] -name = "solana-keccak-hasher" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7aeb957fbd42a451b99235df4942d96db7ef678e8d5061ef34c9b34cae12f79" -dependencies = [ - "sha3", - "solana-define-syscall", - "solana-hash", - "solana-sanitize", -] - -[[package]] -name = "solana-keypair" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd3f04aa1a05c535e93e121a95f66e7dcccf57e007282e8255535d24bf1e98bb" -dependencies = [ - "ed25519-dalek", - "ed25519-dalek-bip32", - "five8", - "rand 0.7.3", - "solana-derivation-path", - "solana-pubkey", - "solana-seed-derivable", - "solana-seed-phrase", - "solana-signature", - "solana-signer", - "wasm-bindgen", -] - -[[package]] -name = "solana-last-restart-slot" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6360ac2fdc72e7463565cd256eedcf10d7ef0c28a1249d261ec168c1b55cdd" -dependencies = [ - "serde", - "serde_derive", - "solana-sdk-ids", - "solana-sdk-macro", - "solana-sysvar-id", -] - -[[package]] -name = "solana-loader-v2-interface" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8ab08006dad78ae7cd30df8eea0539e207d08d91eaefb3e1d49a446e1c49654" -dependencies = [ - "serde", - "serde_bytes", - "serde_derive", - "solana-instruction", - "solana-pubkey", - "solana-sdk-ids", -] - -[[package]] -name = "solana-loader-v3-interface" -version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f7162a05b8b0773156b443bccd674ea78bb9aa406325b467ea78c06c99a63a2" -dependencies = [ - "serde", - "serde_bytes", - "serde_derive", - "solana-instruction", - "solana-pubkey", - "solana-sdk-ids", - "solana-system-interface", -] - -[[package]] -name = "solana-loader-v4-interface" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "706a777242f1f39a83e2a96a2a6cb034cb41169c6ecbee2cf09cb873d9659e7e" -dependencies = [ - "serde", - "serde_bytes", - "serde_derive", - "solana-instruction", - "solana-pubkey", - "solana-sdk-ids", - "solana-system-interface", -] - -[[package]] -name = "solana-loader-v4-program" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6ab01855d851fa2fb6034b0d48de33d77d5c5f5fb4b0353d8e4a934cc03d48a" -dependencies = [ - "log", - "qualifier_attr", - "solana-account", - "solana-bincode", - "solana-bpf-loader-program", - "solana-instruction", - "solana-loader-v3-interface", - "solana-loader-v4-interface", - "solana-log-collector", - "solana-measure", - "solana-packet", - "solana-program-runtime", - "solana-pubkey", - "solana-sbpf", - "solana-sdk-ids", - "solana-transaction-context", - "solana-type-overrides", -] - -[[package]] -name = "solana-log-collector" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d945b1cf5bf7cbd6f5b78795beda7376370c827640df43bb2a1c17b492dc106" -dependencies = [ - "log", -] - -[[package]] -name = "solana-logger" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8e777ec1afd733939b532a42492d888ec7c88d8b4127a5d867eb45c6eb5cd5" -dependencies = [ - "env_logger", - "lazy_static", - "libc", - "log", - "signal-hook", -] - -[[package]] -name = "solana-measure" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11dcd67cd2ae6065e494b64e861e0498d046d95a61cbbf1ae3d58be1ea0f42ed" - -[[package]] -name = "solana-message" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1796aabce376ff74bf89b78d268fa5e683d7d7a96a0a4e4813ec34de49d5314b" -dependencies = [ - "bincode", - "blake3", - "lazy_static", - "serde", - "serde_derive", - "solana-bincode", - "solana-hash", - "solana-instruction", - "solana-pubkey", - "solana-sanitize", - "solana-sdk-ids", - "solana-short-vec", - "solana-system-interface", - "solana-transaction-error", - "wasm-bindgen", -] - -[[package]] -name = "solana-metrics" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0375159d8460f423d39e5103dcff6e07796a5ec1850ee1fcfacfd2482a8f34b5" -dependencies = [ - "crossbeam-channel", - "gethostname", - "log", - "reqwest 0.12.24", - "solana-cluster-type", - "solana-sha256-hasher", - "solana-time-utils", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-msg" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36a1a14399afaabc2781a1db09cb14ee4cc4ee5c7a5a3cfcc601811379a8092" -dependencies = [ - "solana-define-syscall", -] - -[[package]] -name = "solana-native-token" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61515b880c36974053dd499c0510066783f0cc6ac17def0c7ef2a244874cf4a9" - -[[package]] -name = "solana-native-token" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8dd4c280dca9d046139eb5b7a5ac9ad10403fbd64964c7d7571214950d758f" - -[[package]] -name = "solana-nonce" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703e22eb185537e06204a5bd9d509b948f0066f2d1d814a6f475dafb3ddf1325" -dependencies = [ - "serde", - "serde_derive", - "solana-fee-calculator", - "solana-hash", - "solana-pubkey", - "solana-sha256-hasher", -] - -[[package]] -name = "solana-nonce-account" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde971a20b8dbf60144d6a84439dda86b5466e00e2843091fe731083cda614da" -dependencies = [ - "solana-account", - "solana-hash", - "solana-nonce", - "solana-sdk-ids", -] - -[[package]] -name = "solana-offchain-message" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b526398ade5dea37f1f147ce55dae49aa017a5d7326606359b0445ca8d946581" -dependencies = [ - "num_enum", - "solana-hash", - "solana-packet", - "solana-pubkey", - "solana-sanitize", - "solana-sha256-hasher", - "solana-signature", - "solana-signer", -] - -[[package]] -name = "solana-packet" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "004f2d2daf407b3ec1a1ca5ec34b3ccdfd6866dd2d3c7d0715004a96e4b6d127" -dependencies = [ - "bincode", - "bitflags 2.10.0", - "cfg_eval", - "serde", - "serde_derive", - "serde_with", -] - -[[package]] -name = "solana-poh-config" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d650c3b4b9060082ac6b0efbbb66865089c58405bfb45de449f3f2b91eccee75" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "solana-poseidon" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbac4eb90016eeb1d37fa36e592d3a64421510c49666f81020736611c319faff" -dependencies = [ - "ark-bn254 0.4.0", - "light-poseidon 0.2.0", - "solana-define-syscall", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-precompile-error" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d87b2c1f5de77dfe2b175ee8dd318d196aaca4d0f66f02842f80c852811f9f8" -dependencies = [ - "num-traits", - "solana-decode-error", -] - -[[package]] -name = "solana-precompiles" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36e92768a57c652edb0f5d1b30a7d0bc64192139c517967c18600debe9ae3832" -dependencies = [ - "lazy_static", - "solana-ed25519-program", - "solana-feature-set", - "solana-message", - "solana-precompile-error", - "solana-pubkey", - "solana-sdk-ids", - "solana-secp256k1-program", - "solana-secp256r1-program", -] - -[[package]] -name = "solana-presigner" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a57a24e6a4125fc69510b6774cd93402b943191b6cddad05de7281491c90fe" -dependencies = [ - "solana-pubkey", - "solana-signature", - "solana-signer", -] - -[[package]] -name = "solana-program" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98eca145bd3545e2fbb07166e895370576e47a00a7d824e325390d33bf467210" -dependencies = [ - "bincode", - "blake3", - "borsh 0.10.4", - "borsh 1.5.7", - "bs58", - "bytemuck", - "console_error_panic_hook", - "console_log", - "getrandom 0.2.16", - "lazy_static", - "log", - "memoffset", - "num-bigint 0.4.6", - "num-derive", - "num-traits", - "rand 0.8.5", - "serde", - "serde_bytes", - "serde_derive", - "solana-account-info", - "solana-address-lookup-table-interface", - "solana-atomic-u64", - "solana-big-mod-exp", - "solana-bincode", - "solana-blake3-hasher", - "solana-borsh", - "solana-clock", - "solana-cpi", - "solana-decode-error", - "solana-define-syscall", - "solana-epoch-rewards", - "solana-epoch-schedule", - "solana-example-mocks", - "solana-feature-gate-interface", - "solana-fee-calculator", - "solana-hash", - "solana-instruction", - "solana-instructions-sysvar", - "solana-keccak-hasher", - "solana-last-restart-slot", - "solana-loader-v2-interface", - "solana-loader-v3-interface", - "solana-loader-v4-interface", - "solana-message", - "solana-msg", - "solana-native-token 2.3.0", - "solana-nonce", - "solana-program-entrypoint", - "solana-program-error", - "solana-program-memory", - "solana-program-option", - "solana-program-pack", - "solana-pubkey", - "solana-rent", - "solana-sanitize", - "solana-sdk-ids", - "solana-sdk-macro", - "solana-secp256k1-recover", - "solana-serde-varint", - "solana-serialize-utils", - "solana-sha256-hasher", - "solana-short-vec", - "solana-slot-hashes", - "solana-slot-history", - "solana-stable-layout", - "solana-stake-interface", - "solana-system-interface", - "solana-sysvar", - "solana-sysvar-id", - "solana-vote-interface", - "thiserror 2.0.17", - "wasm-bindgen", -] - -[[package]] -name = "solana-program-entrypoint" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ce041b1a0ed275290a5008ee1a4a6c48f5054c8a3d78d313c08958a06aedbd" -dependencies = [ - "solana-account-info", - "solana-msg", - "solana-program-error", - "solana-pubkey", -] - -[[package]] -name = "solana-program-error" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee2e0217d642e2ea4bee237f37bd61bb02aec60da3647c48ff88f6556ade775" -dependencies = [ - "borsh 1.5.7", - "num-traits", - "serde", - "serde_derive", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-pubkey", -] - -[[package]] -name = "solana-program-memory" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a5426090c6f3fd6cfdc10685322fede9ca8e5af43cd6a59e98bfe4e91671712" -dependencies = [ - "solana-define-syscall", -] - -[[package]] -name = "solana-program-option" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc677a2e9bc616eda6dbdab834d463372b92848b2bfe4a1ed4e4b4adba3397d0" - -[[package]] -name = "solana-program-pack" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "319f0ef15e6e12dc37c597faccb7d62525a509fec5f6975ecb9419efddeb277b" -dependencies = [ - "solana-program-error", -] - -[[package]] -name = "solana-program-runtime" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5653001e07b657c9de6f0417cf9add1cf4325903732c480d415655e10cc86704" -dependencies = [ - "base64 0.22.1", - "bincode", - "enum-iterator", - "itertools 0.12.1", - "log", - "percentage", - "rand 0.8.5", - "serde", - "solana-account", - "solana-clock", - "solana-epoch-rewards", - "solana-epoch-schedule", - "solana-fee-structure", - "solana-hash", - "solana-instruction", - "solana-last-restart-slot", - "solana-log-collector", - "solana-measure", - "solana-metrics", - "solana-program-entrypoint", - "solana-pubkey", - "solana-rent", - "solana-sbpf", - "solana-sdk-ids", - "solana-slot-hashes", - "solana-stable-layout", - "solana-svm-callback", - "solana-svm-feature-set", - "solana-system-interface", - "solana-sysvar", - "solana-sysvar-id", - "solana-timings", - "solana-transaction-context", - "solana-type-overrides", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-pubkey" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b62adb9c3261a052ca1f999398c388f1daf558a1b492f60a6d9e64857db4ff1" -dependencies = [ - "borsh 0.10.4", - "borsh 1.5.7", - "bytemuck", - "bytemuck_derive", - "curve25519-dalek 4.1.3", - "five8", - "five8_const", - "getrandom 0.2.16", - "js-sys", - "num-traits", - "rand 0.8.5", - "serde", - "serde_derive", - "solana-atomic-u64", - "solana-decode-error", - "solana-define-syscall", - "solana-sanitize", - "solana-sha256-hasher", - "wasm-bindgen", -] - -[[package]] -name = "solana-quic-definitions" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf0d4d5b049eb1d0c35f7b18f305a27c8986fc5c0c9b383e97adaa35334379e" -dependencies = [ - "solana-keypair", -] - -[[package]] -name = "solana-rent" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1aea8fdea9de98ca6e8c2da5827707fb3842833521b528a713810ca685d2480" -dependencies = [ - "serde", - "serde_derive", - "solana-sdk-ids", - "solana-sdk-macro", - "solana-sysvar-id", -] - -[[package]] -name = "solana-rent-collector" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "127e6dfa51e8c8ae3aa646d8b2672bc4ac901972a338a9e1cd249e030564fb9d" -dependencies = [ - "serde", - "serde_derive", - "solana-account", - "solana-clock", - "solana-epoch-schedule", - "solana-genesis-config", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", -] - -[[package]] -name = "solana-rent-debits" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f6f9113c6003492e74438d1288e30cffa8ccfdc2ef7b49b9e816d8034da18cd" -dependencies = [ - "solana-pubkey", - "solana-reward-info", -] - -[[package]] -name = "solana-reserved-account-keys" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4b22ea19ca2a3f28af7cd047c914abf833486bf7a7c4a10fc652fff09b385b1" -dependencies = [ - "lazy_static", - "solana-feature-set", - "solana-pubkey", - "solana-sdk-ids", -] - -[[package]] -name = "solana-reward-info" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18205b69139b1ae0ab8f6e11cdcb627328c0814422ad2482000fa2ca54ae4a2f" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "solana-rpc-client" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d3161ac0918178e674c1f7f1bfac40de3e7ed0383bd65747d63113c156eaeb" -dependencies = [ - "async-trait", - "base64 0.22.1", - "bincode", - "bs58", - "futures", - "indicatif", - "log", - "reqwest 0.12.24", - "reqwest-middleware", - "semver", - "serde", - "serde_derive", - "serde_json", - "solana-account", - "solana-account-decoder-client-types", - "solana-clock", - "solana-commitment-config", - "solana-epoch-info", - "solana-epoch-schedule", - "solana-feature-gate-interface", - "solana-hash", - "solana-instruction", - "solana-message", - "solana-pubkey", - "solana-rpc-client-api", - "solana-signature", - "solana-transaction", - "solana-transaction-error", - "solana-transaction-status-client-types", - "solana-version", - "solana-vote-interface", - "tokio", -] - -[[package]] -name = "solana-rpc-client-api" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dbc138685c79d88a766a8fd825057a74ea7a21e1dd7f8de275ada899540fff7" -dependencies = [ - "anyhow", - "jsonrpc-core", - "reqwest 0.12.24", - "reqwest-middleware", - "serde", - "serde_derive", - "serde_json", - "solana-account-decoder-client-types", - "solana-clock", - "solana-rpc-client-types", - "solana-signer", - "solana-transaction-error", - "solana-transaction-status-client-types", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-rpc-client-types" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea428a81729255d895ea47fba9b30fd4dacbfe571a080448121bd0592751676" -dependencies = [ - "base64 0.22.1", - "bs58", - "semver", - "serde", - "serde_derive", - "serde_json", - "solana-account", - "solana-account-decoder-client-types", - "solana-clock", - "solana-commitment-config", - "solana-fee-calculator", - "solana-inflation", - "solana-pubkey", - "solana-transaction-error", - "solana-transaction-status-client-types", - "solana-version", - "spl-generic-token", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-sanitize" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f1bc1357b8188d9c4a3af3fc55276e56987265eb7ad073ae6f8180ee54cecf" - -[[package]] -name = "solana-sbpf" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "474a2d95dc819898ded08d24f29642d02189d3e1497bbb442a92a3997b7eb55f" -dependencies = [ - "byteorder", - "combine", - "hash32", - "libc", - "log", - "rand 0.8.5", - "rustc-demangle", - "thiserror 2.0.17", - "winapi", -] - -[[package]] -name = "solana-sdk" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc0e4a7635b902791c44b6581bfb82f3ada32c5bc0929a64f39fe4bb384c86a" -dependencies = [ - "bincode", - "bs58", - "getrandom 0.1.16", - "js-sys", - "serde", - "serde_json", - "solana-account", - "solana-bn254", - "solana-client-traits", - "solana-cluster-type", - "solana-commitment-config", - "solana-compute-budget-interface", - "solana-decode-error", - "solana-derivation-path", - "solana-ed25519-program", - "solana-epoch-info", - "solana-epoch-rewards-hasher", - "solana-feature-set", - "solana-fee-structure", - "solana-genesis-config", - "solana-hard-forks", - "solana-inflation", - "solana-instruction", - "solana-keypair", - "solana-message", - "solana-native-token 2.3.0", - "solana-nonce-account", - "solana-offchain-message", - "solana-packet", - "solana-poh-config", - "solana-precompile-error", - "solana-precompiles", - "solana-presigner", - "solana-program", - "solana-program-memory", - "solana-pubkey", - "solana-quic-definitions", - "solana-rent-collector", - "solana-rent-debits", - "solana-reserved-account-keys", - "solana-reward-info", - "solana-sanitize", - "solana-sdk-ids", - "solana-sdk-macro", - "solana-secp256k1-program", - "solana-secp256k1-recover", - "solana-secp256r1-program", - "solana-seed-derivable", - "solana-seed-phrase", - "solana-serde", - "solana-serde-varint", - "solana-short-vec", - "solana-shred-version", - "solana-signature", - "solana-signer", - "solana-system-transaction", - "solana-time-utils", - "solana-transaction", - "solana-transaction-context", - "solana-transaction-error", - "solana-validator-exit", - "thiserror 2.0.17", - "wasm-bindgen", -] - -[[package]] -name = "solana-sdk-ids" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5d8b9cc68d5c88b062a33e23a6466722467dde0035152d8fb1afbcdf350a5f" -dependencies = [ - "solana-pubkey", -] - -[[package]] -name = "solana-sdk-macro" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86280da8b99d03560f6ab5aca9de2e38805681df34e0bb8f238e69b29433b9df" -dependencies = [ - "bs58", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "solana-secp256k1-program" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f19833e4bc21558fe9ec61f239553abe7d05224347b57d65c2218aeeb82d6149" -dependencies = [ - "bincode", - "digest 0.10.7", - "libsecp256k1", - "serde", - "serde_derive", - "sha3", - "solana-feature-set", - "solana-instruction", - "solana-precompile-error", - "solana-sdk-ids", - "solana-signature", -] - -[[package]] -name = "solana-secp256k1-recover" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baa3120b6cdaa270f39444f5093a90a7b03d296d362878f7a6991d6de3bbe496" -dependencies = [ - "borsh 1.5.7", - "libsecp256k1", - "solana-define-syscall", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-secp256r1-program" -version = "2.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce0ae46da3071a900f02d367d99b2f3058fe2e90c5062ac50c4f20cfedad8f0f" -dependencies = [ - "bytemuck", - "openssl", - "solana-feature-set", - "solana-instruction", - "solana-precompile-error", - "solana-sdk-ids", -] - -[[package]] -name = "solana-security-txt" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "156bb61a96c605fa124e052d630dba2f6fb57e08c7d15b757e1e958b3ed7b3fe" -dependencies = [ - "hashbrown 0.15.2", -] - -[[package]] -name = "solana-seed-derivable" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beb82b5adb266c6ea90e5cf3967235644848eac476c5a1f2f9283a143b7c97f" -dependencies = [ - "solana-derivation-path", -] - -[[package]] -name = "solana-seed-phrase" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36187af2324f079f65a675ec22b31c24919cb4ac22c79472e85d819db9bbbc15" -dependencies = [ - "hmac 0.12.1", - "pbkdf2", - "sha2 0.10.9", -] - -[[package]] -name = "solana-serde" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1931484a408af466e14171556a47adaa215953c7f48b24e5f6b0282763818b04" -dependencies = [ - "serde", -] - -[[package]] -name = "solana-serde-varint" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a7e155eba458ecfb0107b98236088c3764a09ddf0201ec29e52a0be40857113" -dependencies = [ - "serde", -] - -[[package]] -name = "solana-serialize-utils" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "817a284b63197d2b27afdba829c5ab34231da4a9b4e763466a003c40ca4f535e" -dependencies = [ - "solana-instruction", - "solana-pubkey", - "solana-sanitize", -] - -[[package]] -name = "solana-sha256-hasher" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa3feb32c28765f6aa1ce8f3feac30936f16c5c3f7eb73d63a5b8f6f8ecdc44" -dependencies = [ - "sha2 0.10.9", - "solana-define-syscall", - "solana-hash", -] - -[[package]] -name = "solana-short-vec" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c54c66f19b9766a56fa0057d060de8378676cb64987533fa088861858fc5a69" -dependencies = [ - "serde", -] - -[[package]] -name = "solana-shred-version" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afd3db0461089d1ad1a78d9ba3f15b563899ca2386351d38428faa5350c60a98" -dependencies = [ - "solana-hard-forks", - "solana-hash", - "solana-sha256-hasher", -] - -[[package]] -name = "solana-signature" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c8ec8e657aecfc187522fc67495142c12f35e55ddeca8698edbb738b8dbd8c" -dependencies = [ - "ed25519-dalek", - "five8", - "rand 0.8.5", - "serde", - "serde-big-array", - "serde_derive", - "solana-sanitize", -] - -[[package]] -name = "solana-signer" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c41991508a4b02f021c1342ba00bcfa098630b213726ceadc7cb032e051975b" -dependencies = [ - "solana-pubkey", - "solana-signature", - "solana-transaction-error", -] - -[[package]] -name = "solana-slot-hashes" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c8691982114513763e88d04094c9caa0376b867a29577939011331134c301ce" -dependencies = [ - "serde", - "serde_derive", - "solana-hash", - "solana-sdk-ids", - "solana-sysvar-id", -] - -[[package]] -name = "solana-slot-history" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ccc1b2067ca22754d5283afb2b0126d61eae734fc616d23871b0943b0d935e" -dependencies = [ - "bv", - "serde", - "serde_derive", - "solana-sdk-ids", - "solana-sysvar-id", -] - -[[package]] -name = "solana-stable-layout" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f14f7d02af8f2bc1b5efeeae71bc1c2b7f0f65cd75bcc7d8180f2c762a57f54" -dependencies = [ - "solana-instruction", - "solana-pubkey", -] - -[[package]] -name = "solana-stake-interface" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5269e89fde216b4d7e1d1739cf5303f8398a1ff372a81232abbee80e554a838c" -dependencies = [ - "borsh 0.10.4", - "borsh 1.5.7", - "num-traits", - "serde", - "serde_derive", - "solana-clock", - "solana-cpi", - "solana-decode-error", - "solana-instruction", - "solana-program-error", - "solana-pubkey", - "solana-system-interface", - "solana-sysvar-id", -] - -[[package]] -name = "solana-stake-program" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500e9b9d11573f12de91e94f9c4459882cd5ffc692776af49b610d6fcc0b167f" -dependencies = [ - "agave-feature-set", - "bincode", - "log", - "solana-account", - "solana-bincode", - "solana-clock", - "solana-config-program-client", - "solana-genesis-config", - "solana-instruction", - "solana-log-collector", - "solana-native-token 2.3.0", - "solana-packet", - "solana-program-runtime", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-stake-interface", - "solana-sysvar", - "solana-transaction-context", - "solana-type-overrides", - "solana-vote-interface", -] - -[[package]] -name = "solana-svm-callback" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cef9f7d5cfb5d375081a6c8ad712a6f0e055a15890081f845acf55d8254a7a2" -dependencies = [ - "solana-account", - "solana-precompile-error", - "solana-pubkey", -] - -[[package]] -name = "solana-svm-feature-set" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f24b836eb4d74ec255217bdbe0f24f64a07adeac31aca61f334f91cd4a3b1d5" - -[[package]] -name = "solana-svm-transaction" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab717b9539375ebb088872c6c87d1d8832d19f30f154ecc530154d23f60a6f0c" -dependencies = [ - "solana-hash", - "solana-message", - "solana-pubkey", - "solana-sdk-ids", - "solana-signature", - "solana-transaction", -] - -[[package]] -name = "solana-system-interface" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7c18cb1a91c6be5f5a8ac9276a1d7c737e39a21beba9ea710ab4b9c63bc90" -dependencies = [ - "js-sys", - "num-traits", - "serde", - "serde_derive", - "solana-decode-error", - "solana-instruction", - "solana-pubkey", - "wasm-bindgen", -] - -[[package]] -name = "solana-system-program" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ca36cef39aea7761be58d4108a56a2e27042fb1e913355fdb142a05fc7eab7" -dependencies = [ - "bincode", - "log", - "serde", - "serde_derive", - "solana-account", - "solana-bincode", - "solana-fee-calculator", - "solana-instruction", - "solana-log-collector", - "solana-nonce", - "solana-nonce-account", - "solana-packet", - "solana-program-runtime", - "solana-pubkey", - "solana-sdk-ids", - "solana-system-interface", - "solana-sysvar", - "solana-transaction-context", - "solana-type-overrides", -] - -[[package]] -name = "solana-system-transaction" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd98a25e5bcba8b6be8bcbb7b84b24c2a6a8178d7fb0e3077a916855ceba91a" -dependencies = [ - "solana-hash", - "solana-keypair", - "solana-message", - "solana-pubkey", - "solana-signer", - "solana-system-interface", - "solana-transaction", -] - -[[package]] -name = "solana-sysvar" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8c3595f95069f3d90f275bb9bd235a1973c4d059028b0a7f81baca2703815db" -dependencies = [ - "base64 0.22.1", - "bincode", - "bytemuck", - "bytemuck_derive", - "lazy_static", - "serde", - "serde_derive", - "solana-account-info", - "solana-clock", - "solana-define-syscall", - "solana-epoch-rewards", - "solana-epoch-schedule", - "solana-fee-calculator", - "solana-hash", - "solana-instruction", - "solana-instructions-sysvar", - "solana-last-restart-slot", - "solana-program-entrypoint", - "solana-program-error", - "solana-program-memory", - "solana-pubkey", - "solana-rent", - "solana-sanitize", - "solana-sdk-ids", - "solana-sdk-macro", - "solana-slot-hashes", - "solana-slot-history", - "solana-stake-interface", - "solana-sysvar-id", -] - -[[package]] -name = "solana-sysvar-id" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5762b273d3325b047cfda250787f8d796d781746860d5d0a746ee29f3e8812c1" -dependencies = [ - "solana-pubkey", - "solana-sdk-ids", -] - -[[package]] -name = "solana-time-utils" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af261afb0e8c39252a04d026e3ea9c405342b08c871a2ad8aa5448e068c784c" - -[[package]] -name = "solana-timings" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c49b842dfc53c1bf9007eaa6730296dea93b4fce73f457ce1080af43375c0d6" -dependencies = [ - "eager", - "enum-iterator", - "solana-pubkey", -] - -[[package]] -name = "solana-transaction" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80657d6088f721148f5d889c828ca60c7daeedac9a8679f9ec215e0c42bcbf41" -dependencies = [ - "bincode", - "serde", - "serde_derive", - "solana-bincode", - "solana-feature-set", - "solana-hash", - "solana-instruction", - "solana-keypair", - "solana-message", - "solana-precompiles", - "solana-pubkey", - "solana-sanitize", - "solana-sdk-ids", - "solana-short-vec", - "solana-signature", - "solana-signer", - "solana-system-interface", - "solana-transaction-error", - "wasm-bindgen", -] - -[[package]] -name = "solana-transaction-context" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a312304361987a85b2ef2293920558e6612876a639dd1309daf6d0d59ef2fe" -dependencies = [ - "bincode", - "serde", - "serde_derive", - "solana-account", - "solana-instruction", - "solana-instructions-sysvar", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", -] - -[[package]] -name = "solana-transaction-error" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a9dc8fdb61c6088baab34fc3a8b8473a03a7a5fd404ed8dd502fa79b67cb1" -dependencies = [ - "serde", - "serde_derive", - "solana-instruction", - "solana-sanitize", -] - -[[package]] -name = "solana-transaction-status" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135f92f4192cc68900c665becf97fc0a6500ae5a67ff347bf2cbc20ecfefa821" -dependencies = [ - "Inflector", - "agave-reserved-account-keys", - "base64 0.22.1", - "bincode", - "borsh 1.5.7", - "bs58", - "log", - "serde", - "serde_derive", - "serde_json", - "solana-account-decoder", - "solana-address-lookup-table-interface", - "solana-clock", - "solana-hash", - "solana-instruction", - "solana-loader-v2-interface", - "solana-loader-v3-interface", - "solana-message", - "solana-program-option", - "solana-pubkey", - "solana-reward-info", - "solana-sdk-ids", - "solana-signature", - "solana-stake-interface", - "solana-system-interface", - "solana-transaction", - "solana-transaction-error", - "solana-transaction-status-client-types", - "solana-vote-interface", - "spl-associated-token-account", - "spl-memo", - "spl-token 8.0.0", - "spl-token-2022 8.0.1", - "spl-token-group-interface 0.6.0", - "spl-token-metadata-interface 0.7.0", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-transaction-status-client-types" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f1d7c2387c35850848212244d2b225847666cb52d3bd59a5c409d2c300303d" -dependencies = [ - "base64 0.22.1", - "bincode", - "bs58", - "serde", - "serde_derive", - "serde_json", - "solana-account-decoder-client-types", - "solana-commitment-config", - "solana-message", - "solana-reward-info", - "solana-signature", - "solana-transaction", - "solana-transaction-context", - "solana-transaction-error", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-type-overrides" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d80c44761eb398a157d809a04840865c347e1831ae3859b6100c0ee457bc1a" -dependencies = [ - "rand 0.8.5", -] - -[[package]] -name = "solana-validator-exit" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bbf6d7a3c0b28dd5335c52c0e9eae49d0ae489a8f324917faf0ded65a812c1d" - -[[package]] -name = "solana-version" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3324d46c7f7b7f5d34bf7dc71a2883bdc072c7b28ca81d0b2167ecec4cf8da9f" -dependencies = [ - "agave-feature-set", - "rand 0.8.5", - "semver", - "serde", - "serde_derive", - "solana-sanitize", - "solana-serde-varint", -] - -[[package]] -name = "solana-vote-interface" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b80d57478d6599d30acc31cc5ae7f93ec2361a06aefe8ea79bc81739a08af4c3" -dependencies = [ - "bincode", - "num-derive", - "num-traits", - "serde", - "serde_derive", - "solana-clock", - "solana-decode-error", - "solana-hash", - "solana-instruction", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-serde-varint", - "solana-serialize-utils", - "solana-short-vec", - "solana-system-interface", -] - -[[package]] -name = "solana-vote-program" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "908d0e72c8b83e48762eb3e8c9114497cf4b1d66e506e360c46aba9308e71299" -dependencies = [ - "agave-feature-set", - "bincode", - "log", - "num-derive", - "num-traits", - "serde", - "serde_derive", - "solana-account", - "solana-bincode", - "solana-clock", - "solana-epoch-schedule", - "solana-hash", - "solana-instruction", - "solana-keypair", - "solana-metrics", - "solana-packet", - "solana-program-runtime", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-signer", - "solana-slot-hashes", - "solana-transaction", - "solana-transaction-context", - "solana-vote-interface", - "thiserror 2.0.17", -] - -[[package]] -name = "solana-zk-elgamal-proof-program" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70cea14481d8efede6b115a2581f27bc7c6fdfba0752c20398456c3ac1245fc4" -dependencies = [ - "agave-feature-set", - "bytemuck", - "num-derive", - "num-traits", - "solana-instruction", - "solana-log-collector", - "solana-program-runtime", - "solana-sdk-ids", - "solana-zk-sdk", -] - -[[package]] -name = "solana-zk-sdk" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b9fc6ec37d16d0dccff708ed1dd6ea9ba61796700c3bb7c3b401973f10f63b" -dependencies = [ - "aes-gcm-siv", - "base64 0.22.1", - "bincode", - "bytemuck", - "bytemuck_derive", - "curve25519-dalek 4.1.3", - "itertools 0.12.1", - "js-sys", - "merlin", - "num-derive", - "num-traits", - "rand 0.8.5", - "serde", - "serde_derive", - "serde_json", - "sha3", - "solana-derivation-path", - "solana-instruction", - "solana-pubkey", - "solana-sdk-ids", - "solana-seed-derivable", - "solana-seed-phrase", - "solana-signature", - "solana-signer", - "subtle", - "thiserror 2.0.17", - "wasm-bindgen", - "zeroize", -] - -[[package]] -name = "solana-zk-token-proof-program" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579752ad6ea2a671995f13c763bf28288c3c895cb857a518cc4ebab93c9a8dde" -dependencies = [ - "agave-feature-set", - "bytemuck", - "num-derive", - "num-traits", - "solana-instruction", - "solana-log-collector", - "solana-program-runtime", - "solana-sdk-ids", - "solana-zk-token-sdk", -] - -[[package]] -name = "solana-zk-token-sdk" -version = "2.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5055e5df94abd5badf4f947681c893375bdb6f8f543c05d2a7ab9647a6a9d205" -dependencies = [ - "aes-gcm-siv", - "base64 0.22.1", - "bincode", - "bytemuck", - "bytemuck_derive", - "curve25519-dalek 4.1.3", - "itertools 0.12.1", - "merlin", - "num-derive", - "num-traits", - "rand 0.8.5", - "serde", - "serde_derive", - "serde_json", - "sha3", - "solana-curve25519", - "solana-derivation-path", - "solana-instruction", - "solana-pubkey", - "solana-sdk-ids", - "solana-seed-derivable", - "solana-seed-phrase", - "solana-signature", - "solana-signer", - "subtle", - "thiserror 2.0.17", - "zeroize", -] - -[[package]] -name = "spl-associated-token-account" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae179d4a26b3c7a20c839898e6aed84cb4477adf108a366c95532f058aea041b" -dependencies = [ - "borsh 1.5.7", - "num-derive", - "num-traits", - "solana-program", - "spl-associated-token-account-client", - "spl-token 8.0.0", - "spl-token-2022 8.0.1", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-associated-token-account-client" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f8349dbcbe575f354f9a533a21f272f3eb3808a49e2fdc1c34393b88ba76cb" -dependencies = [ - "solana-instruction", - "solana-pubkey", -] - -[[package]] -name = "spl-discriminator" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7398da23554a31660f17718164e31d31900956054f54f52d5ec1be51cb4f4b3" -dependencies = [ - "bytemuck", - "solana-program-error", - "solana-sha256-hasher", - "spl-discriminator-derive", -] - -[[package]] -name = "spl-discriminator-derive" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9e8418ea6269dcfb01c712f0444d2c75542c04448b480e87de59d2865edc750" -dependencies = [ - "quote", - "spl-discriminator-syn", - "syn 2.0.110", -] - -[[package]] -name = "spl-discriminator-syn" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d1dbc82ab91422345b6df40a79e2b78c7bce1ebb366da323572dd60b7076b67" -dependencies = [ - "proc-macro2", - "quote", - "sha2 0.10.9", - "syn 2.0.110", - "thiserror 1.0.69", -] - -[[package]] -name = "spl-elgamal-registry" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce0f668975d2b0536e8a8fd60e56a05c467f06021dae037f1d0cfed0de2e231d" -dependencies = [ - "bytemuck", - "solana-program", - "solana-zk-sdk", - "spl-pod", - "spl-token-confidential-transfer-proof-extraction 0.2.1", -] - -[[package]] -name = "spl-elgamal-registry" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65edfeed09cd4231e595616aa96022214f9c9d2be02dea62c2b30d5695a6833a" -dependencies = [ - "bytemuck", - "solana-account-info", - "solana-cpi", - "solana-instruction", - "solana-msg", - "solana-program-entrypoint", - "solana-program-error", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-system-interface", - "solana-sysvar", - "solana-zk-sdk", - "spl-pod", - "spl-token-confidential-transfer-proof-extraction 0.3.0", -] - -[[package]] -name = "spl-generic-token" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "741a62a566d97c58d33f9ed32337ceedd4e35109a686e31b1866c5dfa56abddc" -dependencies = [ - "bytemuck", - "solana-pubkey", -] - -[[package]] -name = "spl-memo" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f09647c0974e33366efeb83b8e2daebb329f0420149e74d3a4bd2c08cf9f7cb" -dependencies = [ - "solana-account-info", - "solana-instruction", - "solana-msg", - "solana-program-entrypoint", - "solana-program-error", - "solana-pubkey", -] - -[[package]] -name = "spl-pod" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d994afaf86b779104b4a95ba9ca75b8ced3fdb17ee934e38cb69e72afbe17799" -dependencies = [ - "borsh 1.5.7", - "bytemuck", - "bytemuck_derive", - "num-derive", - "num-traits", - "solana-decode-error", - "solana-msg", - "solana-program-error", - "solana-program-option", - "solana-pubkey", - "solana-zk-sdk", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-program-error" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d39b5186f42b2b50168029d81e58e800b690877ef0b30580d107659250da1d1" -dependencies = [ - "num-derive", - "num-traits", - "solana-program", - "spl-program-error-derive 0.4.1", - "thiserror 1.0.69", -] - -[[package]] -name = "spl-program-error" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdebc8b42553070b75aa5106f071fef2eb798c64a7ec63375da4b1f058688c6" -dependencies = [ - "num-derive", - "num-traits", - "solana-decode-error", - "solana-msg", - "solana-program-error", - "spl-program-error-derive 0.5.0", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-program-error-derive" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d375dd76c517836353e093c2dbb490938ff72821ab568b545fd30ab3256b3e" -dependencies = [ - "proc-macro2", - "quote", - "sha2 0.10.9", - "syn 2.0.110", -] - -[[package]] -name = "spl-program-error-derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2539e259c66910d78593475540e8072f0b10f0f61d7607bbf7593899ed52d0" -dependencies = [ - "proc-macro2", - "quote", - "sha2 0.10.9", - "syn 2.0.110", -] - -[[package]] -name = "spl-tlv-account-resolution" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd99ff1e9ed2ab86e3fd582850d47a739fec1be9f4661cba1782d3a0f26805f3" -dependencies = [ - "bytemuck", - "num-derive", - "num-traits", - "solana-account-info", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "spl-discriminator", - "spl-pod", - "spl-program-error 0.6.0", - "spl-type-length-value 0.7.0", - "thiserror 1.0.69", -] - -[[package]] -name = "spl-tlv-account-resolution" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1408e961215688715d5a1063cbdcf982de225c45f99c82b4f7d7e1dd22b998d7" -dependencies = [ - "bytemuck", - "num-derive", - "num-traits", - "solana-account-info", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "spl-discriminator", - "spl-pod", - "spl-program-error 0.7.0", - "spl-type-length-value 0.8.0", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-token" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed320a6c934128d4f7e54fe00e16b8aeaecf215799d060ae14f93378da6dc834" -dependencies = [ - "arrayref", - "bytemuck", - "num-derive", - "num-traits", - "num_enum", - "solana-program", - "thiserror 1.0.69", -] - -[[package]] -name = "spl-token" -version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053067c6a82c705004f91dae058b11b4780407e9ccd6799dc9e7d0fab5f242da" -dependencies = [ - "arrayref", - "bytemuck", - "num-derive", - "num-traits", - "num_enum", - "solana-account-info", - "solana-cpi", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-program-entrypoint", - "solana-program-error", - "solana-program-memory", - "solana-program-option", - "solana-program-pack", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-sysvar", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-token-2022" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9048b26b0df0290f929ff91317c83db28b3ef99af2b3493dd35baa146774924c" -dependencies = [ - "arrayref", - "bytemuck", - "num-derive", - "num-traits", - "num_enum", - "solana-program", - "solana-security-txt", - "solana-zk-sdk", - "spl-elgamal-registry 0.1.1", - "spl-memo", - "spl-pod", - "spl-token 7.0.0", - "spl-token-confidential-transfer-ciphertext-arithmetic 0.2.1", - "spl-token-confidential-transfer-proof-extraction 0.2.1", - "spl-token-confidential-transfer-proof-generation 0.3.0", - "spl-token-group-interface 0.5.0", - "spl-token-metadata-interface 0.6.0", - "spl-transfer-hook-interface 0.9.0", - "spl-type-length-value 0.7.0", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-token-2022" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f0dfbb079eebaee55e793e92ca5f433744f4b71ee04880bfd6beefba5973e5" -dependencies = [ - "arrayref", - "bytemuck", - "num-derive", - "num-traits", - "num_enum", - "solana-account-info", - "solana-clock", - "solana-cpi", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-native-token 2.3.0", - "solana-program-entrypoint", - "solana-program-error", - "solana-program-memory", - "solana-program-option", - "solana-program-pack", - "solana-pubkey", - "solana-rent", - "solana-sdk-ids", - "solana-security-txt", - "solana-system-interface", - "solana-sysvar", - "solana-zk-sdk", - "spl-elgamal-registry 0.2.0", - "spl-memo", - "spl-pod", - "spl-token 8.0.0", - "spl-token-confidential-transfer-ciphertext-arithmetic 0.3.1", - "spl-token-confidential-transfer-proof-extraction 0.3.0", - "spl-token-confidential-transfer-proof-generation 0.4.1", - "spl-token-group-interface 0.6.0", - "spl-token-metadata-interface 0.7.0", - "spl-transfer-hook-interface 0.10.0", - "spl-type-length-value 0.8.0", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-token-confidential-transfer-ciphertext-arithmetic" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170378693c5516090f6d37ae9bad2b9b6125069be68d9acd4865bbe9fc8499fd" -dependencies = [ - "base64 0.22.1", - "bytemuck", - "solana-curve25519", - "solana-zk-sdk", -] - -[[package]] -name = "spl-token-confidential-transfer-ciphertext-arithmetic" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cddd52bfc0f1c677b41493dafa3f2dbbb4b47cf0990f08905429e19dc8289b35" -dependencies = [ - "base64 0.22.1", - "bytemuck", - "solana-curve25519", - "solana-zk-sdk", -] - -[[package]] -name = "spl-token-confidential-transfer-proof-extraction" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff2d6a445a147c9d6dd77b8301b1e116c8299601794b558eafa409b342faf96" -dependencies = [ - "bytemuck", - "solana-curve25519", - "solana-program", - "solana-zk-sdk", - "spl-pod", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-token-confidential-transfer-proof-extraction" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe2629860ff04c17bafa9ba4bed8850a404ecac81074113e1f840dbd0ebb7bd6" -dependencies = [ - "bytemuck", - "solana-account-info", - "solana-curve25519", - "solana-instruction", - "solana-instructions-sysvar", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "solana-sdk-ids", - "solana-zk-sdk", - "spl-pod", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-token-confidential-transfer-proof-generation" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3597628b0d2fe94e7900fd17cdb4cfbb31ee35c66f82809d27d86e44b2848b" -dependencies = [ - "curve25519-dalek 4.1.3", - "solana-zk-sdk", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-token-confidential-transfer-proof-generation" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa27b9174bea869a7ebf31e0be6890bce90b1a4288bc2bbf24bd413f80ae3fde" -dependencies = [ - "curve25519-dalek 4.1.3", - "solana-zk-sdk", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-token-group-interface" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d595667ed72dbfed8c251708f406d7c2814a3fa6879893b323d56a10bedfc799" -dependencies = [ - "bytemuck", - "num-derive", - "num-traits", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "spl-discriminator", - "spl-pod", - "thiserror 1.0.69", -] - -[[package]] -name = "spl-token-group-interface" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5597b4cd76f85ce7cd206045b7dc22da8c25516573d42d267c8d1fd128db5129" -dependencies = [ - "bytemuck", - "num-derive", - "num-traits", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "spl-discriminator", - "spl-pod", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-token-metadata-interface" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb9c89dbc877abd735f05547dcf9e6e12c00c11d6d74d8817506cab4c99fdbb" -dependencies = [ - "borsh 1.5.7", - "num-derive", - "num-traits", - "solana-borsh", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "spl-discriminator", - "spl-pod", - "spl-type-length-value 0.7.0", - "thiserror 1.0.69", -] - -[[package]] -name = "spl-token-metadata-interface" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "304d6e06f0de0c13a621464b1fd5d4b1bebf60d15ca71a44d3839958e0da16ee" -dependencies = [ - "borsh 1.5.7", - "num-derive", - "num-traits", - "solana-borsh", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "spl-discriminator", - "spl-pod", - "spl-type-length-value 0.8.0", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-transfer-hook-interface" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aa7503d52107c33c88e845e1351565050362c2314036ddf19a36cd25137c043" -dependencies = [ - "arrayref", - "bytemuck", - "num-derive", - "num-traits", - "solana-account-info", - "solana-cpi", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "spl-discriminator", - "spl-pod", - "spl-program-error 0.6.0", - "spl-tlv-account-resolution 0.9.0", - "spl-type-length-value 0.7.0", - "thiserror 1.0.69", -] - -[[package]] -name = "spl-transfer-hook-interface" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e905b849b6aba63bde8c4badac944ebb6c8e6e14817029cbe1bc16829133bd" -dependencies = [ - "arrayref", - "bytemuck", - "num-derive", - "num-traits", - "solana-account-info", - "solana-cpi", - "solana-decode-error", - "solana-instruction", - "solana-msg", - "solana-program-error", - "solana-pubkey", - "spl-discriminator", - "spl-pod", - "spl-program-error 0.7.0", - "spl-tlv-account-resolution 0.10.0", - "spl-type-length-value 0.8.0", - "thiserror 2.0.17", -] - -[[package]] -name = "spl-type-length-value" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba70ef09b13af616a4c987797870122863cba03acc4284f226a4473b043923f9" -dependencies = [ - "bytemuck", - "num-derive", - "num-traits", - "solana-account-info", - "solana-decode-error", - "solana-msg", - "solana-program-error", - "spl-discriminator", - "spl-pod", - "thiserror 1.0.69", -] - -[[package]] -name = "spl-type-length-value" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d417eb548214fa822d93f84444024b4e57c13ed6719d4dcc68eec24fb481e9f5" -dependencies = [ - "bytemuck", - "num-derive", - "num-traits", - "solana-account-info", - "solana-decode-error", - "solana-msg", - "solana-program-error", - "spl-discriminator", - "spl-pod", - "thiserror 2.0.17", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.110" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -dependencies = [ - "futures-core", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys 0.5.0", -] - -[[package]] -name = "system-configuration" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" -dependencies = [ - "bitflags 2.10.0", - "core-foundation", - "system-configuration-sys 0.6.0", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "system-configuration-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tabled" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e39a2ee1fbcd360805a771e1b300f78cc88fec7b8d3e2f71cd37bbf23e725c7d" -dependencies = [ - "papergrid", - "tabled_derive", - "testing_table", -] - -[[package]] -name = "tabled_derive" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea5d1b13ca6cff1f9231ffd62f15eefd72543dab5e468735f1a456728a02846" -dependencies = [ - "heck 0.5.0", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "tarpc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38a012bed6fb9681d3bf71ffaa4f88f3b4b9ed3198cda6e4c8462d24d4bb80" -dependencies = [ - "anyhow", - "fnv", - "futures", - "humantime", - "opentelemetry", - "pin-project", - "rand 0.8.5", - "serde", - "static_assertions", - "tarpc-plugins", - "thiserror 1.0.69", - "tokio", - "tokio-serde", - "tokio-util 0.6.10", - "tracing", - "tracing-opentelemetry", -] - -[[package]] -name = "tarpc-plugins" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee42b4e559f17bce0385ebf511a7beb67d5cc33c12c96b7f4e9789919d9c10f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "tempfile" -version = "3.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" -dependencies = [ - "fastrand", - "getrandom 0.3.4", - "once_cell", - "rustix", - "windows-sys 0.61.2", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "testing_table" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8daae29995a24f65619e19d8d31dea5b389f3d853d8bf297bbf607cd0014cc" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" -dependencies = [ - "thiserror-impl 2.0.17", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "thread_local" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "time" -version = "0.3.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" - -[[package]] -name = "time-macros" -version = "0.2.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tinystr" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tinyvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" -dependencies = [ - "bytes", - "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2 0.6.1", - "tokio-macros", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-macros" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls 0.21.12", - "tokio", -] - -[[package]] -name = "tokio-rustls" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" -dependencies = [ - "rustls 0.23.35", - "tokio", -] - -[[package]] -name = "tokio-serde" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "911a61637386b789af998ee23f50aa30d5fd7edcec8d6d3dedae5e5815205466" -dependencies = [ - "bincode", - "bytes", - "educe 0.4.23", - "futures-core", - "futures-sink", - "pin-project", - "serde", - "serde_json", -] - -[[package]] -name = "tokio-util" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "slab", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "toml" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime 0.6.11", - "toml_edit 0.22.27", -] - -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_datetime" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_edit" -version = "0.22.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" -dependencies = [ - "indexmap 2.12.1", - "serde", - "serde_spanned", - "toml_datetime 0.6.11", - "toml_write", - "winnow", -] - -[[package]] -name = "toml_edit" -version = "0.23.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" -dependencies = [ - "indexmap 2.12.1", - "toml_datetime 0.7.3", - "toml_parser", - "winnow", -] - -[[package]] -name = "toml_parser" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" -dependencies = [ - "winnow", -] - -[[package]] -name = "toml_write" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" - -[[package]] -name = "tower" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper 1.0.2", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-http" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" -dependencies = [ - "bitflags 2.10.0", - "bytes", - "futures-util", - "http 1.3.1", - "http-body 1.0.1", - "iri-string", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "tracing-core" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-opentelemetry" -version = "0.17.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" -dependencies = [ - "once_cell", - "opentelemetry", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" -dependencies = [ - "sharded-slab", - "thread_local", - "tracing-core", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "typenum" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" - -[[package]] -name = "unicase" -version = "2.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" - -[[package]] -name = "unicode-ident" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" - -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - -[[package]] -name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -dependencies = [ - "void", -] - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "uriparse" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0200d0fc04d809396c2ad43f3c95da3582a2556eba8d453c1087f4120ee352ff" -dependencies = [ - "fnv", - "lazy_static", -] - -[[package]] -name = "url" -version = "2.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "uuid" -version = "1.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" -dependencies = [ - "getrandom 0.3.4", - "js-sys", - "serde", - "wasm-bindgen", -] - -[[package]] -name = "valuable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.1+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.105" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0" -dependencies = [ - "cfg-if", - "js-sys", - "once_cell", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.105" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.105" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn 2.0.110", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.105" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "web-sys" -version = "0.3.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - -[[package]] -name = "webpki-roots" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" -dependencies = [ - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.5", -] - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.1", - "windows_aarch64_msvc 0.53.1", - "windows_i686_gnu 0.53.1", - "windows_i686_gnullvm 0.53.1", - "windows_i686_msvc 0.53.1", - "windows_x86_64_gnu 0.53.1", - "windows_x86_64_gnullvm 0.53.1", - "windows_x86_64_msvc 0.53.1", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - -[[package]] -name = "winnow" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "wit-bindgen" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" - -[[package]] -name = "writeable" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" - -[[package]] -name = "yoke" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.8.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "zerotrie" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "zstd" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.16+zstd.1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/sdk-tests/sdk-light-token-test/README.md b/sdk-tests/sdk-light-token-test/README.md index 2d10b6397c..87681eb6e5 100644 --- a/sdk-tests/sdk-light-token-test/README.md +++ b/sdk-tests/sdk-light-token-test/README.md @@ -17,7 +17,7 @@ The program showcases **8 different instructions** that cover the core compresse ## Implementation Pattern: Builder Pattern from `ctoken` Module -This implementation uses the **builder pattern** from the `light-ctoken-sdk::ctoken` module. This pattern provides a clean, ergonomic API for CPI operations. +This implementation uses the **builder pattern** from the `light-token-sdk::ctoken` module. This pattern provides a clean, ergonomic API for CPI operations. ### Why Use the Builder Pattern? @@ -66,7 +66,7 @@ transfer_accounts.invoke_signed(&[signer_seeds])?; ### ✅ Fully Implemented (8/8 Instructions) -All instructions use the **builder pattern** from `light-ctoken-sdk::ctoken`: +All instructions use the **builder pattern** from `light-token-sdk::ctoken`: - **create_cmint** (Instruction 0): Create compressed mint using `CreateCMintCpi::invoke()` - **mint_to_ctoken** (Instruction 1): Mint tokens to compressed accounts using `MintToCTokenCpi::invoke()` @@ -94,8 +94,8 @@ ctoken/native/ All dependencies use **path references** to `/Users/ananas/dev/light-protocol2/sdk-libs/`: -- `light-ctoken-sdk` → Main SDK with ctoken builder pattern -- `light-ctoken-types` → Type definitions +- `light-token-sdk` → Main SDK with ctoken builder pattern +- `light-token-types` → Type definitions - `light-sdk` → Core SDK - `light-sdk-types` → Common types - `light-program-test` → Testing framework (dev dependency) diff --git a/sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs b/sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs index fec8f0a63e..0e2d187f84 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs @@ -137,7 +137,7 @@ async fn test_mint_to_ctoken() { compressed_mint_account.tree_info.queue, compressed_mint_account.tree_info.queue, ) - .with_ctoken_accounts(vec![ctoken_account.pubkey()]) + .with_token_accounts(vec![ctoken_account.pubkey()]) .to_account_metas(); wrapper_accounts.extend(account_metas); diff --git a/sdk-tests/sdk-token-test/CLAUDE.md b/sdk-tests/sdk-token-test/CLAUDE.md index 8aa1311507..529305fa61 100644 --- a/sdk-tests/sdk-token-test/CLAUDE.md +++ b/sdk-tests/sdk-token-test/CLAUDE.md @@ -1,7 +1,7 @@ ## TLDR -- this is a test program that tests ctoken instructions with light-ctoken-sdk functions in integration tests -- light-ctoken-sdk: sdk-libs/compressed-token-sdk -- light-token-interface: program-libs/ctoken-types +- this is a test program that tests ctoken instructions with light-token-sdk functions in integration tests +- light-token-sdk: sdk-libs/compressed-token-sdk +- light-token-interface: program-libs/token-interface - light-compressed-token-program: programs/compressed-token/program/ diff --git a/sdk-tests/sdk-token-test/src/process_decompress_full_cpi_context.rs b/sdk-tests/sdk-token-test/src/process_decompress_full_cpi_context.rs index bfe18d49ae..ac0cfca0ce 100644 --- a/sdk-tests/sdk-token-test/src/process_decompress_full_cpi_context.rs +++ b/sdk-tests/sdk-token-test/src/process_decompress_full_cpi_context.rs @@ -1,6 +1,6 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; use light_token_sdk::compressed_token::{ - decompress_full::{decompress_full_ctoken_accounts_with_indices, DecompressFullIndices}, + decompress_full::{decompress_full_token_accounts_with_indices, DecompressFullIndices}, transfer2::Transfer2CpiAccounts, }; @@ -35,7 +35,7 @@ pub fn process_decompress_full_cpi_context<'info>( process_mint_compressed_tokens_cpi_write(&ctx, params, &cpi_accounts)?; } - let instruction = decompress_full_ctoken_accounts_with_indices( + let instruction = decompress_full_token_accounts_with_indices( *ctx.accounts.signer.key, validity_proof, cpi_accounts.cpi_context.map(|x| *x.key), From ced35f7f014d5387dea6c4adf81554d5ab65dc33 Mon Sep 17 00:00:00 2001 From: ananas Date: Tue, 13 Jan 2026 01:54:11 +0000 Subject: [PATCH 6/9] stash remove Token prefixes --- .../compressible/docs/CONFIG_ACCOUNT.md | 2 +- .../src/instructions/mint_action/builder.rs | 4 +- .../src/instructions/transfer2/compression.rs | 6 +- .../tests/compress_only/all.rs | 4 +- .../tests/compress_only/ata_decompress.rs | 36 +- .../compress_only/decompress_restrictions.rs | 4 +- .../compress_only/invalid_destination.rs | 4 +- .../compress_only/invalid_extension_state.rs | 6 +- .../tests/compress_only/mod.rs | 4 +- .../tests/compress_only/withheld_fee.rs | 4 +- .../tests/ctoken/approve_revoke.rs | 6 +- .../tests/ctoken/burn.rs | 24 +- .../tests/ctoken/extensions.rs | 12 +- .../tests/ctoken/extensions_failing.rs | 18 +- .../tests/ctoken/freeze_thaw.rs | 10 +- .../tests/ctoken/functional.rs | 4 +- .../tests/ctoken/functional_ata.rs | 18 +- .../tests/ctoken/shared.rs | 16 +- .../tests/ctoken/transfer.rs | 8 +- .../tests/ctoken/transfer_checked.rs | 10 +- .../tests/freeze/compress_only.rs | 4 +- .../compressed-token-test/tests/mint.rs | 4 +- .../compressed-token-test/tests/mint/burn.rs | 6 +- .../mint/{ctoken_mint_to.rs => mint_to.rs} | 14 +- .../tests/transfer2/compress_failing.rs | 6 +- .../tests/transfer2/compress_spl_failing.rs | 4 +- .../tests/transfer2/decompress_failing.rs | 4 +- .../no_system_program_cpi_failing.rs | 19 +- .../tests/transfer2/shared.rs | 6 +- .../tests/transfer2/spl_ctoken.rs | 6 +- programs/compressed-token/program/CLAUDE.md | 4 +- .../compressed-token/program/docs/ACCOUNTS.md | 2 +- .../program/docs/INSTRUCTIONS.md | 2 +- .../program/docs/ctoken/CREATE.md | 2 +- programs/compressed-token/program/src/lib.rs | 8 +- .../src/actions/transfer2/ctoken_to_spl.rs | 4 +- .../src/actions/transfer2/spl_to_ctoken.rs | 4 +- sdk-libs/token-sdk/src/error.rs | 3 - sdk-libs/token-sdk/src/lib.rs | 11 +- sdk-libs/token-sdk/src/token/approve.rs | 26 +- .../token-sdk/src/token/approve_checked.rs | 26 +- sdk-libs/token-sdk/src/token/burn.rs | 26 +- sdk-libs/token-sdk/src/token/burn_checked.rs | 26 +- sdk-libs/token-sdk/src/token/close.rs | 22 +- sdk-libs/token-sdk/src/token/create_ata.rs | 12 +- sdk-libs/token-sdk/src/token/decompress.rs | 8 +- sdk-libs/token-sdk/src/token/freeze.rs | 26 +- sdk-libs/token-sdk/src/token/mint_to.rs | 503 +++--------------- ..._mint_to_checked.rs => mint_to_checked.rs} | 26 +- sdk-libs/token-sdk/src/token/mod.rs | 44 +- sdk-libs/token-sdk/src/token/revoke.rs | 26 +- sdk-libs/token-sdk/src/token/thaw.rs | 26 +- sdk-libs/token-sdk/src/token/token_mint_to.rs | 128 ----- .../token-sdk/src/token/transfer_interface.rs | 16 +- .../src/token/transfer_spl_to_token.rs | 26 +- .../token-sdk/src/token/transfer_token.rs | 26 +- .../src/token/transfer_token_checked.rs | 26 +- .../src/token/transfer_token_to_spl.rs | 26 +- sdk-tests/sdk-light-token-test/src/approve.rs | 6 +- sdk-tests/sdk-light-token-test/src/burn.rs | 6 +- sdk-tests/sdk-light-token-test/src/close.rs | 6 +- .../sdk-light-token-test/src/create_ata.rs | 8 +- .../sdk-light-token-test/src/create_cmint.rs | 4 +- .../src/ctoken_mint_to.rs | 72 +-- .../src/decompress_cmint.rs | 4 +- sdk-tests/sdk-light-token-test/src/freeze.rs | 6 +- sdk-tests/sdk-light-token-test/src/lib.rs | 40 +- .../src/mint_to_ctoken.rs | 167 ------ sdk-tests/sdk-light-token-test/src/revoke.rs | 6 +- sdk-tests/sdk-light-token-test/src/thaw.rs | 6 +- .../sdk-light-token-test/src/transfer.rs | 6 +- .../src/transfer_checked.rs | 6 +- .../src/transfer_spl_ctoken.rs | 16 +- .../tests/scenario_cmint.rs | 10 +- .../tests/scenario_cmint_compression_only.rs | 6 +- .../tests/scenario_spl.rs | 4 +- .../tests/scenario_spl_restricted_ext.rs | 16 +- .../sdk-light-token-test/tests/shared.rs | 14 +- .../tests/test_mint_to_ctoken.rs | 417 --------------- .../tests/test_transfer_checked.rs | 14 +- .../tests/test_transfer_interface.rs | 18 +- .../tests/test_transfer_spl_ctoken.rs | 24 +- .../src/process_compress_full_and_close.rs | 4 +- .../tests/decompress_full_cpi.rs | 4 +- sdk-tests/sdk-token-test/tests/pda_ctoken.rs | 4 +- .../sdk-token-test/tests/test_4_transfer2.rs | 4 +- .../tests/test_compress_full_and_close.rs | 6 +- 87 files changed, 563 insertions(+), 1699 deletions(-) rename program-tests/compressed-token-test/tests/mint/{ctoken_mint_to.rs => mint_to.rs} (95%) rename sdk-libs/token-sdk/src/token/{token_mint_to_checked.rs => mint_to_checked.rs} (84%) delete mode 100644 sdk-libs/token-sdk/src/token/token_mint_to.rs delete mode 100644 sdk-tests/sdk-light-token-test/src/mint_to_ctoken.rs delete mode 100644 sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs diff --git a/program-libs/compressible/docs/CONFIG_ACCOUNT.md b/program-libs/compressible/docs/CONFIG_ACCOUNT.md index 9502ca44bc..5403e7abea 100644 --- a/program-libs/compressible/docs/CONFIG_ACCOUNT.md +++ b/program-libs/compressible/docs/CONFIG_ACCOUNT.md @@ -74,7 +74,7 @@ let v1_pda = CompressibleConfig::ctoken_v1_config_pda(); **Compressed Token Program (uses config):** - `CreateTokenAccount` (discriminator: 18) - Creates ctoken with compressible extension -- `CreateAssociatedCTokenAccount` (discriminator: 100) - Creates ATA with compressible +- `CreateAssociatedTokenAccount` (discriminator: 100) - Creates ATA with compressible - `Claim` (discriminator: 104) - Claims rent using config parameters - `CompressAndClose` (via Transfer2) - Uses compression_authority from config diff --git a/program-libs/token-interface/src/instructions/mint_action/builder.rs b/program-libs/token-interface/src/instructions/mint_action/builder.rs index a63f14fde4..67aa716dc1 100644 --- a/program-libs/token-interface/src/instructions/mint_action/builder.rs +++ b/program-libs/token-interface/src/instructions/mint_action/builder.rs @@ -84,8 +84,8 @@ impl MintActionCompressedInstructionData { self } - #[must_use = "with_mint_to_token returns a new value"] - pub fn with_mint_to_token(mut self, action: MintToTokenAction) -> Self { + #[must_use = "with_mint_to returns a new value"] + pub fn with_mint_to(mut self, action: MintToTokenAction) -> Self { self.actions.push(Action::MintToToken(action)); self } diff --git a/program-libs/token-interface/src/instructions/transfer2/compression.rs b/program-libs/token-interface/src/instructions/transfer2/compression.rs index 2bc0238187..dd4be64bae 100644 --- a/program-libs/token-interface/src/instructions/transfer2/compression.rs +++ b/program-libs/token-interface/src/instructions/transfer2/compression.rs @@ -110,7 +110,7 @@ impl ZCompression<'_> { impl Compression { #[allow(clippy::too_many_arguments)] - pub fn compress_and_close_token( + pub fn compress_and_close( amount: u64, mint: u8, source: u8, @@ -155,7 +155,7 @@ impl Compression { decimals, } } - pub fn compress_token(amount: u64, mint: u8, source: u8, authority: u8) -> Self { + pub fn compress(amount: u64, mint: u8, source: u8, authority: u8) -> Self { Compression { amount, mode: CompressionMode::Compress, @@ -191,7 +191,7 @@ impl Compression { } } - pub fn decompress_token(amount: u64, mint: u8, recipient: u8) -> Self { + pub fn decompress(amount: u64, mint: u8, recipient: u8) -> Self { Compression { amount, mode: CompressionMode::Decompress, diff --git a/program-tests/compressed-token-test/tests/compress_only/all.rs b/program-tests/compressed-token-test/tests/compress_only/all.rs index 3731aa63f8..8b5720f3ac 100644 --- a/program-tests/compressed-token-test/tests/compress_only/all.rs +++ b/program-tests/compressed-token-test/tests/compress_only/all.rs @@ -31,7 +31,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { state::TokenDataVersion, }; use light_token_sdk::{ - ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, }; @@ -88,7 +88,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { // 3. Transfer tokens to CToken using hot path (required for mints with restricted extensions) let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, decimals: 9, diff --git a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs index 065df67ecc..c299b98060 100644 --- a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs +++ b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs @@ -22,11 +22,11 @@ use light_token_interface::{ state::{ExtensionStruct, TokenDataVersion}, }; use light_token_sdk::{ - ctoken::{ - derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount, CreateTokenAccount, - TransferSplToToken, - }, spl_interface::find_spl_interface_pda_with_index, + token::{ + derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount, CreateTokenAccount, + TransferFromSpl, + }, }; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -79,7 +79,7 @@ async fn setup_ata_compressed_token( let (ata_pubkey, ata_bump) = derive_token_ata(&owner.pubkey(), &mint_pubkey); let create_ata_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), owner.pubkey(), mint_pubkey) + CreateAssociatedTokenAccount::new(payer.pubkey(), owner.pubkey(), mint_pubkey) .with_compressible(CompressibleParams { compressible_config: rpc .test_accounts @@ -107,7 +107,7 @@ async fn setup_ata_compressed_token( let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -248,7 +248,7 @@ async fn test_ata_decompress_to_correct_ata_succeeds() { .unwrap(); // Create destination ATA (idempotent - same address) - let create_dest_ix = CreateAssociatedCTokenAccount::new( + let create_dest_ix = CreateAssociatedTokenAccount::new( context.payer.pubkey(), context.owner.pubkey(), context.mint_pubkey, @@ -347,7 +347,7 @@ async fn test_ata_decompress_to_different_ata_fails() { // Create ATA for same owner but different mint let (ata2_pubkey, _ata2_bump) = derive_token_ata(&context.owner.pubkey(), &mint2_pubkey); - let create_ata2_ix = CreateAssociatedCTokenAccount::new( + let create_ata2_ix = CreateAssociatedTokenAccount::new( context.payer.pubkey(), context.owner.pubkey(), mint2_pubkey, @@ -492,7 +492,7 @@ async fn test_ata_decompress_with_wrong_bump_fails() { .unwrap(); // Create destination ATA - let create_dest_ix = CreateAssociatedCTokenAccount::new( + let create_dest_ix = CreateAssociatedTokenAccount::new( context.payer.pubkey(), context.owner.pubkey(), context.mint_pubkey, @@ -571,7 +571,7 @@ async fn test_decompress_to_account_with_balance_adds() { .unwrap(); // Create destination ATA - let create_dest_ix = CreateAssociatedCTokenAccount::new( + let create_dest_ix = CreateAssociatedTokenAccount::new( context.payer.pubkey(), context.owner.pubkey(), context.mint_pubkey, @@ -687,7 +687,7 @@ async fn test_decompress_skips_delegate_if_destination_has_delegate() { .unwrap(); // Create destination ATA - let create_dest_ix = CreateAssociatedCTokenAccount::new( + let create_dest_ix = CreateAssociatedTokenAccount::new( context.payer.pubkey(), context.owner.pubkey(), context.mint_pubkey, @@ -808,7 +808,7 @@ async fn test_ata_decompress_with_mismatched_amount_fails() { .unwrap(); // Create destination ATA - let create_dest_ix = CreateAssociatedCTokenAccount::new( + let create_dest_ix = CreateAssociatedTokenAccount::new( context.payer.pubkey(), context.owner.pubkey(), context.mint_pubkey, @@ -1022,7 +1022,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { // Create ATA with compression_only=true let create_ata_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), wallet.pubkey(), mint_pubkey) + CreateAssociatedTokenAccount::new(payer.pubkey(), wallet.pubkey(), mint_pubkey) .with_compressible(CompressibleParams { compressible_config: rpc .test_accounts @@ -1049,7 +1049,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix1 = TransferSplToToken { + let transfer_ix1 = TransferFromSpl { amount: amount1, spl_interface_pda_bump, decimals: 9, @@ -1083,7 +1083,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { // Create ATA again (same address) let create_ata_ix2 = - CreateAssociatedCTokenAccount::new(payer.pubkey(), wallet.pubkey(), mint_pubkey) + CreateAssociatedTokenAccount::new(payer.pubkey(), wallet.pubkey(), mint_pubkey) .with_compressible(CompressibleParams { compressible_config: rpc .test_accounts @@ -1104,7 +1104,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { .unwrap(); // Transfer tokens from SPL to ATA - let transfer_ix2 = TransferSplToToken { + let transfer_ix2 = TransferFromSpl { amount: amount2, spl_interface_pda_bump, decimals: 9, @@ -1193,7 +1193,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { // Create ATA again (destination for decompress) let create_ata_ix3 = - CreateAssociatedCTokenAccount::new(payer.pubkey(), wallet.pubkey(), mint_pubkey) + CreateAssociatedTokenAccount::new(payer.pubkey(), wallet.pubkey(), mint_pubkey) .with_compressible(CompressibleParams { compressible_config: rpc .test_accounts @@ -1377,7 +1377,7 @@ async fn test_non_ata_compress_only_decompress() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, decimals: 9, diff --git a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs index 9e35301ce2..919b71dd4f 100644 --- a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs +++ b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs @@ -22,7 +22,7 @@ use light_token_interface::{ state::TokenDataVersion, }; use light_token_sdk::{ - ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, }; use serial_test::serial; @@ -94,7 +94,7 @@ async fn setup_compressed_token_for_decompress( .any(|ext| RESTRICTED_EXTENSIONS.contains(ext)); let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, decimals: 9, diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs index f70123c153..a70723b939 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs @@ -25,7 +25,7 @@ use light_token_interface::{ state::TokenDataVersion, }; use light_token_sdk::{ - ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, }; use serial_test::serial; @@ -130,7 +130,7 @@ async fn setup_compressed_token_for_decompress( .any(|ext| RESTRICTED_EXTENSIONS.contains(ext)); let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, decimals: 9, diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs index 3f193ef022..2282960e1f 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs @@ -27,7 +27,7 @@ use light_token_interface::{ }; use light_token_sdk::{ constants::CPI_AUTHORITY_PDA, - ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken, TransferTokenToSpl}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl, TransferToSpl}, spl_interface::find_spl_interface_pda_with_index as sdk_find_spl_interface_pda, }; use serial_test::serial; @@ -295,7 +295,7 @@ async fn setup_ctoken_for_bypass_test( let (spl_interface_pda, spl_interface_pda_bump) = sdk_find_spl_interface_pda(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, decimals: 9, @@ -348,7 +348,7 @@ async fn test_ctoken_to_spl_bypasses_non_zero_fee() { let (spl_interface_pda, spl_interface_pda_bump) = sdk_find_spl_interface_pda(&mint_pubkey, 0, true); - let transfer_ix = TransferTokenToSpl { + let transfer_ix = TransferToSpl { source_ctoken_account: ctoken_account, destination_spl_token_account: spl_dest, amount: 100_000_000, diff --git a/program-tests/compressed-token-test/tests/compress_only/mod.rs b/program-tests/compressed-token-test/tests/compress_only/mod.rs index 276947122c..664cd42c14 100644 --- a/program-tests/compressed-token-test/tests/compress_only/mod.rs +++ b/program-tests/compressed-token-test/tests/compress_only/mod.rs @@ -166,7 +166,7 @@ pub async fn run_compress_and_close_extension_test( }, }; use light_token_sdk::{ - ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, }; @@ -229,7 +229,7 @@ pub async fn run_compress_and_close_extension_test( let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted_extensions); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, decimals: 9, diff --git a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs index 54351ab1c6..73281ddb80 100644 --- a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs +++ b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs @@ -21,7 +21,7 @@ use light_token_interface::{ }, }; use light_token_sdk::{ - ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, }; use serial_test::serial; @@ -79,7 +79,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError // 4. Transfer tokens to CToken let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); // true = restricted - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, decimals: 9, diff --git a/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs b/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs index d3d336e47e..ae1e2e6752 100644 --- a/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs +++ b/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs @@ -343,7 +343,7 @@ use anchor_lang::AnchorDeserialize; use light_program_test::program_test::TestRpc; use light_test_utils::RpcError; use light_token_interface::state::{Token, TokenDataVersion}; -use light_token_sdk::token::{ApproveToken, CreateTokenAccount, RevokeToken}; +use light_token_sdk::token::{Approve, CreateTokenAccount, Revoke}; use solana_sdk::program_pack::Pack; use super::extensions::setup_extensions_test; @@ -431,7 +431,7 @@ async fn test_approve_revoke_compressible() -> Result<(), RpcError> { // 3. Approve 10 tokens to delegate let approve_amount = 10u64; - let approve_ix = ApproveToken { + let approve_ix = Approve { token_account: account_pubkey, delegate: delegate.pubkey(), owner: owner.pubkey(), @@ -457,7 +457,7 @@ async fn test_approve_revoke_compressible() -> Result<(), RpcError> { .await; // 5. Revoke delegation - let revoke_ix = RevokeToken { + let revoke_ix = Revoke { token_account: account_pubkey, owner: owner.pubkey(), } diff --git a/program-tests/compressed-token-test/tests/ctoken/burn.rs b/program-tests/compressed-token-test/tests/ctoken/burn.rs index 6eba8b62c6..041ffa6d66 100644 --- a/program-tests/compressed-token-test/tests/ctoken/burn.rs +++ b/program-tests/compressed-token-test/tests/ctoken/burn.rs @@ -24,7 +24,7 @@ use light_test_utils::assert_ctoken_burn::assert_ctoken_burn; use light_token_client::instructions::mint_action::DecompressMintParams; use light_token_sdk::{ compressed_token::create_compressed_mint::find_cmint_address, - token::{derive_token_ata, BurnToken, CreateAssociatedTokenAccount, TokenMintTo}, + token::{derive_token_ata, Burn, CreateAssociatedTokenAccount, MintTo}, }; use super::shared::*; @@ -42,7 +42,7 @@ async fn test_burn_success_cases() { let burn_amount = 50u64; // Burn 50 tokens - let burn_ix = BurnToken { + let burn_ix = Burn { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: burn_amount, @@ -73,7 +73,7 @@ async fn test_burn_success_cases() { let burn_amount = 100u64; // Burn all 100 tokens - let burn_ix = BurnToken { + let burn_ix = Burn { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: burn_amount, @@ -123,7 +123,7 @@ async fn test_burn_fails() { let (other_cmint_pda, _) = find_cmint_address(&other_mint_seed.pubkey()); // Try to burn with wrong mint - let burn_ix = BurnToken { + let burn_ix = Burn { source: ctx.ctoken_account, cmint: other_cmint_pda, // Wrong mint amount: 50, @@ -153,7 +153,7 @@ async fn test_burn_fails() { let non_existent = Pubkey::new_unique(); - let burn_ix = BurnToken { + let burn_ix = Burn { source: non_existent, cmint: ctx.cmint_pda, amount: 50, @@ -199,7 +199,7 @@ async fn test_burn_fails() { ctx.rpc .set_account(wrong_owner_account.pubkey(), account_with_wrong_owner); - let burn_ix = BurnToken { + let burn_ix = Burn { source: wrong_owner_account.pubkey(), cmint: ctx.cmint_pda, amount: 50, @@ -229,7 +229,7 @@ async fn test_burn_fails() { let mut ctx = setup_burn_test().await; // Try to burn more than balance (100 tokens) - let burn_ix = BurnToken { + let burn_ix = Burn { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 200, // More than 100 balance @@ -264,7 +264,7 @@ async fn test_burn_fails() { .await .unwrap(); - let burn_ix = BurnToken { + let burn_ix = Burn { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 50, @@ -365,7 +365,7 @@ async fn setup_burn_test() -> BurnTestContext { .unwrap(); // Step 3: Mint 100 tokens to the CToken account - let mint_ix = TokenMintTo { + let mint_ix = MintTo { cmint: cmint_pda, destination: ctoken_ata, amount: 100, @@ -397,7 +397,7 @@ async fn setup_burn_test() -> BurnTestContext { // Burn Checked Tests // ============================================================================ -use light_token_sdk::token::BurnTokenChecked; +use light_token_sdk::token::BurnChecked; /// MintDecimalsMismatch error code (SplMintDecimalsMismatch = 6166) const MINT_DECIMALS_MISMATCH: u32 = 6166; @@ -409,7 +409,7 @@ async fn test_burn_checked_success() { let burn_amount = 50u64; // Burn 50 tokens with correct decimals (8) - let burn_ix = BurnTokenChecked { + let burn_ix = BurnChecked { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: burn_amount, @@ -441,7 +441,7 @@ async fn test_burn_checked_wrong_decimals() { let mut ctx = setup_burn_test().await; // Try to burn with wrong decimals (7 instead of 8) - let burn_ix = BurnTokenChecked { + let burn_ix = BurnChecked { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 50, diff --git a/program-tests/compressed-token-test/tests/ctoken/extensions.rs b/program-tests/compressed-token-test/tests/ctoken/extensions.rs index b57b95c7cf..72b6a8a053 100644 --- a/program-tests/compressed-token-test/tests/ctoken/extensions.rs +++ b/program-tests/compressed-token-test/tests/ctoken/extensions.rs @@ -82,7 +82,7 @@ async fn test_mint_and_compress_with_extensions() { use light_token_interface::state::TokenDataVersion; use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, - token::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, }; let mut context = setup_extensions_test().await.unwrap(); @@ -149,7 +149,7 @@ async fn test_mint_and_compress_with_extensions() { // Use restricted=true because this mint has restricted extensions (PermanentDelegate, etc.) let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: transfer_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -287,7 +287,7 @@ async fn test_transfer_with_permanent_delegate() { use light_token_interface::state::TokenDataVersion; use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, - token::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, }; use solana_sdk::{instruction::Instruction, program_pack::Pack}; @@ -394,7 +394,7 @@ async fn test_transfer_with_permanent_delegate() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_spl_to_ctoken_ix = TransferSplToToken { + let transfer_spl_to_ctoken_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -488,7 +488,7 @@ async fn test_transfer_with_owner_authority() { use light_token_interface::state::{AccountState, Token, TokenDataVersion}; use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, - token::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, }; use solana_sdk::{instruction::Instruction, program_pack::Pack}; @@ -622,7 +622,7 @@ async fn test_transfer_with_owner_authority() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_spl_to_ctoken_ix = TransferSplToToken { + let transfer_spl_to_ctoken_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, diff --git a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs b/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs index 05318701df..033d1c3c50 100644 --- a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs +++ b/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs @@ -2,7 +2,7 @@ //! //! This module tests extension validation for operations that FAIL with invalid state: //! 1. CTokenTransfer(Checked) - transfers between CToken accounts -//! 2. SPL → CToken (TransferSplToToken) - entering via Compress mode +//! 2. SPL → CToken (TransferFromSpl) - entering via Compress mode //! //! Note: CToken → SPL (TransferTokenToSpl) is a BYPASS operation and is tested //! in compress_only/invalid_extension_state.rs. It succeeds with invalid extension @@ -19,7 +19,7 @@ use light_test_utils::{ use light_token_interface::state::TokenDataVersion; use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, - token::{CompressibleParams, CreateTokenAccount, TransferSplToToken, TransferTokenChecked}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl, TransferChecked}, }; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -142,7 +142,7 @@ async fn setup_ctoken_accounts_for_transfer( let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_spl_to_ctoken_ix = TransferSplToToken { + let transfer_spl_to_ctoken_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -188,7 +188,7 @@ async fn test_ctoken_transfer_fails_when_mint_paused() { pause_mint(&mut context.rpc, &mint_pubkey).await; // Attempt transfer - should fail with MintPaused - let transfer_ix = TransferTokenChecked { + let transfer_ix = TransferChecked { source, mint: mint_pubkey, destination, @@ -235,7 +235,7 @@ async fn test_ctoken_transfer_fails_with_non_zero_transfer_fee() { set_mint_transfer_fee(&mut context.rpc, &mint_pubkey, 100, 1000).await; // Attempt transfer - should fail with NonZeroTransferFeeNotSupported - let transfer_ix = TransferTokenChecked { + let transfer_ix = TransferChecked { source, mint: mint_pubkey, destination, @@ -283,7 +283,7 @@ async fn test_ctoken_transfer_fails_with_non_nil_transfer_hook() { set_mint_transfer_hook(&mut context.rpc, &mint_pubkey, dummy_hook_program).await; // Attempt transfer - should fail with TransferHookNotSupported - let transfer_ix = TransferTokenChecked { + let transfer_ix = TransferChecked { source, mint: mint_pubkey, destination, @@ -309,7 +309,7 @@ async fn test_ctoken_transfer_fails_with_non_nil_transfer_hook() { } // ============================================================================ -// SPL → CToken Transfer Tests (TransferSplToToken) +// SPL → CToken Transfer Tests (TransferFromSpl) // These should FAIL when extension state is invalid (entering compressed state) // ============================================================================ @@ -390,7 +390,7 @@ async fn test_spl_to_ctoken_fails_when_mint_paused() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: 100_000_000, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -432,7 +432,7 @@ async fn test_spl_to_ctoken_fails_with_non_zero_transfer_fee() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: 100_000_000, spl_interface_pda_bump, source_spl_token_account: spl_account, diff --git a/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs b/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs index 294abf8a12..8c5a46b848 100644 --- a/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs +++ b/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs @@ -11,7 +11,7 @@ use light_test_utils::{ Rpc, RpcError, }; use light_token_interface::state::{AccountState, Token, TokenDataVersion}; -use light_token_sdk::token::{CompressibleParams, CreateTokenAccount, FreezeToken, ThawToken}; +use light_token_sdk::token::{CompressibleParams, CreateTokenAccount, Freeze, Thaw}; use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -74,7 +74,7 @@ async fn test_freeze_thaw_with_basic_mint() -> Result<(), RpcError> { ); // 3. Freeze the account - let freeze_ix = FreezeToken { + let freeze_ix = Freeze { token_account: token_account_pubkey, mint: mint_pubkey, freeze_authority: payer.pubkey(), @@ -89,7 +89,7 @@ async fn test_freeze_thaw_with_basic_mint() -> Result<(), RpcError> { assert_ctoken_freeze(&mut rpc, token_account_pubkey).await; // 5. Thaw the account - let thaw_ix = ThawToken { + let thaw_ix = Thaw { token_account: token_account_pubkey, mint: mint_pubkey, freeze_authority: payer.pubkey(), @@ -170,7 +170,7 @@ async fn test_freeze_thaw_with_extensions() -> Result<(), RpcError> { ); // 2. Freeze the account - let freeze_ix = FreezeToken { + let freeze_ix = Freeze { token_account: account_pubkey, mint: mint_pubkey, freeze_authority: payer.pubkey(), @@ -187,7 +187,7 @@ async fn test_freeze_thaw_with_extensions() -> Result<(), RpcError> { assert_ctoken_freeze(&mut context.rpc, account_pubkey).await; // 4. Thaw the account - let thaw_ix = ThawToken { + let thaw_ix = Thaw { token_account: account_pubkey, mint: mint_pubkey, freeze_authority: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/ctoken/functional.rs b/program-tests/compressed-token-test/tests/ctoken/functional.rs index aae658a0d1..281634291d 100644 --- a/program-tests/compressed-token-test/tests/ctoken/functional.rs +++ b/program-tests/compressed-token-test/tests/ctoken/functional.rs @@ -71,7 +71,7 @@ async fn test_spl_sdk_compatible_account_lifecycle() -> Result<(), RpcError> { let destination_pubkey = destination_keypair.pubkey(); // Close account using SPL SDK compatible instruction - let close_account_ix = CloseTokenAccount::new( + let close_account_ix = CloseAccount::new( light_compressed_token::ID, token_account_pubkey, destination_pubkey, @@ -302,7 +302,7 @@ async fn test_compressible_account_with_compression_authority_lifecycle() { .unwrap(); // Close compressible account using owner - let close_account_ix = CloseTokenAccount::new( + let close_account_ix = CloseAccount::new( light_compressed_token::ID, token_account_pubkey, destination.pubkey(), // destination for user funds diff --git a/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs b/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs index 663d672c76..08c5caf07a 100644 --- a/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs +++ b/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs @@ -1,7 +1,5 @@ use light_test_utils::assert_create_token_account::assert_create_associated_token_account; -use light_token_sdk::token::{ - CloseCTokenAccount, CompressibleParams, CreateAssociatedCTokenAccount, -}; +use light_token_sdk::token::{CloseAccount, CompressibleParams, CreateAssociatedTokenAccount}; use super::shared::*; @@ -31,7 +29,7 @@ async fn test_associated_token_account_operations() { }; let instruction = - CreateAssociatedCTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) + CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) .with_compressible(compressible_params) .instruction() .unwrap(); @@ -80,7 +78,7 @@ async fn test_associated_token_account_operations() { compression_only: true, }; - let compressible_instruction = CreateAssociatedCTokenAccount::new( + let compressible_instruction = CreateAssociatedTokenAccount::new( payer_pubkey, compressible_owner_pubkey, context.mint_pubkey, @@ -130,7 +128,7 @@ async fn test_associated_token_account_operations() { .unwrap(); // Close compressible ATA - let close_account_ix = CloseCTokenAccount::new( + let close_account_ix = CloseAccount::new( light_compressed_token::ID, compressible_ata_pubkey, destination.pubkey(), // destination for user funds @@ -182,7 +180,7 @@ async fn test_create_ata_idempotent() { }; let instruction = - CreateAssociatedCTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) + CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) .with_compressible(compressible_params) .instruction() .unwrap(); @@ -215,7 +213,7 @@ async fn test_create_ata_idempotent() { // Attempt to create the same ATA again using non-idempotent instruction (should fail) let instruction = - CreateAssociatedCTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) + CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) .instruction() .unwrap(); @@ -232,7 +230,7 @@ async fn test_create_ata_idempotent() { // Now try with idempotent instruction (should succeed) let instruction = - CreateAssociatedCTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) + CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey) .idempotent() .instruction() .unwrap(); @@ -309,7 +307,7 @@ async fn test_create_ata_with_prefunded_lamports() { compression_only: true, }; - let instruction = CreateAssociatedCTokenAccount { + let instruction = CreateAssociatedTokenAccount { idempotent: false, bump, payer: payer_pubkey, diff --git a/program-tests/compressed-token-test/tests/ctoken/shared.rs b/program-tests/compressed-token-test/tests/ctoken/shared.rs index 3740e44e10..10397e77f8 100644 --- a/program-tests/compressed-token-test/tests/ctoken/shared.rs +++ b/program-tests/compressed-token-test/tests/ctoken/shared.rs @@ -18,8 +18,8 @@ pub use light_token_client::{ actions::transfer2::compress, instructions::transfer2::CompressInput, }; pub use light_token_sdk::token::{ - derive_token_ata, ApproveToken, CloseTokenAccount, CompressibleParams, - CreateAssociatedTokenAccount, CreateTokenAccount, RevokeToken, + derive_token_ata, Approve, CloseAccount, CompressibleParams, CreateAssociatedTokenAccount, + CreateTokenAccount, Revoke, }; pub use serial_test::serial; pub use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -302,7 +302,7 @@ pub async fn close_and_assert_token_account( .expect("CToken should have Compressible extension"); let rent_sponsor = Pubkey::from(compressible.info.rent_sponsor); - let close_ix = CloseTokenAccount { + let close_ix = CloseAccount { token_program: light_compressed_token::ID, account: token_account_pubkey, destination, @@ -349,7 +349,7 @@ pub async fn close_and_assert_token_account_fails( let payer_pubkey = context.payer.pubkey(); let token_account_pubkey = context.token_account_keypair.pubkey(); - let mut close_ix = CloseTokenAccount { + let mut close_ix = CloseAccount { token_program: light_compressed_token::ID, account: token_account_pubkey, destination, @@ -895,7 +895,7 @@ pub async fn approve_and_assert( println!("Approve initiated for: {}", name); // Use light-token-sdk - let approve_ix = ApproveToken { + let approve_ix = Approve { token_account: context.token_account_keypair.pubkey(), delegate, owner: context.owner_keypair.pubkey(), @@ -939,7 +939,7 @@ pub async fn approve_and_assert_fails( println!("Approve (expecting failure) initiated for: {}", name); // Build using SDK, then modify if needed for max_top_up - let mut instruction = ApproveToken { + let mut instruction = Approve { token_account, delegate, owner: authority.pubkey(), @@ -970,7 +970,7 @@ pub async fn revoke_and_assert(context: &mut AccountTestContext, name: &str) { println!("Revoke initiated for: {}", name); // Use light-token-sdk - let revoke_ix = RevokeToken { + let revoke_ix = Revoke { token_account: context.token_account_keypair.pubkey(), owner: context.owner_keypair.pubkey(), } @@ -1003,7 +1003,7 @@ pub async fn revoke_and_assert_fails( println!("Revoke (expecting failure) initiated for: {}", name); // Build using SDK, then modify if needed for max_top_up - let mut instruction = RevokeToken { + let mut instruction = Revoke { token_account, owner: authority.pubkey(), } diff --git a/program-tests/compressed-token-test/tests/ctoken/transfer.rs b/program-tests/compressed-token-test/tests/ctoken/transfer.rs index 74a147c69c..da7f752a63 100644 --- a/program-tests/compressed-token-test/tests/ctoken/transfer.rs +++ b/program-tests/compressed-token-test/tests/ctoken/transfer.rs @@ -585,7 +585,7 @@ async fn test_ctoken_transfer_max_top_up_exceeded() { // Transfer Checked Helper Functions // ============================================================================ -use light_token_sdk::token::TransferTokenChecked; +use light_token_sdk::token::TransferChecked; /// Setup context with two token accounts for transfer_checked tests using a real SPL Token mint async fn setup_transfer_checked_test_with_spl_mint( @@ -720,7 +720,7 @@ async fn transfer_checked_and_assert( let payer_pubkey = context.payer.pubkey(); - let transfer_ix = TransferTokenChecked { + let transfer_ix = TransferChecked { source, mint, destination, @@ -761,7 +761,7 @@ async fn transfer_checked_and_assert_fails( let payer_pubkey = context.payer.pubkey(); - let transfer_ix = TransferTokenChecked { + let transfer_ix = TransferChecked { source, mint, destination, @@ -933,7 +933,7 @@ async fn test_ctoken_transfer_checked_max_top_up_exceeded() { let owner_keypair = context.owner_keypair.insecure_clone(); let payer_pubkey = context.payer.pubkey(); - let transfer_ix = TransferTokenChecked { + let transfer_ix = TransferChecked { source, mint, destination, diff --git a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs b/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs index 8c42b141c1..4614cc1c1f 100644 --- a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs +++ b/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs @@ -14,8 +14,8 @@ use light_token_interface::state::TokenDataVersion; use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, token::{ - CompressibleParams, CreateTokenAccount, TransferSplToToken, TransferToken, - TransferTokenChecked, + CompressibleParams, CreateTokenAccount, TransferFromSpl, Transfer, + TransferChecked, }, }; use serial_test::serial; @@ -136,7 +136,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); - let transfer_spl_to_ctoken_ix = TransferSplToToken { + let transfer_spl_to_ctoken_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, @@ -160,7 +160,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { // Step 4: Try CTokenTransfer (discriminator 3) - should FAIL with MintRequiredForTransfer (6128) let transfer_amount = 500_000_000u64; - let transfer_ix = TransferToken { + let transfer_ix = Transfer { source: account_a_pubkey, destination: account_b_pubkey, amount: transfer_amount, @@ -181,7 +181,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { println!("CTokenTransfer correctly rejected with MintRequiredForTransfer (6128)"); // Step 5: Use CTokenTransferChecked (discriminator 12) - should SUCCEED - let transfer_checked_ix = TransferTokenChecked { + let transfer_checked_ix = TransferChecked { source: account_a_pubkey, mint: mint_pubkey, destination: account_b_pubkey, diff --git a/program-tests/compressed-token-test/tests/freeze/compress_only.rs b/program-tests/compressed-token-test/tests/freeze/compress_only.rs index 019a3e0e9b..8f26062d44 100644 --- a/program-tests/compressed-token-test/tests/freeze/compress_only.rs +++ b/program-tests/compressed-token-test/tests/freeze/compress_only.rs @@ -25,7 +25,7 @@ use light_token_interface::{ }; use light_token_sdk::{ compat::{AccountState, TokenDataWithMerkleContext}, - ctoken::{CompressibleParams, CreateTokenAccount, TransferSplToToken}, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, }; use serial_test::serial; @@ -217,7 +217,7 @@ async fn run_freeze_thaw_compressed_only_test( .any(|ext| RESTRICTED_EXTENSIONS.contains(ext)); let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, has_restricted); - let transfer_ix = TransferSplToToken { + let transfer_ix = TransferFromSpl { amount: mint_amount, spl_interface_pda_bump, decimals: 9, diff --git a/program-tests/compressed-token-test/tests/mint.rs b/program-tests/compressed-token-test/tests/mint.rs index cf70f9db08..df5323864f 100644 --- a/program-tests/compressed-token-test/tests/mint.rs +++ b/program-tests/compressed-token-test/tests/mint.rs @@ -20,5 +20,5 @@ mod random; #[path = "mint/burn.rs"] mod burn; -#[path = "mint/ctoken_mint_to.rs"] -mod ctoken_mint_to; +#[path = "mint/mint_to.rs"] +mod mint_to; diff --git a/program-tests/compressed-token-test/tests/mint/burn.rs b/program-tests/compressed-token-test/tests/mint/burn.rs index 18133081e6..29b12b3cb4 100644 --- a/program-tests/compressed-token-test/tests/mint/burn.rs +++ b/program-tests/compressed-token-test/tests/mint/burn.rs @@ -4,7 +4,7 @@ use light_token_client::instructions::mint_action::DecompressMintParams; use light_token_interface::instructions::mint_action::Recipient; use light_token_sdk::{ compressed_token::create_compressed_mint::find_cmint_address, - token::{derive_token_ata, BurnToken, CreateAssociatedTokenAccount}, + token::{derive_token_ata, Burn, CreateAssociatedTokenAccount}, }; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -94,7 +94,7 @@ async fn test_ctoken_burn() { let mut ctx = setup_burn_test(1000).await; // First burn: 500 tokens (half) - let burn_ix_1 = BurnToken { + let burn_ix_1 = Burn { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 500, @@ -116,7 +116,7 @@ async fn test_ctoken_burn() { assert_ctoken_burn(&mut ctx.rpc, ctx.ctoken_account, ctx.cmint_pda, 500).await; // Second burn: 500 tokens (remaining half) - let burn_ix_2 = BurnToken { + let burn_ix_2 = Burn { source: ctx.ctoken_account, cmint: ctx.cmint_pda, amount: 500, diff --git a/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs b/program-tests/compressed-token-test/tests/mint/mint_to.rs similarity index 95% rename from program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs rename to program-tests/compressed-token-test/tests/mint/mint_to.rs index 6fe75f09ec..4fc60aa0ca 100644 --- a/program-tests/compressed-token-test/tests/mint/ctoken_mint_to.rs +++ b/program-tests/compressed-token-test/tests/mint/mint_to.rs @@ -3,7 +3,7 @@ use light_test_utils::{assert_ctoken_mint_to::assert_ctoken_mint_to, Rpc}; use light_token_client::instructions::mint_action::DecompressMintParams; use light_token_sdk::{ compressed_token::create_compressed_mint::find_cmint_address, - token::{derive_token_ata, CreateAssociatedTokenAccount, TokenMintTo}, + token::{derive_token_ata, CreateAssociatedTokenAccount, MintTo}, }; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -49,7 +49,7 @@ async fn setup_mint_to_test() -> MintToTestContext { .await .unwrap(); - // Step 2: Create compressed mint + CMint (no recipients - we'll mint via TokenMintTo) + // Step 2: Create compressed mint + CMint (no recipients - we'll mint via MintTo) light_token_client::actions::mint_action_comprehensive( &mut rpc, &mint_seed, @@ -89,7 +89,7 @@ async fn test_ctoken_mint_to() { let mut ctx = setup_mint_to_test().await; // First mint: 500 tokens - let mint_ix_1 = TokenMintTo { + let mint_ix_1 = MintTo { cmint: ctx.cmint_pda, destination: ctx.ctoken_account, amount: 500, @@ -111,7 +111,7 @@ async fn test_ctoken_mint_to() { assert_ctoken_mint_to(&mut ctx.rpc, ctx.ctoken_account, ctx.cmint_pda, 500).await; // Second mint: 500 tokens - let mint_ix_2 = TokenMintTo { + let mint_ix_2 = MintTo { cmint: ctx.cmint_pda, destination: ctx.ctoken_account, amount: 500, @@ -153,7 +153,7 @@ async fn test_ctoken_mint_to() { // MintTo Checked Tests // ============================================================================ -use light_token_sdk::token::TokenMintToChecked; +use light_token_sdk::token::MintToChecked; #[tokio::test] #[serial] @@ -161,7 +161,7 @@ async fn test_ctoken_mint_to_checked_success() { let mut ctx = setup_mint_to_test().await; // Mint 500 tokens with correct decimals (8) - let mint_ix = TokenMintToChecked { + let mint_ix = MintToChecked { cmint: ctx.cmint_pda, destination: ctx.ctoken_account, amount: 500, @@ -203,7 +203,7 @@ async fn test_ctoken_mint_to_checked_wrong_decimals() { let mut ctx = setup_mint_to_test().await; // Try to mint with wrong decimals (7 instead of 8) - let mint_ix = TokenMintToChecked { + let mint_ix = MintToChecked { cmint: ctx.cmint_pda, destination: ctx.ctoken_account, amount: 500, diff --git a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs index 285220d1b8..8ef5809a95 100644 --- a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs @@ -52,7 +52,7 @@ use light_token_sdk::{ }, CTokenAccount2, }, - ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, + token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, ValidityProof, }; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -106,7 +106,7 @@ async fn setup_compression_test(token_amount: u64) -> Result Result<(), RpcError> { }; let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) .with_compressible(compressible_params) .instruction() .map_err(|e| RpcError::AssertRpcError(format!("Failed to create ATA: {:?}", e)))?; diff --git a/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs b/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs index 4023ce3ef3..2686abf6dc 100644 --- a/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs @@ -46,8 +46,8 @@ use light_token_sdk::{ }, CTokenAccount2, }, - ctoken::{derive_token_ata, CreateAssociatedCTokenAccount}, spl_interface::find_spl_interface_pda_with_index, + token::{derive_token_ata, CreateAssociatedTokenAccount}, ValidityProof, }; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -102,7 +102,7 @@ async fn setup_spl_compression_test( airdrop_lamports(&mut rpc, &recipient.pubkey(), 1_000_000_000).await?; // Create compressed token ATA for recipient - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .map_err(|e| { RpcError::AssertRpcError(format!("Failed to create ATA instruction: {}", e)) diff --git a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs index 37e8cb1933..785382ca1b 100644 --- a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs @@ -50,7 +50,7 @@ use light_token_sdk::{ }, CTokenAccount2, }, - ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, + token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, ValidityProof, }; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -106,7 +106,7 @@ async fn setup_decompression_test( }; let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) .with_compressible(compressible_params) .instruction() .map_err(|e| RpcError::AssertRpcError(format!("Failed to create ATA: {:?}", e)))?; diff --git a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs index 993afab3fa..41cd0d90b7 100644 --- a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs @@ -51,7 +51,7 @@ use light_test_utils::{airdrop_lamports, RpcError}; use light_token_interface::instructions::{mint_action::Recipient, transfer2::Compression}; use light_token_sdk::{ compressed_token::create_compressed_mint::find_cmint_address, - ctoken::{derive_token_ata, CreateAssociatedCTokenAccount}, + token::{derive_token_ata, CreateAssociatedTokenAccount}, ValidityProof, }; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; @@ -106,7 +106,7 @@ async fn setup_no_system_program_cpi_test( let (recipient_ata, _) = derive_token_ata(&recipient.pubkey(), &mint); // Create CToken ATA for owner (source) - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) .instruction() .map_err(|e| RpcError::AssertRpcError(format!("Failed to create source ATA: {}", e))) .unwrap(); @@ -115,7 +115,7 @@ async fn setup_no_system_program_cpi_test( .unwrap(); // Create CToken ATA for recipient - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .map_err(|e| RpcError::AssertRpcError(format!("Failed to create recipient ATA: {}", e))) .unwrap(); @@ -712,13 +712,10 @@ async fn test_too_many_mints() { let (recipient_ata, _) = derive_token_ata(&context.recipient.pubkey(), &mint); // Create source ATA - let instruction = CreateAssociatedCTokenAccount::new( - context.payer.pubkey(), - context.owner.pubkey(), - mint, - ) - .instruction() - .unwrap(); + let instruction = + CreateAssociatedTokenAccount::new(context.payer.pubkey(), context.owner.pubkey(), mint) + .instruction() + .unwrap(); context .rpc .create_and_send_transaction(&[instruction], &context.payer.pubkey(), &[&context.payer]) @@ -726,7 +723,7 @@ async fn test_too_many_mints() { .unwrap(); // Create recipient ATA - let instruction = CreateAssociatedCTokenAccount::new( + let instruction = CreateAssociatedTokenAccount::new( context.payer.pubkey(), context.recipient.pubkey(), mint, diff --git a/program-tests/compressed-token-test/tests/transfer2/shared.rs b/program-tests/compressed-token-test/tests/transfer2/shared.rs index 09be15f9d1..f1684f215a 100644 --- a/program-tests/compressed-token-test/tests/transfer2/shared.rs +++ b/program-tests/compressed-token-test/tests/transfer2/shared.rs @@ -27,7 +27,7 @@ use light_token_interface::{ }; use light_token_sdk::{ compressed_token::create_compressed_mint::find_cmint_address, - ctoken::{CompressibleParams, CreateAssociatedCTokenAccount}, + token::{CompressibleParams, CreateAssociatedTokenAccount}, }; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer, transaction::Transaction}; @@ -460,13 +460,13 @@ impl TestContext { token_account_version: TokenDataVersion::ShaFlat, // CompressAndClose requires ShaFlat compression_only: false, }; - CreateAssociatedCTokenAccount::new(payer.pubkey(), signer.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), signer.pubkey(), mint) .with_compressible(compressible_params) .instruction() .unwrap() } else { // Create non-compressible CToken ATA - CreateAssociatedCTokenAccount { + CreateAssociatedTokenAccount { idempotent: false, bump, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs index d880e52d22..f71e47a968 100644 --- a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs +++ b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs @@ -13,7 +13,7 @@ pub use light_test_utils::{ pub use light_token_client::actions::transfer2::{self}; use light_token_interface::instructions::transfer2::{Compression, MultiTokenTransferOutputData}; pub use light_token_sdk::token::{ - derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount, + derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount, }; use light_token_sdk::{ compressed_token::{ @@ -71,7 +71,7 @@ async fn test_spl_to_ctoken_transfer() { .unwrap(); // Create compressed token ATA for recipient - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .map_err(|e| RpcError::AssertRpcError(format!("Failed to create ATA instruction: {}", e))) .unwrap(); @@ -244,7 +244,7 @@ async fn test_failing_ctoken_to_spl_with_compress_and_close() { // Create compressible token ATA for recipient (ATAs require compression_only=true) let (associated_token_account, bump) = derive_token_ata(&recipient.pubkey(), &mint); - let instruction = CreateAssociatedCTokenAccount { + let instruction = CreateAssociatedTokenAccount { idempotent: false, bump, payer: payer.pubkey(), diff --git a/programs/compressed-token/program/CLAUDE.md b/programs/compressed-token/program/CLAUDE.md index b9035c9263..36f65b535f 100644 --- a/programs/compressed-token/program/CLAUDE.md +++ b/programs/compressed-token/program/CLAUDE.md @@ -47,7 +47,7 @@ Every instruction description must include the sections: ### Account Management 1. **Create CToken Account** - [`docs/ctoken/CREATE.md`](docs/ctoken/CREATE.md) - Create regular token account (discriminator: 18, enum: `InstructionType::CreateTokenAccount`) - - Create associated token account (discriminator: 100, enum: `InstructionType::CreateAssociatedCTokenAccount`) + - Create associated token account (discriminator: 100, enum: `InstructionType::CreateAssociatedTokenAccount`) - Create associated token account idempotent (discriminator: 102, enum: `InstructionType::CreateAssociatedTokenAccountIdempotent`) - **Config validation:** Requires ACTIVE config only @@ -125,7 +125,7 @@ src/ │ ├── burn.rs # CTokenBurn (8), CTokenBurnChecked (15) │ ├── close/ # CloseTokenAccount instruction (9) │ ├── create.rs # CreateTokenAccount instruction (18) -│ ├── create_ata.rs # CreateAssociatedCTokenAccount (100, 102) +│ ├── create_ata.rs # CreateAssociatedTokenAccount (100, 102) │ ├── freeze_thaw.rs # CTokenFreezeAccount (10), CTokenThawAccount (11) │ ├── mint_to.rs # CTokenMintTo (7), CTokenMintToChecked (14) │ └── transfer/ # CTokenTransfer (3), CTokenTransferChecked (12) diff --git a/programs/compressed-token/program/docs/ACCOUNTS.md b/programs/compressed-token/program/docs/ACCOUNTS.md index 9ba4449cd7..6df1a8941e 100644 --- a/programs/compressed-token/program/docs/ACCOUNTS.md +++ b/programs/compressed-token/program/docs/ACCOUNTS.md @@ -31,7 +31,7 @@ 10. `CTokenMintToChecked` `14` 11. `CTokenBurnChecked` `15` 12. `CreateTokenAccount` `18` - 13. `CreateAssociatedCTokenAccount` `100` + 13. `CreateAssociatedTokenAccount` `100` 14. `Transfer2` `101` - `Decompress`, `DecompressAndClose` 15. `CreateAssociatedTokenAccountIdempotent` `102` 16. `MintAction` `103` - `MintToCToken` diff --git a/programs/compressed-token/program/docs/INSTRUCTIONS.md b/programs/compressed-token/program/docs/INSTRUCTIONS.md index e6935cb0a4..31890f6523 100644 --- a/programs/compressed-token/program/docs/INSTRUCTIONS.md +++ b/programs/compressed-token/program/docs/INSTRUCTIONS.md @@ -47,7 +47,7 @@ This file contains the discriminator reference table and instruction index for t | CTokenMintToChecked | 14 | `InstructionType::CTokenMintToChecked` | MintToChecked | | CTokenBurnChecked | 15 | `InstructionType::CTokenBurnChecked` | BurnChecked | | CreateTokenAccount | 18 | `InstructionType::CreateTokenAccount` | InitializeAccount3 | -| CreateAssociatedCTokenAccount | 100 | `InstructionType::CreateAssociatedCTokenAccount` | - | +| CreateAssociatedTokenAccount | 100 | `InstructionType::CreateAssociatedTokenAccount` | - | | Transfer2 | 101 | `InstructionType::Transfer2` | - | | CreateAssociatedTokenAccountIdempotent | 102 | `InstructionType::CreateAssociatedTokenAccountIdempotent` | - | | MintAction | 103 | `InstructionType::MintAction` | - | diff --git a/programs/compressed-token/program/docs/ctoken/CREATE.md b/programs/compressed-token/program/docs/ctoken/CREATE.md index 9d12262ec1..ca6c9540df 100644 --- a/programs/compressed-token/program/docs/ctoken/CREATE.md +++ b/programs/compressed-token/program/docs/ctoken/CREATE.md @@ -146,7 +146,7 @@ ## 2. create associated ctoken account **discriminator:** 100 (non-idempotent), 102 (idempotent) - **enum:** `CTokenInstruction::CreateAssociatedCTokenAccount` (non-idempotent), `CTokenInstruction::CreateAssociatedTokenAccountIdempotent` (idempotent) + **enum:** `CTokenInstruction::CreateAssociatedTokenAccount` (non-idempotent), `CTokenInstruction::CreateAssociatedTokenAccountIdempotent` (idempotent) **path:** programs/compressed-token/program/src/ctoken/create_ata.rs **description:** diff --git a/programs/compressed-token/program/src/lib.rs b/programs/compressed-token/program/src/lib.rs index 40498c019e..1e833f0d46 100644 --- a/programs/compressed-token/program/src/lib.rs +++ b/programs/compressed-token/program/src/lib.rs @@ -68,7 +68,7 @@ pub enum InstructionType { CTokenBurnChecked = 15, /// Create CToken, equivalent to SPL Token InitializeAccount3 CreateTokenAccount = 18, - CreateAssociatedCTokenAccount = 100, + CreateAssociatedTokenAccount = 100, /// Batch instruction for ctoken transfers: /// 1. transfer compressed tokens /// 2. compress ctokens/spl tokens @@ -111,7 +111,7 @@ impl From for InstructionType { 14 => InstructionType::CTokenMintToChecked, 15 => InstructionType::CTokenBurnChecked, 18 => InstructionType::CreateTokenAccount, - 100 => InstructionType::CreateAssociatedCTokenAccount, + 100 => InstructionType::CreateAssociatedTokenAccount, 101 => InstructionType::Transfer2, 102 => InstructionType::CreateAssociatedTokenAccountIdempotent, 103 => InstructionType::MintAction, @@ -186,8 +186,8 @@ pub fn process_instruction( msg!("CreateTokenAccount"); process_create_token_account(accounts, &instruction_data[1..])?; } - InstructionType::CreateAssociatedCTokenAccount => { - msg!("CreateAssociatedCTokenAccount"); + InstructionType::CreateAssociatedTokenAccount => { + msg!("CreateAssociatedTokenAccount"); process_create_associated_token_account(accounts, &instruction_data[1..])?; } InstructionType::Transfer2 => { diff --git a/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs b/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs index b232f85bfd..72965f53b9 100644 --- a/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs +++ b/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs @@ -3,7 +3,7 @@ use light_client::{ rpc::{Rpc, RpcError}, }; use light_token_sdk::{ - constants::SPL_TOKEN_PROGRAM_ID, ctoken::TransferTokenToSpl, + constants::SPL_TOKEN_PROGRAM_ID, token::TransferToSpl, spl_interface::find_spl_interface_pda, }; use solana_keypair::Keypair; @@ -25,7 +25,7 @@ pub async fn transfer_ctoken_to_spl( ) -> Result { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda(&mint, false); - let transfer_ix = TransferTokenToSpl { + let transfer_ix = TransferToSpl { source_ctoken_account, destination_spl_token_account, amount, diff --git a/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs b/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs index dc35962af2..b1333668ad 100644 --- a/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs +++ b/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs @@ -3,7 +3,7 @@ use light_client::{ rpc::{Rpc, RpcError}, }; use light_token_sdk::{ - constants::SPL_TOKEN_PROGRAM_ID, ctoken::TransferSplToToken, + constants::SPL_TOKEN_PROGRAM_ID, token::TransferFromSpl, spl_interface::find_spl_interface_pda, }; use solana_keypair::Keypair; @@ -35,7 +35,7 @@ pub async fn spl_to_ctoken_transfer( let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda(&mint, false); - let ix = TransferSplToToken { + let ix = TransferFromSpl { amount, spl_interface_pda_bump, source_spl_token_account, diff --git a/sdk-libs/token-sdk/src/error.rs b/sdk-libs/token-sdk/src/error.rs index daeeec5192..48c749f044 100644 --- a/sdk-libs/token-sdk/src/error.rs +++ b/sdk-libs/token-sdk/src/error.rs @@ -9,9 +9,6 @@ use thiserror::Error; pub type Result = std::result::Result; -// Backwards compatibility alias -pub use TokenSdkError as CTokenSdkError; - #[derive(Debug, Error)] pub enum TokenSdkError { #[error("Insufficient balance")] diff --git a/sdk-libs/token-sdk/src/lib.rs b/sdk-libs/token-sdk/src/lib.rs index 5c1411a21c..1a66b5e9b6 100644 --- a/sdk-libs/token-sdk/src/lib.rs +++ b/sdk-libs/token-sdk/src/lib.rs @@ -45,11 +45,11 @@ //! //! | Operation | Instruction Builder | CPI Builder | //! |-----------|----------------|-------------| -//! | Create Associated cToken Account | [`CreateAssociatedCTokenAccount`](token::CreateAssociatedCTokenAccount) | [`CreateAssociatedCTokenAccountCpi`](token::CreateAssociatedCTokenAccountCpi) | +//! | Create Associated cToken Account | [`CreateAssociatedTokenAccount`](token::CreateAssociatedTokenAccount) | [`CreateAssociatedCTokenAccountCpi`](token::CreateAssociatedCTokenAccountCpi) | //! | Create cToken Account | [`CreateTokenAccount`](token::CreateTokenAccount) | [`CreateTokenAccountCpi`](token::CreateTokenAccountCpi) | -//! | Transfer cToken | [`TransferCToken`](token::TransferCToken) | [`TransferCTokenCpi`](token::TransferCTokenCpi) | -//! | Transfer cToken → SPL | [`TransferTokenToSpl`](token::TransferTokenToSpl) | [`TransferTokenToSplCpi`](token::TransferTokenToSplCpi) | -//! | Transfer SPL → cToken | [`TransferSplToToken`](token::TransferSplToToken) | [`TransferSplToTokenCpi`](token::TransferSplToTokenCpi) | +//! | Transfer cToken | [`Transfer`](token::Transfer) | [`TransferCTokenCpi`](token::TransferCTokenCpi) | +//! | Transfer cToken → SPL | [`TransferToSpl`](token::TransferToSpl) | [`TransferToSplCpi`](token::TransferToSplCpi) | +//! | Transfer SPL → cToken | [`TransferFromSpl`](token::TransferFromSpl) | [`TransferFromSplCpi`](token::TransferFromSplCpi) | //! | Transfer (auto-detect) | - | [`TransferInterfaceCpi`](token::TransferInterfaceCpi) | //! | Decompress to cToken account | [`DecompressToCtoken`](token::DecompressToCtoken) | - | //! | Close cToken account | [`CloseCTokenAccount`](token::CloseCTokenAccount) | [`CloseCTokenAccountCpi`](token::CloseCTokenAccountCpi) | @@ -64,9 +64,6 @@ pub mod compressed_token; pub mod compressible; pub mod token; -// Backwards compatibility alias -pub use token as ctoken; - pub mod constants; pub mod error; pub mod pack; diff --git a/sdk-libs/token-sdk/src/token/approve.rs b/sdk-libs/token-sdk/src/token/approve.rs index 2067ba2a68..c7b907e9d9 100644 --- a/sdk-libs/token-sdk/src/token/approve.rs +++ b/sdk-libs/token-sdk/src/token/approve.rs @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Approve a delegate for a CToken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::ApproveToken; +/// # use light_token_sdk::token::Approve; /// # let token_account = Pubkey::new_unique(); /// # let delegate = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); -/// let instruction = ApproveToken { +/// let instruction = Approve { /// token_account, /// delegate, /// owner, @@ -20,7 +20,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ApproveToken { +pub struct Approve { /// CToken account to approve delegation for pub token_account: Pubkey, /// Delegate to approve @@ -33,13 +33,13 @@ pub struct ApproveToken { /// # Approve CToken via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::ApproveTokenCpi; +/// # use light_token_sdk::token::ApproveCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let delegate: AccountInfo = todo!(); /// # let owner: AccountInfo = todo!(); /// # let system_program: AccountInfo = todo!(); -/// ApproveTokenCpi { +/// ApproveCpi { /// token_account, /// delegate, /// owner, @@ -49,7 +49,7 @@ pub struct ApproveToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ApproveTokenCpi<'info> { +pub struct ApproveCpi<'info> { pub token_account: AccountInfo<'info>, pub delegate: AccountInfo<'info>, pub owner: AccountInfo<'info>, @@ -57,13 +57,13 @@ pub struct ApproveTokenCpi<'info> { pub amount: u64, } -impl<'info> ApproveTokenCpi<'info> { +impl<'info> ApproveCpi<'info> { pub fn instruction(&self) -> Result { - ApproveToken::from(self).instruction() + Approve::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = ApproveToken::from(&self).instruction()?; + let instruction = Approve::from(&self).instruction()?; let account_infos = [ self.token_account, self.delegate, @@ -74,7 +74,7 @@ impl<'info> ApproveTokenCpi<'info> { } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = ApproveToken::from(&self).instruction()?; + let instruction = Approve::from(&self).instruction()?; let account_infos = [ self.token_account, self.delegate, @@ -85,8 +85,8 @@ impl<'info> ApproveTokenCpi<'info> { } } -impl<'info> From<&ApproveTokenCpi<'info>> for ApproveToken { - fn from(cpi: &ApproveTokenCpi<'info>) -> Self { +impl<'info> From<&ApproveCpi<'info>> for Approve { + fn from(cpi: &ApproveCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, delegate: *cpi.delegate.key, @@ -96,7 +96,7 @@ impl<'info> From<&ApproveTokenCpi<'info>> for ApproveToken { } } -impl ApproveToken { +impl Approve { pub fn instruction(self) -> Result { let mut data = vec![4u8]; // CTokenApprove discriminator data.extend_from_slice(&self.amount.to_le_bytes()); diff --git a/sdk-libs/token-sdk/src/token/approve_checked.rs b/sdk-libs/token-sdk/src/token/approve_checked.rs index e836d5494e..68473ebdd4 100644 --- a/sdk-libs/token-sdk/src/token/approve_checked.rs +++ b/sdk-libs/token-sdk/src/token/approve_checked.rs @@ -8,12 +8,12 @@ use solana_pubkey::Pubkey; /// # Approve a delegate for a CToken account with decimals validation: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::ApproveTokenChecked; +/// # use light_token_sdk::token::ApproveChecked; /// # let token_account = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let delegate = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); -/// let instruction = ApproveTokenChecked { +/// let instruction = ApproveChecked { /// token_account, /// mint, /// delegate, @@ -24,7 +24,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ApproveTokenChecked { +pub struct ApproveChecked { /// CToken account to approve delegation for pub token_account: Pubkey, /// Mint account (for decimals validation - may be skipped if CToken has cached decimals) @@ -43,14 +43,14 @@ pub struct ApproveTokenChecked { /// # Approve CToken via CPI with decimals validation: /// ```rust,no_run -/// # use light_token_sdk::token::ApproveTokenCheckedCpi; +/// # use light_token_sdk::token::ApproveCheckedCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); /// # let delegate: AccountInfo = todo!(); /// # let owner: AccountInfo = todo!(); /// # let system_program: AccountInfo = todo!(); -/// ApproveTokenCheckedCpi { +/// ApproveCheckedCpi { /// token_account, /// mint, /// delegate, @@ -63,7 +63,7 @@ pub struct ApproveTokenChecked { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ApproveTokenCheckedCpi<'info> { +pub struct ApproveCheckedCpi<'info> { pub token_account: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub delegate: AccountInfo<'info>, @@ -75,13 +75,13 @@ pub struct ApproveTokenCheckedCpi<'info> { pub max_top_up: Option, } -impl<'info> ApproveTokenCheckedCpi<'info> { +impl<'info> ApproveCheckedCpi<'info> { pub fn instruction(&self) -> Result { - ApproveTokenChecked::from(self).instruction() + ApproveChecked::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = ApproveTokenChecked::from(&self).instruction()?; + let instruction = ApproveChecked::from(&self).instruction()?; let account_infos = [ self.token_account, self.mint, @@ -93,7 +93,7 @@ impl<'info> ApproveTokenCheckedCpi<'info> { } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = ApproveTokenChecked::from(&self).instruction()?; + let instruction = ApproveChecked::from(&self).instruction()?; let account_infos = [ self.token_account, self.mint, @@ -105,8 +105,8 @@ impl<'info> ApproveTokenCheckedCpi<'info> { } } -impl<'info> From<&ApproveTokenCheckedCpi<'info>> for ApproveTokenChecked { - fn from(cpi: &ApproveTokenCheckedCpi<'info>) -> Self { +impl<'info> From<&ApproveCheckedCpi<'info>> for ApproveChecked { + fn from(cpi: &ApproveCheckedCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, mint: *cpi.mint.key, @@ -119,7 +119,7 @@ impl<'info> From<&ApproveTokenCheckedCpi<'info>> for ApproveTokenChecked { } } -impl ApproveTokenChecked { +impl ApproveChecked { pub fn instruction(self) -> Result { let mut data = vec![13u8]; // CTokenApproveChecked discriminator (SPL compatible) data.extend_from_slice(&self.amount.to_le_bytes()); diff --git a/sdk-libs/token-sdk/src/token/burn.rs b/sdk-libs/token-sdk/src/token/burn.rs index 5a19712c6c..c6ab2aa9ba 100644 --- a/sdk-libs/token-sdk/src/token/burn.rs +++ b/sdk-libs/token-sdk/src/token/burn.rs @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Burn tokens from a ctoken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::BurnToken; +/// # use light_token_sdk::token::Burn; /// # let source = Pubkey::new_unique(); /// # let cmint = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = BurnToken { +/// let instruction = Burn { /// source, /// cmint, /// amount: 100, @@ -21,7 +21,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct BurnToken { +pub struct Burn { /// CToken account to burn from pub source: Pubkey, /// CMint account (supply tracking) @@ -37,12 +37,12 @@ pub struct BurnToken { /// # Burn ctoken via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::BurnTokenCpi; +/// # use light_token_sdk::token::BurnCpi; /// # use solana_account_info::AccountInfo; /// # let source: AccountInfo = todo!(); /// # let cmint: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// BurnTokenCpi { +/// BurnCpi { /// source, /// cmint, /// amount: 100, @@ -52,7 +52,7 @@ pub struct BurnToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct BurnTokenCpi<'info> { +pub struct BurnCpi<'info> { pub source: AccountInfo<'info>, pub cmint: AccountInfo<'info>, pub amount: u64, @@ -61,26 +61,26 @@ pub struct BurnTokenCpi<'info> { pub max_top_up: Option, } -impl<'info> BurnTokenCpi<'info> { +impl<'info> BurnCpi<'info> { pub fn instruction(&self) -> Result { - BurnToken::from(self).instruction() + Burn::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = BurnToken::from(&self).instruction()?; + let instruction = Burn::from(&self).instruction()?; let account_infos = [self.source, self.cmint, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = BurnToken::from(&self).instruction()?; + let instruction = Burn::from(&self).instruction()?; let account_infos = [self.source, self.cmint, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&BurnTokenCpi<'info>> for BurnToken { - fn from(cpi: &BurnTokenCpi<'info>) -> Self { +impl<'info> From<&BurnCpi<'info>> for Burn { + fn from(cpi: &BurnCpi<'info>) -> Self { Self { source: *cpi.source.key, cmint: *cpi.cmint.key, @@ -91,7 +91,7 @@ impl<'info> From<&BurnTokenCpi<'info>> for BurnToken { } } -impl BurnToken { +impl Burn { pub fn instruction(self) -> Result { Ok(Instruction { program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), diff --git a/sdk-libs/token-sdk/src/token/burn_checked.rs b/sdk-libs/token-sdk/src/token/burn_checked.rs index 2f4c07a7ab..ef86be5bdf 100644 --- a/sdk-libs/token-sdk/src/token/burn_checked.rs +++ b/sdk-libs/token-sdk/src/token/burn_checked.rs @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Burn tokens from a ctoken account with decimals validation: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::BurnTokenChecked; +/// # use light_token_sdk::token::BurnChecked; /// # let source = Pubkey::new_unique(); /// # let cmint = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = BurnTokenChecked { +/// let instruction = BurnChecked { /// source, /// cmint, /// amount: 100, @@ -22,7 +22,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct BurnTokenChecked { +pub struct BurnChecked { /// CToken account to burn from pub source: Pubkey, /// CMint account (supply tracking) @@ -40,12 +40,12 @@ pub struct BurnTokenChecked { /// # Burn ctoken via CPI with decimals validation: /// ```rust,no_run -/// # use light_token_sdk::token::BurnTokenCheckedCpi; +/// # use light_token_sdk::token::BurnCheckedCpi; /// # use solana_account_info::AccountInfo; /// # let source: AccountInfo = todo!(); /// # let cmint: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// BurnTokenCheckedCpi { +/// BurnCheckedCpi { /// source, /// cmint, /// amount: 100, @@ -56,7 +56,7 @@ pub struct BurnTokenChecked { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct BurnTokenCheckedCpi<'info> { +pub struct BurnCheckedCpi<'info> { pub source: AccountInfo<'info>, pub cmint: AccountInfo<'info>, pub amount: u64, @@ -66,26 +66,26 @@ pub struct BurnTokenCheckedCpi<'info> { pub max_top_up: Option, } -impl<'info> BurnTokenCheckedCpi<'info> { +impl<'info> BurnCheckedCpi<'info> { pub fn instruction(&self) -> Result { - BurnTokenChecked::from(self).instruction() + BurnChecked::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = BurnTokenChecked::from(&self).instruction()?; + let instruction = BurnChecked::from(&self).instruction()?; let account_infos = [self.source, self.cmint, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = BurnTokenChecked::from(&self).instruction()?; + let instruction = BurnChecked::from(&self).instruction()?; let account_infos = [self.source, self.cmint, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&BurnTokenCheckedCpi<'info>> for BurnTokenChecked { - fn from(cpi: &BurnTokenCheckedCpi<'info>) -> Self { +impl<'info> From<&BurnCheckedCpi<'info>> for BurnChecked { + fn from(cpi: &BurnCheckedCpi<'info>) -> Self { Self { source: *cpi.source.key, cmint: *cpi.cmint.key, @@ -97,7 +97,7 @@ impl<'info> From<&BurnTokenCheckedCpi<'info>> for BurnTokenChecked { } } -impl BurnTokenChecked { +impl BurnChecked { pub fn instruction(self) -> Result { Ok(Instruction { program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), diff --git a/sdk-libs/token-sdk/src/token/close.rs b/sdk-libs/token-sdk/src/token/close.rs index b14d90f958..d27e157234 100644 --- a/sdk-libs/token-sdk/src/token/close.rs +++ b/sdk-libs/token-sdk/src/token/close.rs @@ -9,16 +9,16 @@ use crate::token::RENT_SPONSOR; /// # Create a close ctoken account instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::{CloseTokenAccount, LIGHT_TOKEN_PROGRAM_ID}; +/// # use light_token_sdk::token::{CloseAccount, LIGHT_TOKEN_PROGRAM_ID}; /// # let account = Pubkey::new_unique(); /// # let destination = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); /// let instruction = -/// CloseTokenAccount::new(LIGHT_TOKEN_PROGRAM_ID, account, destination, owner) +/// CloseAccount::new(LIGHT_TOKEN_PROGRAM_ID, account, destination, owner) /// .instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CloseTokenAccount { +pub struct CloseAccount { pub token_program: Pubkey, pub account: Pubkey, pub destination: Pubkey, @@ -26,7 +26,7 @@ pub struct CloseTokenAccount { pub rent_sponsor: Pubkey, } -impl CloseTokenAccount { +impl CloseAccount { pub fn new(token_program: Pubkey, account: Pubkey, destination: Pubkey, owner: Pubkey) -> Self { Self { token_program, @@ -63,7 +63,7 @@ impl CloseTokenAccount { /// # Close a ctoken account via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::CloseTokenAccountCpi; +/// # use light_token_sdk::token::CloseAccountCpi; /// # use solana_account_info::AccountInfo; /// # let token_program: AccountInfo = todo!(); /// # let account: AccountInfo = todo!(); @@ -71,7 +71,7 @@ impl CloseTokenAccount { /// # let owner: AccountInfo = todo!(); /// // Use ctoken::RENT_SPONSOR or ctoken::rent_sponsor_pda() to get the protocol rent sponsor. /// # let rent_sponsor: AccountInfo = todo!(); -/// CloseTokenAccountCpi { +/// CloseAccountCpi { /// token_program, /// account, /// destination, @@ -81,7 +81,7 @@ impl CloseTokenAccount { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CloseTokenAccountCpi<'info> { +pub struct CloseAccountCpi<'info> { pub token_program: AccountInfo<'info>, pub account: AccountInfo<'info>, pub destination: AccountInfo<'info>, @@ -89,9 +89,9 @@ pub struct CloseTokenAccountCpi<'info> { pub rent_sponsor: AccountInfo<'info>, } -impl<'info> CloseTokenAccountCpi<'info> { +impl<'info> CloseAccountCpi<'info> { pub fn instruction(&self) -> Result { - CloseTokenAccount::from(self).instruction() + CloseAccount::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { @@ -117,8 +117,8 @@ impl<'info> CloseTokenAccountCpi<'info> { } } -impl<'info> From<&CloseTokenAccountCpi<'info>> for CloseTokenAccount { - fn from(account_infos: &CloseTokenAccountCpi<'info>) -> Self { +impl<'info> From<&CloseAccountCpi<'info>> for CloseAccount { + fn from(account_infos: &CloseAccountCpi<'info>) -> Self { Self { token_program: *account_infos.token_program.key, account: *account_infos.account.key, diff --git a/sdk-libs/token-sdk/src/token/create_ata.rs b/sdk-libs/token-sdk/src/token/create_ata.rs index 4862389aca..bf4515937a 100644 --- a/sdk-libs/token-sdk/src/token/create_ata.rs +++ b/sdk-libs/token-sdk/src/token/create_ata.rs @@ -134,7 +134,7 @@ impl CreateAssociatedTokenAccount { /// # Create an associated ctoken account via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::{CreateAssociatedTokenAccountCpi, CompressibleParamsCpi}; +/// # use light_token_sdk::token::{CreateAssociatedAccountCpi, CompressibleParamsCpi}; /// # use solana_account_info::AccountInfo; /// # let owner: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); @@ -143,7 +143,7 @@ impl CreateAssociatedTokenAccount { /// # let system_program: AccountInfo = todo!(); /// # let bump: u8 = todo!(); /// # let compressible: CompressibleParamsCpi = todo!(); -/// CreateAssociatedTokenAccountCpi { +/// CreateAssociatedAccountCpi { /// owner, /// mint, /// payer, @@ -156,7 +156,7 @@ impl CreateAssociatedTokenAccount { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CreateAssociatedTokenAccountCpi<'info> { +pub struct CreateAssociatedAccountCpi<'info> { pub owner: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub payer: AccountInfo<'info>, @@ -167,7 +167,7 @@ pub struct CreateAssociatedTokenAccountCpi<'info> { pub idempotent: bool, } -impl<'info> CreateAssociatedTokenAccountCpi<'info> { +impl<'info> CreateAssociatedAccountCpi<'info> { pub fn instruction(&self) -> Result { CreateAssociatedTokenAccount::from(self).instruction() } @@ -201,8 +201,8 @@ impl<'info> CreateAssociatedTokenAccountCpi<'info> { } } -impl<'info> From<&CreateAssociatedTokenAccountCpi<'info>> for CreateAssociatedTokenAccount { - fn from(account_infos: &CreateAssociatedTokenAccountCpi<'info>) -> Self { +impl<'info> From<&CreateAssociatedAccountCpi<'info>> for CreateAssociatedTokenAccount { + fn from(account_infos: &CreateAssociatedAccountCpi<'info>) -> Self { Self { payer: *account_infos.payer.key, owner: *account_infos.owner.key, diff --git a/sdk-libs/token-sdk/src/token/decompress.rs b/sdk-libs/token-sdk/src/token/decompress.rs index 29affbaa4c..91a4530350 100644 --- a/sdk-libs/token-sdk/src/token/decompress.rs +++ b/sdk-libs/token-sdk/src/token/decompress.rs @@ -25,7 +25,7 @@ use crate::{ /// /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::DecompressToToken; +/// # use light_token_sdk::token::Decompress; /// # use light_token_sdk::compat::TokenData; /// # use light_compressed_account::instruction_data::compressed_proof::ValidityProof; /// # let destination_ctoken_account = Pubkey::new_unique(); @@ -35,7 +35,7 @@ use crate::{ /// # let queue = Pubkey::new_unique(); /// # let token_data = TokenData::default(); /// # let discriminator = [0, 0, 0, 0, 0, 0, 0, 4]; // ShaFlat -/// let instruction = DecompressToToken { +/// let instruction = Decompress { /// token_data, /// discriminator, /// merkle_tree, @@ -50,7 +50,7 @@ use crate::{ /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` #[derive(Debug, Clone, PartialEq, Eq)] -pub struct DecompressToToken { +pub struct Decompress { /// Token data from the compressed account (compat version with solana_pubkey::Pubkey) pub token_data: TokenData, /// Compressed Token Account discriminator @@ -73,7 +73,7 @@ pub struct DecompressToToken { pub validity_proof: ValidityProof, } -impl DecompressToToken { +impl Decompress { pub fn instruction(self) -> Result { // Build packed accounts // Note: Don't add system accounts here - Transfer2AccountsMetaConfig adds them diff --git a/sdk-libs/token-sdk/src/token/freeze.rs b/sdk-libs/token-sdk/src/token/freeze.rs index 1c925fbe22..86e8f5720e 100644 --- a/sdk-libs/token-sdk/src/token/freeze.rs +++ b/sdk-libs/token-sdk/src/token/freeze.rs @@ -8,18 +8,18 @@ use solana_pubkey::Pubkey; /// # Freeze a CToken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::FreezeToken; +/// # use light_token_sdk::token::Freeze; /// # let token_account = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let freeze_authority = Pubkey::new_unique(); -/// let instruction = FreezeToken { +/// let instruction = Freeze { /// token_account, /// mint, /// freeze_authority, /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct FreezeToken { +pub struct Freeze { /// CToken account to freeze pub token_account: Pubkey, /// Mint of the token account @@ -30,12 +30,12 @@ pub struct FreezeToken { /// # Freeze CToken via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::FreezeTokenCpi; +/// # use light_token_sdk::token::FreezeCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); /// # let freeze_authority: AccountInfo = todo!(); -/// FreezeTokenCpi { +/// FreezeCpi { /// token_account, /// mint, /// freeze_authority, @@ -43,32 +43,32 @@ pub struct FreezeToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct FreezeTokenCpi<'info> { +pub struct FreezeCpi<'info> { pub token_account: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub freeze_authority: AccountInfo<'info>, } -impl<'info> FreezeTokenCpi<'info> { +impl<'info> FreezeCpi<'info> { pub fn instruction(&self) -> Result { - FreezeToken::from(self).instruction() + Freeze::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = FreezeToken::from(&self).instruction()?; + let instruction = Freeze::from(&self).instruction()?; let account_infos = [self.token_account, self.mint, self.freeze_authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = FreezeToken::from(&self).instruction()?; + let instruction = Freeze::from(&self).instruction()?; let account_infos = [self.token_account, self.mint, self.freeze_authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&FreezeTokenCpi<'info>> for FreezeToken { - fn from(cpi: &FreezeTokenCpi<'info>) -> Self { +impl<'info> From<&FreezeCpi<'info>> for Freeze { + fn from(cpi: &FreezeCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, mint: *cpi.mint.key, @@ -77,7 +77,7 @@ impl<'info> From<&FreezeTokenCpi<'info>> for FreezeToken { } } -impl FreezeToken { +impl Freeze { pub fn instruction(self) -> Result { Ok(Instruction { program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), diff --git a/sdk-libs/token-sdk/src/token/mint_to.rs b/sdk-libs/token-sdk/src/token/mint_to.rs index f181d4431b..338a22d358 100644 --- a/sdk-libs/token-sdk/src/token/mint_to.rs +++ b/sdk-libs/token-sdk/src/token/mint_to.rs @@ -1,457 +1,128 @@ -use light_compressed_account::instruction_data::{ - compressed_proof::ValidityProof, traits::LightInstructionData, -}; -use light_token_interface::instructions::mint_action::{ - CompressedMintWithContext, CpiContext, MintToTokenAction, -}; +use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; use solana_account_info::AccountInfo; use solana_cpi::{invoke, invoke_signed}; -use solana_instruction::Instruction; +use solana_instruction::{AccountMeta, Instruction}; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -use crate::compressed_token::mint_action::{ - get_mint_action_instruction_account_metas_cpi_write, MintActionMetaConfig, - MintActionMetaConfigCpiWrite, -}; -// TODO: move to compressed_token. -/// Parameters for minting tokens to a ctoken account. -#[derive(Debug, Clone)] -pub struct MintToTokenParams { - pub compressed_mint_inputs: CompressedMintWithContext, - pub mint_to_actions: Vec, - pub mint_authority: Pubkey, - pub proof: ValidityProof, -} - -impl MintToTokenParams { - pub fn new( - compressed_mint_inputs: CompressedMintWithContext, - amount: u64, - mint_authority: Pubkey, - proof: ValidityProof, - ) -> Self { - Self { - compressed_mint_inputs, - mint_to_actions: vec![MintToTokenAction { - account_index: 0, // TODO: make dynamic - amount, - }], - mint_authority, - proof, - } - } - - pub fn add_mint_to_action(mut self, account_index: u8, amount: u64) -> Self { - self.mint_to_actions.push(MintToTokenAction { - account_index, - amount, - }); - self - } -} - -/// # Create a mint to ctoken instruction: -/// ```rust,no_run +/// # Mint tokens to a ctoken account (simple 3-account instruction): +/// ```rust /// # use solana_pubkey::Pubkey; -/// use light_token_sdk::token::{MintToToken, MintToTokenParams, CompressedMintWithContext}; -/// use light_token_sdk::ValidityProof; -/// # let compressed_mint_with_context: CompressedMintWithContext = todo!(); -/// # let validity_proof: ValidityProof = todo!(); -/// # let mint_authority = Pubkey::new_unique(); -/// # let payer = Pubkey::new_unique(); -/// # let state_tree_pubkey = Pubkey::new_unique(); -/// # let input_queue = Pubkey::new_unique(); -/// # let output_queue = Pubkey::new_unique(); -/// # let ctoken_account = Pubkey::new_unique(); -/// -/// let params = MintToTokenParams::new( -/// compressed_mint_with_context, // from rpc -/// 1000, // amount -/// mint_authority, -/// validity_proof, // from rpc -/// ); -/// let instruction = MintToToken::new( -/// params, -/// payer, -/// state_tree_pubkey, -/// input_queue, -/// output_queue, -/// vec![ctoken_account], -/// ).instruction()?; +/// # use light_token_sdk::token::MintTo; +/// # let cmint = Pubkey::new_unique(); +/// # let destination = Pubkey::new_unique(); +/// # let authority = Pubkey::new_unique(); +/// let instruction = MintTo { +/// cmint, +/// destination, +/// amount: 100, +/// authority, +/// max_top_up: None, +/// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -#[derive(Debug, Clone)] -pub struct MintToToken { - pub payer: Pubkey, - pub state_tree_pubkey: Pubkey, - pub input_queue: Pubkey, - pub output_queue: Pubkey, - pub ctoken_accounts: Vec, - pub cpi_context: Option, - pub cpi_context_pubkey: Option, - pub params: MintToTokenParams, +pub struct MintTo { + /// CMint account (supply tracking) + pub cmint: Pubkey, + /// Destination CToken account to mint to + pub destination: Pubkey, + /// Amount of tokens to mint + pub amount: u64, + /// Mint authority + pub authority: Pubkey, + /// Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (0 = no limit) + /// When set to a non-zero value, includes max_top_up in instruction data + pub max_top_up: Option, } -impl MintToToken { - pub fn new( - params: MintToTokenParams, - payer: Pubkey, - state_tree_pubkey: Pubkey, - input_queue: Pubkey, - output_queue: Pubkey, - ctoken_accounts: Vec, - ) -> Self { - Self { - payer, - state_tree_pubkey, - input_queue, - output_queue, - ctoken_accounts, - cpi_context: None, - cpi_context_pubkey: None, - params, - } - } - - pub fn with_cpi_context(mut self, cpi_context: CpiContext, cpi_context_pubkey: Pubkey) -> Self { - self.cpi_context = Some(cpi_context); - self.cpi_context_pubkey = Some(cpi_context_pubkey); - self - } - - pub fn instruction(self) -> Result { - // Build instruction data with mint_to_ctoken actions - let mut instruction_data = - light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new( - self.params.compressed_mint_inputs.clone(), - self.params.proof.0, - ); - - // Add all mint_to_ctoken actions - for action in self.params.mint_to_actions { - instruction_data = instruction_data.with_mint_to_token(action); - } - - if let Some(ctx) = self.cpi_context { - instruction_data = instruction_data.with_cpi_context(ctx); - } - - let meta_config = if let Some(cpi_context_pubkey) = self.cpi_context_pubkey { - MintActionMetaConfig::new_cpi_context( - &instruction_data, - self.payer, - self.params.mint_authority, - cpi_context_pubkey, - )? - } else { - MintActionMetaConfig::new( - self.payer, - self.params.mint_authority, - self.state_tree_pubkey, - self.input_queue, - self.output_queue, - ) - .with_token_accounts(self.ctoken_accounts) - }; - - let account_metas = meta_config.to_account_metas(); - - let data = instruction_data - .data() - .map_err(|e| ProgramError::BorshIoError(e.to_string()))?; - - Ok(Instruction { - program_id: Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), - accounts: account_metas, - data, - }) - } -} - -// ============================================================================ -// Params Struct: MintToTokenCpiWriteParams -// ============================================================================ - -#[derive(Debug, Clone)] -pub struct MintToTokenCpiWriteParams { - pub compressed_mint_inputs: CompressedMintWithContext, - pub mint_to_actions: Vec, - pub mint_authority: Pubkey, - pub cpi_context: CpiContext, -} - -impl MintToTokenCpiWriteParams { - pub fn new( - compressed_mint_inputs: CompressedMintWithContext, - amount: u64, - mint_authority: Pubkey, - cpi_context: CpiContext, - ) -> Self { - Self { - compressed_mint_inputs, - mint_to_actions: vec![MintToTokenAction { - account_index: 0, // TODO: make dynamic - amount, - }], - mint_authority, - cpi_context, - } - } - - pub fn add_mint_to_action(mut self, account_index: u8, amount: u64) -> Self { - self.mint_to_actions.push(MintToTokenAction { - account_index, - amount, - }); - self - } -} - -// ============================================================================ -// Builder Struct: MintToTokenCpiWrite -// ============================================================================ - -#[derive(Debug, Clone)] -pub struct MintToTokenCpiWrite { - pub payer: Pubkey, - pub cpi_context_pubkey: Pubkey, - pub ctoken_accounts: Vec, - pub params: MintToTokenCpiWriteParams, -} - -impl MintToTokenCpiWrite { - pub fn new( - params: MintToTokenCpiWriteParams, - payer: Pubkey, - cpi_context_pubkey: Pubkey, - ctoken_accounts: Vec, - ) -> Self { - Self { - payer, - cpi_context_pubkey, - ctoken_accounts, - params, - } - } - - pub fn instruction(self) -> Result { - if !self.params.cpi_context.first_set_context && !self.params.cpi_context.set_context { - solana_msg::msg!( - "Invalid CPI context first cpi set or set context must be true {:?}", - self.params.cpi_context - ); - return Err(ProgramError::InvalidAccountData); - } - - // Build instruction data with mint_to_ctoken actions - let mut instruction_data = - light_token_interface::instructions::mint_action::MintActionCompressedInstructionData::new( - self.params.compressed_mint_inputs.clone(), - None, // No proof for CPI write - ); - - // Add all mint_to_ctoken actions - for action in self.params.mint_to_actions { - instruction_data = instruction_data.with_mint_to_token(action); - } - - instruction_data = instruction_data.with_cpi_context(self.params.cpi_context); - - let meta_config = MintActionMetaConfigCpiWrite { - fee_payer: self.payer, - mint_signer: None, - authority: self.params.mint_authority, - cpi_context: self.cpi_context_pubkey, - }; - - let account_metas = get_mint_action_instruction_account_metas_cpi_write(meta_config); - - let data = instruction_data - .data() - .map_err(|e| ProgramError::BorshIoError(e.to_string()))?; - - Ok(Instruction { - program_id: Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), - accounts: account_metas, - data, - }) - } -} - -// ============================================================================ -// AccountInfos Struct: MintToTokenCpi (for CPI usage) -// ============================================================================ - -/// # Mint to ctoken account via CPI: +/// # Mint to ctoken via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::{MintToTokenCpi, MintToTokenParams, SystemAccountInfos}; +/// # use light_token_sdk::token::MintToCpi; /// # use solana_account_info::AccountInfo; +/// # let cmint: AccountInfo = todo!(); +/// # let destination: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// # let payer: AccountInfo = todo!(); -/// # let state_tree: AccountInfo = todo!(); -/// # let input_queue: AccountInfo = todo!(); -/// # let output_queue: AccountInfo = todo!(); -/// # let ctoken_accounts: Vec = todo!(); -/// # let system_accounts: SystemAccountInfos = todo!(); -/// # let params: MintToTokenParams = todo!(); -/// MintToTokenCpi { +/// # let system_program: AccountInfo = todo!(); +/// MintToCpi { +/// cmint, +/// destination, +/// amount: 100, /// authority, -/// payer, -/// state_tree, -/// input_queue, -/// output_queue, -/// ctoken_accounts, -/// system_accounts, -/// cpi_context: None, -/// cpi_context_account: None, -/// params, +/// system_program, +/// max_top_up: None, /// } /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct MintToTokenCpi<'info> { - /// The authority for the mint operation (mint_authority). +pub struct MintToCpi<'info> { + pub cmint: AccountInfo<'info>, + pub destination: AccountInfo<'info>, + pub amount: u64, pub authority: AccountInfo<'info>, - /// The fee payer for the transaction. - pub payer: AccountInfo<'info>, - pub state_tree: AccountInfo<'info>, - pub input_queue: AccountInfo<'info>, - pub output_queue: AccountInfo<'info>, - pub ctoken_accounts: Vec>, - pub system_accounts: crate::token::SystemAccountInfos<'info>, - pub cpi_context: Option, - pub cpi_context_account: Option>, - pub params: MintToTokenParams, + pub system_program: AccountInfo<'info>, + /// Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (0 = no limit) + pub max_top_up: Option, } -impl<'info> MintToTokenCpi<'info> { +impl<'info> MintToCpi<'info> { pub fn instruction(&self) -> Result { - MintToToken::try_from(self)?.instruction() + MintTo::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = self.instruction()?; - - // Account order must match the instruction's account metas order (from to_account_metas) - let mut account_infos = vec![ - self.system_accounts.light_system_program, - self.authority, // authority - self.payer, // fee_payer - self.system_accounts.cpi_authority_pda, - self.system_accounts.registered_program_pda, - self.system_accounts.account_compression_authority, - self.system_accounts.account_compression_program, - self.system_accounts.system_program, + let instruction = MintTo::from(&self).instruction()?; + let account_infos = [ + self.cmint, + self.destination, + self.authority, + self.system_program, ]; - - if let Some(cpi_context_account) = self.cpi_context_account { - account_infos.push(cpi_context_account); - } - - account_infos.push(self.output_queue); - account_infos.push(self.state_tree); - account_infos.push(self.input_queue); - account_infos.extend(self.ctoken_accounts); - invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = self.instruction()?; - - // Account order must match the instruction's account metas order (from to_account_metas) - let mut account_infos = vec![ - self.system_accounts.light_system_program, - self.authority, // authority - self.payer, // fee_payer - self.system_accounts.cpi_authority_pda, - self.system_accounts.registered_program_pda, - self.system_accounts.account_compression_authority, - self.system_accounts.account_compression_program, - self.system_accounts.system_program, + let instruction = MintTo::from(&self).instruction()?; + let account_infos = [ + self.cmint, + self.destination, + self.authority, + self.system_program, ]; - - if let Some(cpi_context_account) = self.cpi_context_account { - account_infos.push(cpi_context_account); - } - - account_infos.push(self.output_queue); - account_infos.push(self.state_tree); - account_infos.push(self.input_queue); - account_infos.extend(self.ctoken_accounts); - invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> TryFrom<&MintToTokenCpi<'info>> for MintToToken { - type Error = ProgramError; - - fn try_from(account_infos: &MintToTokenCpi<'info>) -> Result { - if account_infos.params.mint_authority != *account_infos.authority.key { - solana_msg::msg!( - "MintToTokenCpi: params.mint_authority ({}) does not match authority account ({})", - account_infos.params.mint_authority, - account_infos.authority.key - ); - return Err(ProgramError::InvalidAccountData); +impl<'info> From<&MintToCpi<'info>> for MintTo { + fn from(cpi: &MintToCpi<'info>) -> Self { + Self { + cmint: *cpi.cmint.key, + destination: *cpi.destination.key, + amount: cpi.amount, + authority: *cpi.authority.key, + max_top_up: cpi.max_top_up, } - Ok(Self { - payer: *account_infos.payer.key, - state_tree_pubkey: *account_infos.state_tree.key, - input_queue: *account_infos.input_queue.key, - output_queue: *account_infos.output_queue.key, - ctoken_accounts: account_infos - .ctoken_accounts - .iter() - .map(|acc| *acc.key) - .collect(), - cpi_context: account_infos.cpi_context.clone(), - cpi_context_pubkey: account_infos - .cpi_context_account - .as_ref() - .map(|acc| *acc.key), - params: account_infos.params.clone(), - }) } } -// ============================================================================ -// AccountInfos Struct: MintToTokenCpiWriteCpi -// ============================================================================ - -pub struct MintToTokenCpiWriteCpi<'info> { - pub payer: AccountInfo<'info>, - pub cpi_context_account: AccountInfo<'info>, - pub ctoken_accounts: Vec>, - pub params: MintToTokenCpiWriteParams, -} - -impl<'info> MintToTokenCpiWriteCpi<'info> { - pub fn instruction(&self) -> Result { - MintToTokenCpiWrite::from(self).instruction() - } - - pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = self.instruction()?; - let mut account_infos = vec![self.payer, self.cpi_context_account]; - account_infos.extend(self.ctoken_accounts); - invoke_signed(&instruction, &account_infos, signer_seeds) - } -} - -impl<'info> From<&MintToTokenCpiWriteCpi<'info>> for MintToTokenCpiWrite { - fn from(account_infos: &MintToTokenCpiWriteCpi<'info>) -> Self { - Self { - payer: *account_infos.payer.key, - cpi_context_pubkey: *account_infos.cpi_context_account.key, - ctoken_accounts: account_infos - .ctoken_accounts - .iter() - .map(|acc| *acc.key) - .collect(), - params: account_infos.params.clone(), - } +impl MintTo { + pub fn instruction(self) -> Result { + Ok(Instruction { + program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), + accounts: vec![ + AccountMeta::new(self.cmint, false), + AccountMeta::new(self.destination, false), + AccountMeta::new(self.authority, true), + AccountMeta::new_readonly(Pubkey::default(), false), // System program for lamport transfers + ], + data: { + let mut data = vec![7u8]; // TokenMintTo discriminator + data.extend_from_slice(&self.amount.to_le_bytes()); + // Include max_top_up if set (10-byte format) + if let Some(max_top_up) = self.max_top_up { + data.extend_from_slice(&max_top_up.to_le_bytes()); + } + data + }, + }) } } diff --git a/sdk-libs/token-sdk/src/token/token_mint_to_checked.rs b/sdk-libs/token-sdk/src/token/mint_to_checked.rs similarity index 84% rename from sdk-libs/token-sdk/src/token/token_mint_to_checked.rs rename to sdk-libs/token-sdk/src/token/mint_to_checked.rs index 91bfcddae2..4bf3ea0fe6 100644 --- a/sdk-libs/token-sdk/src/token/token_mint_to_checked.rs +++ b/sdk-libs/token-sdk/src/token/mint_to_checked.rs @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Mint tokens to a ctoken account with decimals validation: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::TokenMintToChecked; +/// # use light_token_sdk::token::MintToChecked; /// # let cmint = Pubkey::new_unique(); /// # let destination = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = TokenMintToChecked { +/// let instruction = MintToChecked { /// cmint, /// destination, /// amount: 100, @@ -22,7 +22,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TokenMintToChecked { +pub struct MintToChecked { /// CMint account (supply tracking) pub cmint: Pubkey, /// Destination CToken account to mint to @@ -40,12 +40,12 @@ pub struct TokenMintToChecked { /// # Mint to ctoken via CPI with decimals validation: /// ```rust,no_run -/// # use light_token_sdk::token::TokenMintToCheckedCpi; +/// # use light_token_sdk::token::MintToCheckedCpi; /// # use solana_account_info::AccountInfo; /// # let cmint: AccountInfo = todo!(); /// # let destination: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// TokenMintToCheckedCpi { +/// MintToCheckedCpi { /// cmint, /// destination, /// amount: 100, @@ -56,7 +56,7 @@ pub struct TokenMintToChecked { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TokenMintToCheckedCpi<'info> { +pub struct MintToCheckedCpi<'info> { pub cmint: AccountInfo<'info>, pub destination: AccountInfo<'info>, pub amount: u64, @@ -66,26 +66,26 @@ pub struct TokenMintToCheckedCpi<'info> { pub max_top_up: Option, } -impl<'info> TokenMintToCheckedCpi<'info> { +impl<'info> MintToCheckedCpi<'info> { pub fn instruction(&self) -> Result { - TokenMintToChecked::from(self).instruction() + MintToChecked::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TokenMintToChecked::from(&self).instruction()?; + let instruction = MintToChecked::from(&self).instruction()?; let account_infos = [self.cmint, self.destination, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TokenMintToChecked::from(&self).instruction()?; + let instruction = MintToChecked::from(&self).instruction()?; let account_infos = [self.cmint, self.destination, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&TokenMintToCheckedCpi<'info>> for TokenMintToChecked { - fn from(cpi: &TokenMintToCheckedCpi<'info>) -> Self { +impl<'info> From<&MintToCheckedCpi<'info>> for MintToChecked { + fn from(cpi: &MintToCheckedCpi<'info>) -> Self { Self { cmint: *cpi.cmint.key, destination: *cpi.destination.key, @@ -97,7 +97,7 @@ impl<'info> From<&TokenMintToCheckedCpi<'info>> for TokenMintToChecked { } } -impl TokenMintToChecked { +impl MintToChecked { pub fn instruction(self) -> Result { Ok(Instruction { program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), diff --git a/sdk-libs/token-sdk/src/token/mod.rs b/sdk-libs/token-sdk/src/token/mod.rs index 69ca624ffa..66630f418b 100644 --- a/sdk-libs/token-sdk/src/token/mod.rs +++ b/sdk-libs/token-sdk/src/token/mod.rs @@ -14,7 +14,7 @@ //! //! ## Decompress //! -//! - [`DecompressToToken`] - Decompress compressed tokens to a cToken account +//! - [`Decompress`] - Decompress compressed tokens to a cToken account //! //! ## Close //! @@ -25,7 +25,14 @@ //! ## Mint //! //! - [`CreateCMint`] - Create cMint -//! - [`MintToToken`] - Mint tokens to ctoken accounts +//! - [`MintTo`] - Mint tokens to ctoken accounts +//! +//! ## Revoke and Thaw +//! +//! - [`Revoke`] - Revoke delegation for a ctoken account +//! - [`RevokeCpi`] - Revoke delegation via CPI +//! - [`Thaw`] - Thaw a frozen ctoken account +//! - [`ThawCpi`] - Thaw a frozen ctoken account via CPI //! //! # Example: Create cToken Account Instruction //! @@ -78,10 +85,9 @@ mod decompress; mod decompress_cmint; mod freeze; mod mint_to; +mod mint_to_checked; mod revoke; mod thaw; -mod token_mint_to; -mod token_mint_to_checked; mod transfer_interface; mod transfer_spl_to_token; mod transfer_token; @@ -92,12 +98,12 @@ pub use approve::*; pub use approve_checked::*; pub use burn::*; pub use burn_checked::*; -pub use close::*; +pub use close::{CloseAccount, CloseAccountCpi}; pub use compressible::{CompressibleParams, CompressibleParamsCpi}; pub use create::*; -pub use create_ata::*; +pub use create_ata::{derive_token_ata, CreateAssociatedAccountCpi, CreateAssociatedTokenAccount}; pub use create_cmint::*; -pub use decompress::DecompressToToken; +pub use decompress::Decompress; pub use decompress_cmint::*; pub use freeze::*; use light_compressible::config::CompressibleConfig; @@ -109,18 +115,17 @@ pub use light_token_interface::{ state::{Token, TokenDataVersion}, }; use light_token_types::POOL_SEED; -pub use mint_to::*; -pub use revoke::*; +pub use mint_to::{MintTo, MintToCpi}; +pub use mint_to_checked::*; +pub use revoke::{Revoke, RevokeCpi}; use solana_account_info::AccountInfo; use solana_pubkey::{pubkey, Pubkey}; -pub use thaw::*; -pub use token_mint_to::*; -pub use token_mint_to_checked::*; +pub use thaw::{Thaw, ThawCpi}; pub use transfer_interface::{SplInterface, TransferInterfaceCpi}; -pub use transfer_spl_to_token::{TransferSplToToken, TransferSplToTokenCpi}; +pub use transfer_spl_to_token::{TransferFromSpl, TransferFromSplCpi}; pub use transfer_token::*; pub use transfer_token_checked::*; -pub use transfer_token_to_spl::{TransferTokenToSpl, TransferTokenToSplCpi}; +pub use transfer_token_to_spl::{TransferToSpl, TransferToSplCpi}; /// System accounts required for CPI operations to Light Protocol. /// @@ -230,14 +235,3 @@ pub fn rent_sponsor_pda() -> Pubkey { pub fn compression_authority_pda() -> Pubkey { CompressibleConfig::light_token_v1_compression_authority_pda() } - -// Backwards compatibility aliases for old type names -pub use close::CloseTokenAccount as CloseCTokenAccount; -pub use create::CreateTokenAccount as CreateCTokenAccount; -pub use create_ata::{ - derive_token_ata as derive_ctoken_ata, - CreateAssociatedTokenAccount as CreateAssociatedCTokenAccount, -}; -pub use decompress::DecompressToToken as DecompressToCtoken; -pub use mint_to::MintToToken as MintToCToken; -pub use transfer_token::TransferToken as TransferCToken; diff --git a/sdk-libs/token-sdk/src/token/revoke.rs b/sdk-libs/token-sdk/src/token/revoke.rs index 16e2ee00c2..5720d1d625 100644 --- a/sdk-libs/token-sdk/src/token/revoke.rs +++ b/sdk-libs/token-sdk/src/token/revoke.rs @@ -8,16 +8,16 @@ use solana_pubkey::Pubkey; /// # Revoke delegation for a CToken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::RevokeToken; +/// # use light_token_sdk::token::Revoke; /// # let token_account = Pubkey::new_unique(); /// # let owner = Pubkey::new_unique(); -/// let instruction = RevokeToken { +/// let instruction = Revoke { /// token_account, /// owner, /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct RevokeToken { +pub struct Revoke { /// CToken account to revoke delegation for pub token_account: Pubkey, /// Owner of the CToken account (signer, payer for top-up) @@ -26,12 +26,12 @@ pub struct RevokeToken { /// # Revoke CToken via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::RevokeTokenCpi; +/// # use light_token_sdk::token::RevokeCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let owner: AccountInfo = todo!(); /// # let system_program: AccountInfo = todo!(); -/// RevokeTokenCpi { +/// RevokeCpi { /// token_account, /// owner, /// system_program, @@ -39,32 +39,32 @@ pub struct RevokeToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct RevokeTokenCpi<'info> { +pub struct RevokeCpi<'info> { pub token_account: AccountInfo<'info>, pub owner: AccountInfo<'info>, pub system_program: AccountInfo<'info>, } -impl<'info> RevokeTokenCpi<'info> { +impl<'info> RevokeCpi<'info> { pub fn instruction(&self) -> Result { - RevokeToken::from(self).instruction() + Revoke::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = RevokeToken::from(&self).instruction()?; + let instruction = Revoke::from(&self).instruction()?; let account_infos = [self.token_account, self.owner, self.system_program]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = RevokeToken::from(&self).instruction()?; + let instruction = Revoke::from(&self).instruction()?; let account_infos = [self.token_account, self.owner, self.system_program]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&RevokeTokenCpi<'info>> for RevokeToken { - fn from(cpi: &RevokeTokenCpi<'info>) -> Self { +impl<'info> From<&RevokeCpi<'info>> for Revoke { + fn from(cpi: &RevokeCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, owner: *cpi.owner.key, @@ -72,7 +72,7 @@ impl<'info> From<&RevokeTokenCpi<'info>> for RevokeToken { } } -impl RevokeToken { +impl Revoke { pub fn instruction(self) -> Result { Ok(Instruction { program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), diff --git a/sdk-libs/token-sdk/src/token/thaw.rs b/sdk-libs/token-sdk/src/token/thaw.rs index bca06ce437..54e239cf96 100644 --- a/sdk-libs/token-sdk/src/token/thaw.rs +++ b/sdk-libs/token-sdk/src/token/thaw.rs @@ -8,18 +8,18 @@ use solana_pubkey::Pubkey; /// # Thaw a frozen CToken account: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::ThawToken; +/// # use light_token_sdk::token::Thaw; /// # let token_account = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let freeze_authority = Pubkey::new_unique(); -/// let instruction = ThawToken { +/// let instruction = Thaw { /// token_account, /// mint, /// freeze_authority, /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ThawToken { +pub struct Thaw { /// CToken account to thaw pub token_account: Pubkey, /// Mint of the token account @@ -30,12 +30,12 @@ pub struct ThawToken { /// # Thaw CToken via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::ThawTokenCpi; +/// # use light_token_sdk::token::ThawCpi; /// # use solana_account_info::AccountInfo; /// # let token_account: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); /// # let freeze_authority: AccountInfo = todo!(); -/// ThawTokenCpi { +/// ThawCpi { /// token_account, /// mint, /// freeze_authority, @@ -43,32 +43,32 @@ pub struct ThawToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct ThawTokenCpi<'info> { +pub struct ThawCpi<'info> { pub token_account: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub freeze_authority: AccountInfo<'info>, } -impl<'info> ThawTokenCpi<'info> { +impl<'info> ThawCpi<'info> { pub fn instruction(&self) -> Result { - ThawToken::from(self).instruction() + Thaw::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = ThawToken::from(&self).instruction()?; + let instruction = Thaw::from(&self).instruction()?; let account_infos = [self.token_account, self.mint, self.freeze_authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = ThawToken::from(&self).instruction()?; + let instruction = Thaw::from(&self).instruction()?; let account_infos = [self.token_account, self.mint, self.freeze_authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&ThawTokenCpi<'info>> for ThawToken { - fn from(cpi: &ThawTokenCpi<'info>) -> Self { +impl<'info> From<&ThawCpi<'info>> for Thaw { + fn from(cpi: &ThawCpi<'info>) -> Self { Self { token_account: *cpi.token_account.key, mint: *cpi.mint.key, @@ -77,7 +77,7 @@ impl<'info> From<&ThawTokenCpi<'info>> for ThawToken { } } -impl ThawToken { +impl Thaw { pub fn instruction(self) -> Result { Ok(Instruction { program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), diff --git a/sdk-libs/token-sdk/src/token/token_mint_to.rs b/sdk-libs/token-sdk/src/token/token_mint_to.rs deleted file mode 100644 index ef0934f636..0000000000 --- a/sdk-libs/token-sdk/src/token/token_mint_to.rs +++ /dev/null @@ -1,128 +0,0 @@ -use light_sdk_types::LIGHT_TOKEN_PROGRAM_ID; -use solana_account_info::AccountInfo; -use solana_cpi::{invoke, invoke_signed}; -use solana_instruction::{AccountMeta, Instruction}; -use solana_program_error::ProgramError; -use solana_pubkey::Pubkey; - -/// # Mint tokens to a ctoken account (simple 3-account instruction): -/// ```rust -/// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::TokenMintTo; -/// # let cmint = Pubkey::new_unique(); -/// # let destination = Pubkey::new_unique(); -/// # let authority = Pubkey::new_unique(); -/// let instruction = TokenMintTo { -/// cmint, -/// destination, -/// amount: 100, -/// authority, -/// max_top_up: None, -/// }.instruction()?; -/// # Ok::<(), solana_program_error::ProgramError>(()) -/// ``` -pub struct TokenMintTo { - /// CMint account (supply tracking) - pub cmint: Pubkey, - /// Destination CToken account to mint to - pub destination: Pubkey, - /// Amount of tokens to mint - pub amount: u64, - /// Mint authority - pub authority: Pubkey, - /// Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (0 = no limit) - /// When set to a non-zero value, includes max_top_up in instruction data - pub max_top_up: Option, -} - -/// # Mint to ctoken via CPI: -/// ```rust,no_run -/// # use light_token_sdk::token::TokenMintToCpi; -/// # use solana_account_info::AccountInfo; -/// # let cmint: AccountInfo = todo!(); -/// # let destination: AccountInfo = todo!(); -/// # let authority: AccountInfo = todo!(); -/// # let system_program: AccountInfo = todo!(); -/// TokenMintToCpi { -/// cmint, -/// destination, -/// amount: 100, -/// authority, -/// system_program, -/// max_top_up: None, -/// } -/// .invoke()?; -/// # Ok::<(), solana_program_error::ProgramError>(()) -/// ``` -pub struct TokenMintToCpi<'info> { - pub cmint: AccountInfo<'info>, - pub destination: AccountInfo<'info>, - pub amount: u64, - pub authority: AccountInfo<'info>, - pub system_program: AccountInfo<'info>, - /// Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (0 = no limit) - pub max_top_up: Option, -} - -impl<'info> TokenMintToCpi<'info> { - pub fn instruction(&self) -> Result { - TokenMintTo::from(self).instruction() - } - - pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TokenMintTo::from(&self).instruction()?; - let account_infos = [ - self.cmint, - self.destination, - self.authority, - self.system_program, - ]; - invoke(&instruction, &account_infos) - } - - pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TokenMintTo::from(&self).instruction()?; - let account_infos = [ - self.cmint, - self.destination, - self.authority, - self.system_program, - ]; - invoke_signed(&instruction, &account_infos, signer_seeds) - } -} - -impl<'info> From<&TokenMintToCpi<'info>> for TokenMintTo { - fn from(cpi: &TokenMintToCpi<'info>) -> Self { - Self { - cmint: *cpi.cmint.key, - destination: *cpi.destination.key, - amount: cpi.amount, - authority: *cpi.authority.key, - max_top_up: cpi.max_top_up, - } - } -} - -impl TokenMintTo { - pub fn instruction(self) -> Result { - Ok(Instruction { - program_id: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), - accounts: vec![ - AccountMeta::new(self.cmint, false), - AccountMeta::new(self.destination, false), - AccountMeta::new(self.authority, true), - AccountMeta::new_readonly(Pubkey::default(), false), // System program for lamport transfers - ], - data: { - let mut data = vec![7u8]; // TokenMintTo discriminator - data.extend_from_slice(&self.amount.to_le_bytes()); - // Include max_top_up if set (10-byte format) - if let Some(max_top_up) = self.max_top_up { - data.extend_from_slice(&max_top_up.to_le_bytes()); - } - data - }, - }) - } -} diff --git a/sdk-libs/token-sdk/src/token/transfer_interface.rs b/sdk-libs/token-sdk/src/token/transfer_interface.rs index 968d528458..a8fd4ad5d0 100644 --- a/sdk-libs/token-sdk/src/token/transfer_interface.rs +++ b/sdk-libs/token-sdk/src/token/transfer_interface.rs @@ -2,8 +2,8 @@ use solana_account_info::AccountInfo; use solana_program_error::ProgramError; use super::{ - transfer_spl_to_token::TransferSplToTokenCpi, transfer_token::TransferTokenCpi, - transfer_token_to_spl::TransferTokenToSplCpi, + transfer_spl_to_token::TransferFromSplCpi, transfer_token::TransferCpi, + transfer_token_to_spl::TransferToSplCpi, }; use crate::{error::TokenSdkError, utils::is_token_account}; @@ -107,7 +107,7 @@ impl<'info> TransferInterfaceCpi<'info> { .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; match (source_is_ctoken, dest_is_ctoken) { - (true, true) => TransferTokenCpi { + (true, true) => TransferCpi { source: self.source_account.clone(), destination: self.destination_account.clone(), amount: self.amount, @@ -121,7 +121,7 @@ impl<'info> TransferInterfaceCpi<'info> { ProgramError::Custom(TokenSdkError::SplInterfaceRequired.into()) })?; - TransferTokenToSplCpi { + TransferToSplCpi { source_ctoken_account: self.source_account.clone(), destination_spl_token_account: self.destination_account.clone(), amount: self.amount, @@ -144,7 +144,7 @@ impl<'info> TransferInterfaceCpi<'info> { ProgramError::Custom(TokenSdkError::SplInterfaceRequired.into()) })?; - TransferSplToTokenCpi { + TransferFromSplCpi { source_spl_token_account: self.source_account.clone(), destination_ctoken_account: self.destination_account.clone(), amount: self.amount, @@ -180,7 +180,7 @@ impl<'info> TransferInterfaceCpi<'info> { .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; match (source_is_ctoken, dest_is_ctoken) { - (true, true) => TransferTokenCpi { + (true, true) => TransferCpi { source: self.source_account.clone(), destination: self.destination_account.clone(), amount: self.amount, @@ -194,7 +194,7 @@ impl<'info> TransferInterfaceCpi<'info> { ProgramError::Custom(TokenSdkError::SplInterfaceRequired.into()) })?; - TransferTokenToSplCpi { + TransferToSplCpi { source_ctoken_account: self.source_account.clone(), destination_spl_token_account: self.destination_account.clone(), amount: self.amount, @@ -217,7 +217,7 @@ impl<'info> TransferInterfaceCpi<'info> { ProgramError::Custom(TokenSdkError::SplInterfaceRequired.into()) })?; - TransferSplToTokenCpi { + TransferFromSplCpi { source_spl_token_account: self.source_account.clone(), destination_ctoken_account: self.destination_account.clone(), amount: self.amount, diff --git a/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs b/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs index 728bce29f6..ed0d01452a 100644 --- a/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs +++ b/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs @@ -16,7 +16,7 @@ use crate::compressed_token::{ /// # Create a transfer SPL to cToken instruction /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::TransferSplToToken; +/// # use light_token_sdk::token::TransferFromSpl; /// # let source_spl_token_account = Pubkey::new_unique(); /// # let destination_ctoken_account = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); @@ -24,7 +24,7 @@ use crate::compressed_token::{ /// # let payer = Pubkey::new_unique(); /// # let spl_interface_pda = Pubkey::new_unique(); /// # let spl_token_program = Pubkey::new_unique(); -/// let instruction = TransferSplToToken { +/// let instruction = TransferFromSpl { /// amount: 100, /// spl_interface_pda_bump: 255, /// decimals: 9, @@ -38,7 +38,7 @@ use crate::compressed_token::{ /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferSplToToken { +pub struct TransferFromSpl { pub amount: u64, pub spl_interface_pda_bump: u8, pub decimals: u8, @@ -54,7 +54,7 @@ pub struct TransferSplToToken { /// # Transfer SPL to ctoken via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::TransferSplToTokenCpi; +/// # use light_token_sdk::token::TransferFromSplCpi; /// # use solana_account_info::AccountInfo; /// # let source_spl_token_account: AccountInfo = todo!(); /// # let destination_ctoken_account: AccountInfo = todo!(); @@ -65,7 +65,7 @@ pub struct TransferSplToToken { /// # let spl_token_program: AccountInfo = todo!(); /// # let compressed_token_program_authority: AccountInfo = todo!(); /// # let system_program: AccountInfo = todo!(); -/// TransferSplToTokenCpi { +/// TransferFromSplCpi { /// amount: 100, /// spl_interface_pda_bump: 255, /// decimals: 9, @@ -82,7 +82,7 @@ pub struct TransferSplToToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferSplToTokenCpi<'info> { +pub struct TransferFromSplCpi<'info> { pub amount: u64, pub spl_interface_pda_bump: u8, pub decimals: u8, @@ -99,13 +99,13 @@ pub struct TransferSplToTokenCpi<'info> { pub system_program: AccountInfo<'info>, } -impl<'info> TransferSplToTokenCpi<'info> { +impl<'info> TransferFromSplCpi<'info> { pub fn instruction(&self) -> Result { - TransferSplToToken::from(self).instruction() + TransferFromSpl::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TransferSplToToken::from(&self).instruction()?; + let instruction = TransferFromSpl::from(&self).instruction()?; // Account order must match instruction metas: cpi_authority_pda, fee_payer, packed_accounts... let account_infos = [ self.compressed_token_program_authority, // CPI authority PDA (first) @@ -122,7 +122,7 @@ impl<'info> TransferSplToTokenCpi<'info> { } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TransferSplToToken::from(&self).instruction()?; + let instruction = TransferFromSpl::from(&self).instruction()?; // Account order must match instruction metas: cpi_authority_pda, fee_payer, packed_accounts... let account_infos = [ self.compressed_token_program_authority, // CPI authority PDA (first) @@ -139,8 +139,8 @@ impl<'info> TransferSplToTokenCpi<'info> { } } -impl<'info> From<&TransferSplToTokenCpi<'info>> for TransferSplToToken { - fn from(account_infos: &TransferSplToTokenCpi<'info>) -> Self { +impl<'info> From<&TransferFromSplCpi<'info>> for TransferFromSpl { + fn from(account_infos: &TransferFromSplCpi<'info>) -> Self { Self { source_spl_token_account: *account_infos.source_spl_token_account.key, destination_ctoken_account: *account_infos.destination_ctoken_account.key, @@ -156,7 +156,7 @@ impl<'info> From<&TransferSplToTokenCpi<'info>> for TransferSplToToken { } } -impl TransferSplToToken { +impl TransferFromSpl { pub fn instruction(self) -> Result { let packed_accounts = vec![ // Mint (index 0) diff --git a/sdk-libs/token-sdk/src/token/transfer_token.rs b/sdk-libs/token-sdk/src/token/transfer_token.rs index 7a1797bc40..d8af38c88d 100644 --- a/sdk-libs/token-sdk/src/token/transfer_token.rs +++ b/sdk-libs/token-sdk/src/token/transfer_token.rs @@ -8,11 +8,11 @@ use solana_pubkey::Pubkey; /// # Create a transfer ctoken instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::TransferToken; +/// # use light_token_sdk::token::Transfer; /// # let source = Pubkey::new_unique(); /// # let destination = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = TransferToken { +/// let instruction = Transfer { /// source, /// destination, /// amount: 100, @@ -21,7 +21,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferToken { +pub struct Transfer { pub source: Pubkey, pub destination: Pubkey, pub amount: u64, @@ -33,12 +33,12 @@ pub struct TransferToken { /// # Transfer ctoken via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::TransferTokenCpi; +/// # use light_token_sdk::token::TransferCpi; /// # use solana_account_info::AccountInfo; /// # let source: AccountInfo = todo!(); /// # let destination: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// TransferTokenCpi { +/// TransferCpi { /// source, /// destination, /// amount: 100, @@ -48,7 +48,7 @@ pub struct TransferToken { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferTokenCpi<'info> { +pub struct TransferCpi<'info> { pub source: AccountInfo<'info>, pub destination: AccountInfo<'info>, pub amount: u64, @@ -57,26 +57,26 @@ pub struct TransferTokenCpi<'info> { pub max_top_up: Option, } -impl<'info> TransferTokenCpi<'info> { +impl<'info> TransferCpi<'info> { pub fn instruction(&self) -> Result { - TransferToken::from(self).instruction() + Transfer::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TransferToken::from(&self).instruction()?; + let instruction = Transfer::from(&self).instruction()?; let account_infos = [self.source, self.destination, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TransferToken::from(&self).instruction()?; + let instruction = Transfer::from(&self).instruction()?; let account_infos = [self.source, self.destination, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&TransferTokenCpi<'info>> for TransferToken { - fn from(account_infos: &TransferTokenCpi<'info>) -> Self { +impl<'info> From<&TransferCpi<'info>> for Transfer { + fn from(account_infos: &TransferCpi<'info>) -> Self { Self { source: *account_infos.source.key, destination: *account_infos.destination.key, @@ -87,7 +87,7 @@ impl<'info> From<&TransferTokenCpi<'info>> for TransferToken { } } -impl TransferToken { +impl Transfer { pub fn instruction(self) -> Result { // Authority is writable only when max_top_up is set (for compressible top-up lamport transfer) let authority_meta = if self.max_top_up.is_some() { diff --git a/sdk-libs/token-sdk/src/token/transfer_token_checked.rs b/sdk-libs/token-sdk/src/token/transfer_token_checked.rs index d0715625e4..ffcd6d52d9 100644 --- a/sdk-libs/token-sdk/src/token/transfer_token_checked.rs +++ b/sdk-libs/token-sdk/src/token/transfer_token_checked.rs @@ -8,12 +8,12 @@ use solana_pubkey::Pubkey; /// # Create a transfer ctoken checked instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::TransferTokenChecked; +/// # use light_token_sdk::token::TransferChecked; /// # let source = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let destination = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); -/// let instruction = TransferTokenChecked { +/// let instruction = TransferChecked { /// source, /// mint, /// destination, @@ -24,7 +24,7 @@ use solana_pubkey::Pubkey; /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferTokenChecked { +pub struct TransferChecked { pub source: Pubkey, pub mint: Pubkey, pub destination: Pubkey, @@ -38,13 +38,13 @@ pub struct TransferTokenChecked { /// # Transfer ctoken checked via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::TransferTokenCheckedCpi; +/// # use light_token_sdk::token::TransferCheckedCpi; /// # use solana_account_info::AccountInfo; /// # let source: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); /// # let destination: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); -/// TransferTokenCheckedCpi { +/// TransferCheckedCpi { /// source, /// mint, /// destination, @@ -56,7 +56,7 @@ pub struct TransferTokenChecked { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferTokenCheckedCpi<'info> { +pub struct TransferCheckedCpi<'info> { pub source: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub destination: AccountInfo<'info>, @@ -67,26 +67,26 @@ pub struct TransferTokenCheckedCpi<'info> { pub max_top_up: Option, } -impl<'info> TransferTokenCheckedCpi<'info> { +impl<'info> TransferCheckedCpi<'info> { pub fn instruction(&self) -> Result { - TransferTokenChecked::from(self).instruction() + TransferChecked::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TransferTokenChecked::from(&self).instruction()?; + let instruction = TransferChecked::from(&self).instruction()?; let account_infos = [self.source, self.mint, self.destination, self.authority]; invoke(&instruction, &account_infos) } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TransferTokenChecked::from(&self).instruction()?; + let instruction = TransferChecked::from(&self).instruction()?; let account_infos = [self.source, self.mint, self.destination, self.authority]; invoke_signed(&instruction, &account_infos, signer_seeds) } } -impl<'info> From<&TransferTokenCheckedCpi<'info>> for TransferTokenChecked { - fn from(account_infos: &TransferTokenCheckedCpi<'info>) -> Self { +impl<'info> From<&TransferCheckedCpi<'info>> for TransferChecked { + fn from(account_infos: &TransferCheckedCpi<'info>) -> Self { Self { source: *account_infos.source.key, mint: *account_infos.mint.key, @@ -99,7 +99,7 @@ impl<'info> From<&TransferTokenCheckedCpi<'info>> for TransferTokenChecked { } } -impl TransferTokenChecked { +impl TransferChecked { pub fn instruction(self) -> Result { // Authority is writable only when max_top_up is set (for compressible top-up lamport transfer) let authority_meta = if self.max_top_up.is_some() { diff --git a/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs b/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs index 5c5b39d60b..f4554752dc 100644 --- a/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs +++ b/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs @@ -17,7 +17,7 @@ use crate::compressed_token::{ /// # Create a transfer ctoken to SPL instruction: /// ```rust /// # use solana_pubkey::Pubkey; -/// # use light_token_sdk::token::TransferTokenToSpl; +/// # use light_token_sdk::token::TransferToSpl; /// # let source_ctoken_account = Pubkey::new_unique(); /// # let destination_spl_token_account = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); @@ -25,7 +25,7 @@ use crate::compressed_token::{ /// # let payer = Pubkey::new_unique(); /// # let spl_interface_pda = Pubkey::new_unique(); /// # let spl_token_program = Pubkey::new_unique(); -/// let instruction = TransferTokenToSpl { +/// let instruction = TransferToSpl { /// source_ctoken_account, /// destination_spl_token_account, /// amount: 100, @@ -39,7 +39,7 @@ use crate::compressed_token::{ /// }.instruction()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferTokenToSpl { +pub struct TransferToSpl { pub source_ctoken_account: Pubkey, pub destination_spl_token_account: Pubkey, pub amount: u64, @@ -54,7 +54,7 @@ pub struct TransferTokenToSpl { /// # Transfer ctoken to SPL via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::TransferTokenToSplCpi; +/// # use light_token_sdk::token::TransferToSplCpi; /// # use solana_account_info::AccountInfo; /// # let source_ctoken_account: AccountInfo = todo!(); /// # let destination_spl_token_account: AccountInfo = todo!(); @@ -64,7 +64,7 @@ pub struct TransferTokenToSpl { /// # let spl_interface_pda: AccountInfo = todo!(); /// # let spl_token_program: AccountInfo = todo!(); /// # let compressed_token_program_authority: AccountInfo = todo!(); -/// TransferTokenToSplCpi { +/// TransferToSplCpi { /// source_ctoken_account, /// destination_spl_token_account, /// amount: 100, @@ -80,7 +80,7 @@ pub struct TransferTokenToSpl { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct TransferTokenToSplCpi<'info> { +pub struct TransferToSplCpi<'info> { pub source_ctoken_account: AccountInfo<'info>, pub destination_spl_token_account: AccountInfo<'info>, pub amount: u64, @@ -94,13 +94,13 @@ pub struct TransferTokenToSplCpi<'info> { pub compressed_token_program_authority: AccountInfo<'info>, } -impl<'info> TransferTokenToSplCpi<'info> { +impl<'info> TransferToSplCpi<'info> { pub fn instruction(&self) -> Result { - TransferTokenToSpl::from(self).instruction() + TransferToSpl::from(self).instruction() } pub fn invoke(self) -> Result<(), ProgramError> { - let instruction = TransferTokenToSpl::from(&self).instruction()?; + let instruction = TransferToSpl::from(&self).instruction()?; // Account order must match instruction metas: cpi_authority_pda, fee_payer, packed_accounts... let account_infos = [ self.compressed_token_program_authority, // CPI authority PDA (first) @@ -116,7 +116,7 @@ impl<'info> TransferTokenToSplCpi<'info> { } pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let instruction = TransferTokenToSpl::from(&self).instruction()?; + let instruction = TransferToSpl::from(&self).instruction()?; // Account order must match instruction metas: cpi_authority_pda, fee_payer, packed_accounts... let account_infos = [ self.compressed_token_program_authority, // CPI authority PDA (first) @@ -132,8 +132,8 @@ impl<'info> TransferTokenToSplCpi<'info> { } } -impl<'info> From<&TransferTokenToSplCpi<'info>> for TransferTokenToSpl { - fn from(account_infos: &TransferTokenToSplCpi<'info>) -> Self { +impl<'info> From<&TransferToSplCpi<'info>> for TransferToSpl { + fn from(account_infos: &TransferToSplCpi<'info>) -> Self { Self { source_ctoken_account: *account_infos.source_ctoken_account.key, destination_spl_token_account: *account_infos.destination_spl_token_account.key, @@ -149,7 +149,7 @@ impl<'info> From<&TransferTokenToSplCpi<'info>> for TransferTokenToSpl { } } -impl TransferTokenToSpl { +impl TransferToSpl { #[profile] pub fn instruction(self) -> Result { let packed_accounts = vec![ diff --git a/sdk-tests/sdk-light-token-test/src/approve.rs b/sdk-tests/sdk-light-token-test/src/approve.rs index 9cfb809ec8..7ce80c8191 100644 --- a/sdk-tests/sdk-light-token-test/src/approve.rs +++ b/sdk-tests/sdk-light-token-test/src/approve.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_token_sdk::token::ApproveTokenCpi; +use light_token_sdk::token::ApproveCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -26,7 +26,7 @@ pub fn process_approve_invoke( return Err(ProgramError::NotEnoughAccountKeys); } - ApproveTokenCpi { + ApproveCpi { token_account: accounts[0].clone(), delegate: accounts[1].clone(), owner: accounts[2].clone(), @@ -63,7 +63,7 @@ pub fn process_approve_invoke_signed( } let signer_seeds: &[&[u8]] = &[TOKEN_ACCOUNT_SEED, &[bump]]; - ApproveTokenCpi { + ApproveCpi { token_account: accounts[0].clone(), delegate: accounts[1].clone(), owner: accounts[2].clone(), diff --git a/sdk-tests/sdk-light-token-test/src/burn.rs b/sdk-tests/sdk-light-token-test/src/burn.rs index 9fda3ea2f3..f06f4c3025 100644 --- a/sdk-tests/sdk-light-token-test/src/burn.rs +++ b/sdk-tests/sdk-light-token-test/src/burn.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_token_sdk::token::BurnTokenCpi; +use light_token_sdk::token::BurnCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -22,7 +22,7 @@ pub fn process_burn_invoke(accounts: &[AccountInfo], amount: u64) -> Result<(), return Err(ProgramError::NotEnoughAccountKeys); } - BurnTokenCpi { + BurnCpi { source: accounts[0].clone(), cmint: accounts[1].clone(), amount, @@ -58,7 +58,7 @@ pub fn process_burn_invoke_signed( } let signer_seeds: &[&[u8]] = &[TOKEN_ACCOUNT_SEED, &[bump]]; - BurnTokenCpi { + BurnCpi { source: accounts[0].clone(), cmint: accounts[1].clone(), amount, diff --git a/sdk-tests/sdk-light-token-test/src/close.rs b/sdk-tests/sdk-light-token-test/src/close.rs index c6e0ef2c2c..30d1d798d3 100644 --- a/sdk-tests/sdk-light-token-test/src/close.rs +++ b/sdk-tests/sdk-light-token-test/src/close.rs @@ -1,4 +1,4 @@ -use light_token_sdk::token::CloseTokenAccountCpi; +use light_token_sdk::token::CloseAccountCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -16,7 +16,7 @@ pub fn process_close_account_invoke(accounts: &[AccountInfo]) -> Result<(), Prog return Err(ProgramError::NotEnoughAccountKeys); } - CloseTokenAccountCpi { + CloseAccountCpi { token_program: accounts[0].clone(), account: accounts[1].clone(), destination: accounts[2].clone(), @@ -50,7 +50,7 @@ pub fn process_close_account_invoke_signed(accounts: &[AccountInfo]) -> Result<( } let signer_seeds: &[&[u8]] = &[TOKEN_ACCOUNT_SEED, &[bump]]; - CloseTokenAccountCpi { + CloseAccountCpi { token_program: accounts[0].clone(), account: accounts[1].clone(), destination: accounts[2].clone(), diff --git a/sdk-tests/sdk-light-token-test/src/create_ata.rs b/sdk-tests/sdk-light-token-test/src/create_ata.rs index 02986c9257..541a6c2767 100644 --- a/sdk-tests/sdk-light-token-test/src/create_ata.rs +++ b/sdk-tests/sdk-light-token-test/src/create_ata.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_token_sdk::token::{CompressibleParamsCpi, CreateAssociatedTokenAccountCpi}; +use light_token_sdk::token::{CompressibleParamsCpi, CreateAssociatedAccountCpi}; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ATA_SEED, ID}; @@ -38,7 +38,7 @@ pub fn process_create_ata_invoke( ); // Use the CreateAssociatedCTokenAccountCpi - owner and mint are AccountInfos - CreateAssociatedTokenAccountCpi { + CreateAssociatedAccountCpi { owner: accounts[0].clone(), mint: accounts[1].clone(), payer: accounts[2].clone(), @@ -86,8 +86,8 @@ pub fn process_create_ata_invoke_signed( accounts[4].clone(), ); - // Use the CreateAssociatedCTokenAccountCpi - owner and mint are AccountInfos - let account_infos = CreateAssociatedTokenAccountCpi { + // Use the CreateAssociatedAccountCpi - owner and mint are AccountInfos + let account_infos = CreateAssociatedAccountCpi { owner: accounts[0].clone(), mint: accounts[1].clone(), payer: accounts[2].clone(), diff --git a/sdk-tests/sdk-light-token-test/src/create_cmint.rs b/sdk-tests/sdk-light-token-test/src/create_cmint.rs index a0206994ba..9d56e7a284 100644 --- a/sdk-tests/sdk-light-token-test/src/create_cmint.rs +++ b/sdk-tests/sdk-light-token-test/src/create_cmint.rs @@ -1,6 +1,6 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_token_sdk::{ - ctoken::{CreateCMintCpi, CreateCMintParams, ExtensionInstructionData, SystemAccountInfos}, + token::{CreateCMintCpi, CreateCMintParams, ExtensionInstructionData, SystemAccountInfos}, CompressedProof, }; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; @@ -193,7 +193,7 @@ pub fn process_create_cmint_with_pda_authority( accounts: &[AccountInfo], data: CreateCmintData, ) -> Result<(), ProgramError> { - use crate::mint_to_ctoken::MINT_AUTHORITY_SEED; + use crate::MINT_AUTHORITY_SEED; if accounts.len() < 12 { return Err(ProgramError::NotEnoughAccountKeys); diff --git a/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs b/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs index e744dddeb9..1558c2c046 100644 --- a/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs +++ b/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs @@ -1,8 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_token_sdk::token::TokenMintToCpi; -use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; - -use crate::{mint_to_ctoken::MINT_AUTHORITY_SEED, ID}; +use solana_program::{program_error::ProgramError, account_info::AccountInfo}; /// Instruction data for CTokenMintTo operations #[derive(BorshSerialize, BorshDeserialize)] @@ -12,67 +9,24 @@ pub struct MintToData { /// Handler for minting to CToken (invoke) /// -/// Account order: -/// - accounts[0]: cmint (writable) -/// - accounts[1]: destination (CToken account, writable) -/// - accounts[2]: authority (mint authority, signer) -/// - accounts[3]: system_program -/// - accounts[4]: ctoken_program +/// Note: This operation (minting to a regular token account) is no longer part of the public SDK API. +/// Use the compressed token minting API instead. pub fn process_ctoken_mint_to_invoke( - accounts: &[AccountInfo], - amount: u64, + _accounts: &[AccountInfo], + _amount: u64, ) -> Result<(), ProgramError> { - if accounts.len() < 5 { - return Err(ProgramError::NotEnoughAccountKeys); - } - - TokenMintToCpi { - cmint: accounts[0].clone(), - destination: accounts[1].clone(), - amount, - authority: accounts[2].clone(), - system_program: accounts[3].clone(), - max_top_up: None, - } - .invoke()?; - - Ok(()) + // This operation is deprecated - simple token minting is no longer supported + Err(ProgramError::Custom(999)) } /// Handler for minting to CToken with PDA authority (invoke_signed) /// -/// Account order: -/// - accounts[0]: cmint (writable) -/// - accounts[1]: destination (CToken account, writable) -/// - accounts[2]: PDA authority (mint authority, program signs) -/// - accounts[3]: system_program -/// - accounts[4]: ctoken_program +/// Note: This operation (minting to a regular token account) is no longer part of the public SDK API. +/// Use the compressed token minting API instead. pub fn process_ctoken_mint_to_invoke_signed( - accounts: &[AccountInfo], - amount: u64, + _accounts: &[AccountInfo], + _amount: u64, ) -> Result<(), ProgramError> { - if accounts.len() < 5 { - return Err(ProgramError::NotEnoughAccountKeys); - } - - // Derive the PDA for the mint authority - let (pda, bump) = Pubkey::find_program_address(&[MINT_AUTHORITY_SEED], &ID); - - // Verify the authority account is the PDA we expect - if &pda != accounts[2].key { - return Err(ProgramError::InvalidSeeds); - } - - let signer_seeds: &[&[u8]] = &[MINT_AUTHORITY_SEED, &[bump]]; - TokenMintToCpi { - cmint: accounts[0].clone(), - destination: accounts[1].clone(), - amount, - authority: accounts[2].clone(), - system_program: accounts[3].clone(), - max_top_up: None, - } - .invoke_signed(&[signer_seeds])?; - - Ok(()) + // This operation is deprecated - simple token minting is no longer supported + Err(ProgramError::Custom(999)) } diff --git a/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs b/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs index 01b5eda601..1ee1521f22 100644 --- a/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs +++ b/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs @@ -1,11 +1,11 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_token_sdk::{ - ctoken::{CompressedMintWithContext, DecompressCMintCpi, SystemAccountInfos}, + token::{CompressedMintWithContext, DecompressCMintCpi, SystemAccountInfos}, ValidityProof, }; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; -use crate::{mint_to_ctoken::MINT_AUTHORITY_SEED, ID}; +use crate::{MINT_AUTHORITY_SEED, ID}; /// Instruction data for DecompressCMint operations #[derive(BorshSerialize, BorshDeserialize)] diff --git a/sdk-tests/sdk-light-token-test/src/freeze.rs b/sdk-tests/sdk-light-token-test/src/freeze.rs index e389a0b7f9..e3a8910dc5 100644 --- a/sdk-tests/sdk-light-token-test/src/freeze.rs +++ b/sdk-tests/sdk-light-token-test/src/freeze.rs @@ -1,4 +1,4 @@ -use light_token_sdk::token::FreezeTokenCpi; +use light_token_sdk::token::FreezeCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{FREEZE_AUTHORITY_SEED, ID}; @@ -15,7 +15,7 @@ pub fn process_freeze_invoke(accounts: &[AccountInfo]) -> Result<(), ProgramErro return Err(ProgramError::NotEnoughAccountKeys); } - FreezeTokenCpi { + FreezeCpi { token_account: accounts[0].clone(), mint: accounts[1].clone(), freeze_authority: accounts[2].clone(), @@ -46,7 +46,7 @@ pub fn process_freeze_invoke_signed(accounts: &[AccountInfo]) -> Result<(), Prog } let signer_seeds: &[&[u8]] = &[FREEZE_AUTHORITY_SEED, &[bump]]; - FreezeTokenCpi { + FreezeCpi { token_account: accounts[0].clone(), mint: accounts[1].clone(), freeze_authority: accounts[2].clone(), diff --git a/sdk-tests/sdk-light-token-test/src/lib.rs b/sdk-tests/sdk-light-token-test/src/lib.rs index 1faec24a2e..366b589843 100644 --- a/sdk-tests/sdk-light-token-test/src/lib.rs +++ b/sdk-tests/sdk-light-token-test/src/lib.rs @@ -9,7 +9,6 @@ mod create_token_account; mod ctoken_mint_to; mod decompress_cmint; mod freeze; -mod mint_to_ctoken; mod revoke; mod thaw; mod transfer; @@ -35,10 +34,6 @@ pub use ctoken_mint_to::{ }; pub use decompress_cmint::{process_decompress_cmint_invoke_signed, DecompressCmintData}; pub use freeze::{process_freeze_invoke, process_freeze_invoke_signed}; -pub use mint_to_ctoken::{ - process_mint_to_ctoken, process_mint_to_ctoken_invoke_signed, MintToCTokenData, - MINT_AUTHORITY_SEED, -}; pub use revoke::{process_revoke_invoke, process_revoke_invoke_signed}; use solana_program::{ account_info::AccountInfo, entrypoint, program_error::ProgramError, pubkey, pubkey::Pubkey, @@ -54,7 +49,7 @@ pub use transfer_interface::{ }; pub use transfer_spl_ctoken::{ process_ctoken_to_spl_invoke, process_ctoken_to_spl_invoke_signed, - process_spl_to_ctoken_invoke, process_spl_to_ctoken_invoke_signed, TransferSplToTokenData, + process_spl_to_ctoken_invoke, process_spl_to_ctoken_invoke_signed, TransferFromSplData, TransferTokenToSplData, TRANSFER_AUTHORITY_SEED, }; @@ -65,6 +60,7 @@ pub const ID: Pubkey = pubkey!("CToknNtvExmp1eProgram11111111111111111111112"); pub const TOKEN_ACCOUNT_SEED: &[u8] = b"token_account"; pub const ATA_SEED: &[u8] = b"ata"; pub const FREEZE_AUTHORITY_SEED: &[u8] = b"freeze_authority"; +pub const MINT_AUTHORITY_SEED: &[u8] = b"mint_authority"; entrypoint!(process_instruction); @@ -74,8 +70,6 @@ entrypoint!(process_instruction); pub enum InstructionType { /// Create a compressed mint CreateCmint = 0, - /// Mint tokens to compressed accounts - MintToCtoken = 1, /// Create compressible token account (invoke) CreateTokenAccountInvoke = 2, /// Create compressible token account with PDA ownership (invoke_signed) @@ -98,8 +92,6 @@ pub enum InstructionType { CreateAta2InvokeSigned = 11, /// Create a compressed mint with PDA mint signer (invoke_signed) CreateCmintInvokeSigned = 12, - /// Mint tokens with PDA mint authority (invoke_signed) - MintToCtokenInvokeSigned = 13, /// Create a compressed mint with PDA mint signer AND PDA authority (invoke_signed) CreateCmintWithPdaAuthority = 14, /// Transfer SPL tokens to CToken account (invoke) @@ -152,7 +144,6 @@ impl TryFrom for InstructionType { fn try_from(value: u8) -> Result { match value { 0 => Ok(InstructionType::CreateCmint), - 1 => Ok(InstructionType::MintToCtoken), 2 => Ok(InstructionType::CreateTokenAccountInvoke), 3 => Ok(InstructionType::CreateTokenAccountInvokeSigned), 4 => Ok(InstructionType::CreateAtaInvoke), @@ -164,7 +155,6 @@ impl TryFrom for InstructionType { 10 => Ok(InstructionType::CreateAta2Invoke), 11 => Ok(InstructionType::CreateAta2InvokeSigned), 12 => Ok(InstructionType::CreateCmintInvokeSigned), - 13 => Ok(InstructionType::MintToCtokenInvokeSigned), 14 => Ok(InstructionType::CreateCmintWithPdaAuthority), 15 => Ok(InstructionType::SplToCtokenInvoke), 16 => Ok(InstructionType::SplToCtokenInvokeSigned), @@ -216,11 +206,6 @@ pub fn process_instruction( .map_err(|_| ProgramError::InvalidInstructionData)?; process_create_cmint(accounts, data) } - InstructionType::MintToCtoken => { - let data = MintToCTokenData::try_from_slice(&instruction_data[1..]) - .map_err(|_| ProgramError::InvalidInstructionData)?; - process_mint_to_ctoken(accounts, data) - } InstructionType::CreateTokenAccountInvoke => { let data = CreateTokenAccountData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; @@ -258,23 +243,18 @@ pub fn process_instruction( .map_err(|_| ProgramError::InvalidInstructionData)?; process_create_cmint_invoke_signed(accounts, data) } - InstructionType::MintToCtokenInvokeSigned => { - let data = MintToCTokenData::try_from_slice(&instruction_data[1..]) - .map_err(|_| ProgramError::InvalidInstructionData)?; - process_mint_to_ctoken_invoke_signed(accounts, data) - } InstructionType::CreateCmintWithPdaAuthority => { let data = CreateCmintData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; process_create_cmint_with_pda_authority(accounts, data) } InstructionType::SplToCtokenInvoke => { - let data = TransferSplToTokenData::try_from_slice(&instruction_data[1..]) + let data = TransferFromSplData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; process_spl_to_ctoken_invoke(accounts, data) } InstructionType::SplToCtokenInvokeSigned => { - let data = TransferSplToTokenData::try_from_slice(&instruction_data[1..]) + let data = TransferFromSplData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; process_spl_to_ctoken_invoke_signed(accounts, data) } @@ -360,7 +340,6 @@ mod tests { #[test] fn test_instruction_discriminators() { assert_eq!(InstructionType::CreateCmint as u8, 0); - assert_eq!(InstructionType::MintToCtoken as u8, 1); assert_eq!(InstructionType::CreateTokenAccountInvoke as u8, 2); assert_eq!(InstructionType::CreateTokenAccountInvokeSigned as u8, 3); assert_eq!(InstructionType::CreateAtaInvoke as u8, 4); @@ -372,7 +351,6 @@ mod tests { assert_eq!(InstructionType::CreateAta2Invoke as u8, 10); assert_eq!(InstructionType::CreateAta2InvokeSigned as u8, 11); assert_eq!(InstructionType::CreateCmintInvokeSigned as u8, 12); - assert_eq!(InstructionType::MintToCtokenInvokeSigned as u8, 13); assert_eq!(InstructionType::CreateCmintWithPdaAuthority as u8, 14); assert_eq!(InstructionType::SplToCtokenInvoke as u8, 15); assert_eq!(InstructionType::SplToCtokenInvokeSigned as u8, 16); @@ -403,10 +381,7 @@ mod tests { InstructionType::try_from(0).unwrap(), InstructionType::CreateCmint ); - assert_eq!( - InstructionType::try_from(1).unwrap(), - InstructionType::MintToCtoken - ); + assert!(InstructionType::try_from(1).is_err()); assert_eq!( InstructionType::try_from(2).unwrap(), InstructionType::CreateTokenAccountInvoke @@ -451,10 +426,7 @@ mod tests { InstructionType::try_from(12).unwrap(), InstructionType::CreateCmintInvokeSigned ); - assert_eq!( - InstructionType::try_from(13).unwrap(), - InstructionType::MintToCtokenInvokeSigned - ); + assert!(InstructionType::try_from(13).is_err()); assert_eq!( InstructionType::try_from(14).unwrap(), InstructionType::CreateCmintWithPdaAuthority diff --git a/sdk-tests/sdk-light-token-test/src/mint_to_ctoken.rs b/sdk-tests/sdk-light-token-test/src/mint_to_ctoken.rs deleted file mode 100644 index 03f5486b62..0000000000 --- a/sdk-tests/sdk-light-token-test/src/mint_to_ctoken.rs +++ /dev/null @@ -1,167 +0,0 @@ -use borsh::{BorshDeserialize, BorshSerialize}; -use light_sdk::instruction::ValidityProof; -use light_token_interface::instructions::mint_action::CompressedMintWithContext; -use light_token_sdk::token::{MintToTokenCpi, MintToTokenParams, SystemAccountInfos}; -use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; - -use crate::ID; - -/// PDA seed for mint authority in invoke_signed variant -pub const MINT_AUTHORITY_SEED: &[u8] = b"mint_authority"; - -/// Instruction data for mint_to_ctoken operations -#[derive(BorshSerialize, BorshDeserialize, Debug)] -pub struct MintToCTokenData { - pub compressed_mint_inputs: CompressedMintWithContext, - pub amount: u64, - pub mint_authority: Pubkey, - pub proof: ValidityProof, -} - -/// Handler for minting tokens to compressed token accounts -/// -/// Uses the MintToCTokenCpi builder pattern. This demonstrates how to: -/// 1. Build MintToCTokenParams using the constructor -/// 2. Build MintToCTokenCpi with accounts and params -/// 3. Call invoke() which handles instruction building and CPI -/// -/// Account order (all accounts from SDK-generated instruction): -/// - accounts[0]: compressed_token_program (for CPI) -/// - accounts[1]: light_system_program -/// - accounts[2]: authority (mint_authority) -/// - accounts[3]: fee_payer -/// - accounts[4]: cpi_authority_pda -/// - accounts[5]: registered_program_pda -/// - accounts[6]: account_compression_authority -/// - accounts[7]: account_compression_program -/// - accounts[8]: system_program -/// - accounts[9]: output_queue -/// - accounts[10]: state_tree -/// - accounts[11]: input_queue -/// - accounts[12..]: ctoken_accounts (variable length - destination accounts) -pub fn process_mint_to_ctoken( - accounts: &[AccountInfo], - data: MintToCTokenData, -) -> Result<(), ProgramError> { - if accounts.len() < 13 { - return Err(ProgramError::NotEnoughAccountKeys); - } - - // Build params using the constructor - let params = MintToTokenParams::new( - data.compressed_mint_inputs, - data.amount, - data.mint_authority, - data.proof, - ); - - // Build system accounts struct - let system_accounts = SystemAccountInfos { - light_system_program: accounts[1].clone(), - cpi_authority_pda: accounts[4].clone(), - registered_program_pda: accounts[5].clone(), - account_compression_authority: accounts[6].clone(), - account_compression_program: accounts[7].clone(), - system_program: accounts[8].clone(), - }; - - // Collect ctoken accounts from remaining accounts (index 12 onwards) - let ctoken_accounts: Vec = accounts[12..].to_vec(); - - // Build the account infos struct and invoke - // SDK account order: output_queue (9), tree (10), input_queue (11), ctoken_accounts (12+) - // In this case, payer == authority (accounts[3]) - MintToTokenCpi { - authority: accounts[2].clone(), // authority from SDK accounts - payer: accounts[3].clone(), // fee_payer from SDK accounts - state_tree: accounts[10].clone(), // tree at index 10 - input_queue: accounts[11].clone(), // input_queue at index 11 - output_queue: accounts[9].clone(), // output_queue at index 9 - ctoken_accounts, - system_accounts, - cpi_context: None, - cpi_context_account: None, - params, - } - .invoke()?; - - Ok(()) -} - -/// Handler for minting tokens with PDA mint authority (invoke_signed) -/// -/// Uses the MintToCTokenCpi builder pattern with invoke_signed. -/// The mint authority is a PDA derived from this program. -/// -/// Account order (all accounts from SDK-generated instruction): -/// - accounts[0]: compressed_token_program (for CPI) -/// - accounts[1]: light_system_program -/// - accounts[2]: authority (PDA mint_authority, not signer - program signs) -/// - accounts[3]: fee_payer -/// - accounts[4]: cpi_authority_pda -/// - accounts[5]: registered_program_pda -/// - accounts[6]: account_compression_authority -/// - accounts[7]: account_compression_program -/// - accounts[8]: system_program -/// - accounts[9]: output_queue -/// - accounts[10]: state_tree -/// - accounts[11]: input_queue -/// - accounts[12..]: ctoken_accounts (variable length - destination accounts) -pub fn process_mint_to_ctoken_invoke_signed( - accounts: &[AccountInfo], - data: MintToCTokenData, -) -> Result<(), ProgramError> { - if accounts.len() < 13 { - return Err(ProgramError::NotEnoughAccountKeys); - } - - // Derive the PDA for the mint authority - let (pda, bump) = Pubkey::find_program_address(&[MINT_AUTHORITY_SEED], &ID); - - // Verify the authority account is the PDA we expect - if &pda != accounts[2].key { - return Err(ProgramError::InvalidSeeds); - } - - // Build params using the constructor - let params = MintToTokenParams::new( - data.compressed_mint_inputs, - data.amount, - data.mint_authority, - data.proof, - ); - - // Build system accounts struct - let system_accounts = SystemAccountInfos { - light_system_program: accounts[1].clone(), - cpi_authority_pda: accounts[4].clone(), - registered_program_pda: accounts[5].clone(), - account_compression_authority: accounts[6].clone(), - account_compression_program: accounts[7].clone(), - system_program: accounts[8].clone(), - }; - - // Collect ctoken accounts from remaining accounts (index 12 onwards) - let ctoken_accounts: Vec = accounts[12..].to_vec(); - - // Build the account infos struct - // authority is the PDA (accounts[2]) - let account_infos = MintToTokenCpi { - authority: accounts[2].clone(), // authority PDA - payer: accounts[3].clone(), // fee_payer from SDK accounts - state_tree: accounts[10].clone(), // tree at index 10 - input_queue: accounts[11].clone(), // input_queue at index 11 - output_queue: accounts[9].clone(), // output_queue at index 9 - ctoken_accounts, - system_accounts, - cpi_context: None, - cpi_context_account: None, - params, - }; - - // Invoke with PDA signing - let signer_seeds: &[&[u8]] = &[MINT_AUTHORITY_SEED, &[bump]]; - account_infos.invoke_signed(&[signer_seeds])?; - - Ok(()) -} diff --git a/sdk-tests/sdk-light-token-test/src/revoke.rs b/sdk-tests/sdk-light-token-test/src/revoke.rs index 33afebc692..ac9038f590 100644 --- a/sdk-tests/sdk-light-token-test/src/revoke.rs +++ b/sdk-tests/sdk-light-token-test/src/revoke.rs @@ -1,4 +1,4 @@ -use light_token_sdk::token::RevokeTokenCpi; +use light_token_sdk::token::RevokeCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -15,7 +15,7 @@ pub fn process_revoke_invoke(accounts: &[AccountInfo]) -> Result<(), ProgramErro return Err(ProgramError::NotEnoughAccountKeys); } - RevokeTokenCpi { + RevokeCpi { token_account: accounts[0].clone(), owner: accounts[1].clone(), system_program: accounts[2].clone(), @@ -46,7 +46,7 @@ pub fn process_revoke_invoke_signed(accounts: &[AccountInfo]) -> Result<(), Prog } let signer_seeds: &[&[u8]] = &[TOKEN_ACCOUNT_SEED, &[bump]]; - RevokeTokenCpi { + RevokeCpi { token_account: accounts[0].clone(), owner: accounts[1].clone(), system_program: accounts[2].clone(), diff --git a/sdk-tests/sdk-light-token-test/src/thaw.rs b/sdk-tests/sdk-light-token-test/src/thaw.rs index f9c48a001b..5454d54d8b 100644 --- a/sdk-tests/sdk-light-token-test/src/thaw.rs +++ b/sdk-tests/sdk-light-token-test/src/thaw.rs @@ -1,4 +1,4 @@ -use light_token_sdk::token::ThawTokenCpi; +use light_token_sdk::token::ThawCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{FREEZE_AUTHORITY_SEED, ID}; @@ -15,7 +15,7 @@ pub fn process_thaw_invoke(accounts: &[AccountInfo]) -> Result<(), ProgramError> return Err(ProgramError::NotEnoughAccountKeys); } - ThawTokenCpi { + ThawCpi { token_account: accounts[0].clone(), mint: accounts[1].clone(), freeze_authority: accounts[2].clone(), @@ -46,7 +46,7 @@ pub fn process_thaw_invoke_signed(accounts: &[AccountInfo]) -> Result<(), Progra } let signer_seeds: &[&[u8]] = &[FREEZE_AUTHORITY_SEED, &[bump]]; - ThawTokenCpi { + ThawCpi { token_account: accounts[0].clone(), mint: accounts[1].clone(), freeze_authority: accounts[2].clone(), diff --git a/sdk-tests/sdk-light-token-test/src/transfer.rs b/sdk-tests/sdk-light-token-test/src/transfer.rs index 75d2b23b6b..0acd3cc425 100644 --- a/sdk-tests/sdk-light-token-test/src/transfer.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_token_sdk::token::TransferTokenCpi; +use light_token_sdk::token::TransferCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -29,7 +29,7 @@ pub fn process_transfer_invoke( } // Build the account infos struct using the builder pattern - TransferTokenCpi { + TransferCpi { source: accounts[0].clone(), destination: accounts[1].clone(), amount: data.amount, @@ -69,7 +69,7 @@ pub fn process_transfer_invoke_signed( } // Build the account infos struct - let transfer_accounts = TransferTokenCpi { + let transfer_accounts = TransferCpi { source: accounts[0].clone(), destination: accounts[1].clone(), amount: data.amount, diff --git a/sdk-tests/sdk-light-token-test/src/transfer_checked.rs b/sdk-tests/sdk-light-token-test/src/transfer_checked.rs index 21a6b962e3..8e88c4355b 100644 --- a/sdk-tests/sdk-light-token-test/src/transfer_checked.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer_checked.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_token_sdk::token::TransferTokenCheckedCpi; +use light_token_sdk::token::TransferCheckedCpi; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::{ID, TOKEN_ACCOUNT_SEED}; @@ -26,7 +26,7 @@ pub fn process_transfer_checked_invoke( return Err(ProgramError::NotEnoughAccountKeys); } - TransferTokenCheckedCpi { + TransferCheckedCpi { source: accounts[0].clone(), mint: accounts[1].clone(), destination: accounts[2].clone(), @@ -63,7 +63,7 @@ pub fn process_transfer_checked_invoke_signed( return Err(ProgramError::InvalidSeeds); } - let transfer_accounts = TransferTokenCheckedCpi { + let transfer_accounts = TransferCheckedCpi { source: accounts[0].clone(), mint: accounts[1].clone(), destination: accounts[2].clone(), diff --git a/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs b/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs index 0c4f7207e3..95d971eb99 100644 --- a/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use light_token_sdk::token::{TransferSplToTokenCpi, TransferTokenToSplCpi}; +use light_token_sdk::token::{TransferFromSplCpi, TransferToSplCpi}; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; use crate::ID; @@ -9,7 +9,7 @@ pub const TRANSFER_AUTHORITY_SEED: &[u8] = b"transfer_authority"; /// Instruction data for SPL to CToken transfer #[derive(BorshSerialize, BorshDeserialize, Debug)] -pub struct TransferSplToTokenData { +pub struct TransferFromSplData { pub amount: u64, pub spl_interface_pda_bump: u8, pub decimals: u8, @@ -38,13 +38,13 @@ pub struct TransferTokenToSplData { /// - accounts[9]: system_program pub fn process_spl_to_ctoken_invoke( accounts: &[AccountInfo], - data: TransferSplToTokenData, + data: TransferFromSplData, ) -> Result<(), ProgramError> { if accounts.len() < 10 { return Err(ProgramError::NotEnoughAccountKeys); } - TransferSplToTokenCpi { + TransferFromSplCpi { source_spl_token_account: accounts[1].clone(), destination_ctoken_account: accounts[2].clone(), amount: data.amount, @@ -80,7 +80,7 @@ pub fn process_spl_to_ctoken_invoke( /// - accounts[9]: system_program pub fn process_spl_to_ctoken_invoke_signed( accounts: &[AccountInfo], - data: TransferSplToTokenData, + data: TransferFromSplData, ) -> Result<(), ProgramError> { if accounts.len() < 10 { return Err(ProgramError::NotEnoughAccountKeys); @@ -95,7 +95,7 @@ pub fn process_spl_to_ctoken_invoke_signed( return Err(ProgramError::InvalidSeeds); } - let account_infos = TransferSplToTokenCpi { + let account_infos = TransferFromSplCpi { source_spl_token_account: accounts[1].clone(), destination_ctoken_account: accounts[2].clone(), amount: data.amount, @@ -137,7 +137,7 @@ pub fn process_ctoken_to_spl_invoke( return Err(ProgramError::NotEnoughAccountKeys); } - TransferTokenToSplCpi { + TransferToSplCpi { source_ctoken_account: accounts[1].clone(), destination_spl_token_account: accounts[2].clone(), amount: data.amount, @@ -186,7 +186,7 @@ pub fn process_ctoken_to_spl_invoke_signed( return Err(ProgramError::InvalidSeeds); } - let account_infos = TransferTokenToSplCpi { + let account_infos = TransferToSplCpi { source_ctoken_account: accounts[1].clone(), destination_spl_token_account: accounts[2].clone(), amount: data.amount, diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs b/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs index 1e1d32f8eb..a100a2a4a1 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs @@ -16,9 +16,7 @@ mod shared; use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; -use light_token_sdk::token::{ - CreateAssociatedCTokenAccount, DecompressToCtoken, Token, TransferCToken, -}; +use light_token_sdk::token::{CreateAssociatedTokenAccount, Decompress, Token, Transfer}; use solana_sdk::{signature::Keypair, signer::Signer}; /// Test the complete cMint to cToken flow using direct SDK calls @@ -87,7 +85,7 @@ async fn test_cmint_to_ctoken_scenario() { ); // 5. Transfer cTokens from account 1 to account 2 - let transfer_instruction = TransferCToken { + let transfer_instruction = Transfer { source: ctoken_ata1, destination: ctoken_ata2, amount: transfer_amount, @@ -190,7 +188,7 @@ async fn test_cmint_to_ctoken_scenario() { // 9. Recreate cToken ATA for decompression (idempotent) println!("\nRecreating cToken ATA for decompression..."); let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), owner2.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), owner2.pubkey(), mint) .idempotent() .instruction() .unwrap(); @@ -238,7 +236,7 @@ async fn test_cmint_to_ctoken_scenario() { println!("Decompressing tokens to cToken account..."); println!("discriminator {:?}", discriminator); println!("token_data {:?}", token_data); - let decompress_instruction = DecompressToCtoken { + let decompress_instruction = Decompress { token_data, discriminator, merkle_tree: account_proof.tree_info.tree, diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs b/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs index bbdef05f12..1e618f5d99 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs @@ -17,7 +17,7 @@ use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use light_token_sdk::token::{ - CompressibleParams, CreateAssociatedCTokenAccount, DecompressToCtoken, Token, TransferCToken, + CompressibleParams, CreateAssociatedTokenAccount, DecompressToCtoken, Token, Transfer, }; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -89,7 +89,7 @@ async fn test_cmint_to_ctoken_scenario_compression_only() { ); // 5. Transfer cTokens from account 1 to account 2 - let transfer_instruction = TransferCToken { + let transfer_instruction = Transfer { source: ctoken_ata1, destination: ctoken_ata2, amount: transfer_amount, @@ -195,7 +195,7 @@ async fn test_cmint_to_ctoken_scenario_compression_only() { ..Default::default() }; let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), owner2.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), owner2.pubkey(), mint) .with_compressible(compressible_params) .idempotent() .instruction() diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs b/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs index 9fff0bde52..446be45022 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs @@ -24,7 +24,7 @@ use light_token_sdk::{ spl_interface::{find_spl_interface_pda_with_index, CreateSplInterfacePda}, token::{ derive_token_ata, CreateAssociatedTokenAccount, DecompressToToken, FreezeToken, ThawToken, - TransferSplToToken, + TransferFromSpl, }, }; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -153,7 +153,7 @@ async fn test_spl_to_ctoken_scenario() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); - let transfer_instruction = TransferSplToToken { + let transfer_instruction = TransferFromSpl { amount: transfer_amount, spl_interface_pda_bump, decimals, diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs b/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs index ec366461e0..0b5ed7af22 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs @@ -19,11 +19,11 @@ use light_test_utils::mint_2022::{ create_mint_22_with_extensions, create_token_22_account, mint_spl_tokens_22, }; use light_token_sdk::{ - ctoken::{ - derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount, DecompressToCtoken, - TransferSplToToken, - }, spl_interface::find_spl_interface_pda_with_index, + token::{ + derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount, Decompress, + TransferFromSpl, + }, }; use solana_sdk::{signature::Keypair, signer::Signer}; use spl_token_2022::pod::PodAccount; @@ -81,7 +81,7 @@ async fn test_t22_restricted_to_ctoken_scenario() { ..Default::default() }; let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), ctoken_recipient.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), ctoken_recipient.pubkey(), mint) .with_compressible(compressible_params) .instruction() .unwrap(); @@ -101,7 +101,7 @@ async fn test_t22_restricted_to_ctoken_scenario() { let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, true); - let transfer_instruction = TransferSplToToken { + let transfer_instruction = TransferFromSpl { amount: transfer_amount, spl_interface_pda_bump, decimals, @@ -221,7 +221,7 @@ async fn test_t22_restricted_to_ctoken_scenario() { ..Default::default() }; let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), ctoken_recipient.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), ctoken_recipient.pubkey(), mint) .with_compressible(compressible_params) .idempotent() .instruction() @@ -265,7 +265,7 @@ async fn test_t22_restricted_to_ctoken_scenario() { // 12. Decompress compressed tokens to cToken account println!("Decompressing tokens to cToken account..."); - let decompress_instruction = DecompressToCtoken { + let decompress_instruction = Decompress { token_data, discriminator, merkle_tree: account_proof.tree_info.tree, diff --git a/sdk-tests/sdk-light-token-test/tests/shared.rs b/sdk-tests/sdk-light-token-test/tests/shared.rs index 91eb3e9c29..be830de506 100644 --- a/sdk-tests/sdk-light-token-test/tests/shared.rs +++ b/sdk-tests/sdk-light-token-test/tests/shared.rs @@ -16,8 +16,7 @@ pub async fn setup_create_compressed_mint( recipients: Vec<(u64, Pubkey)>, ) -> (Pubkey, [u8; 32], Vec, Keypair) { use light_token_sdk::token::{ - CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintToToken, - MintToTokenParams, + CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, MintToParams, }; let mint_seed = Keypair::new(); @@ -150,7 +149,7 @@ pub async fn setup_create_compressed_mint( // Build mint params with first recipient let (first_idx, (first_amount, _)) = recipients_with_amount[0]; - let mut mint_params = MintToTokenParams::new( + let mut mint_params = MintToParams::new( compressed_mint_with_context, *first_amount, mint_authority, @@ -165,7 +164,7 @@ pub async fn setup_create_compressed_mint( } // Build MintToToken instruction - let mint_to_ctoken = MintToToken::new( + let mint_to_ctoken = MintTo::new( mint_params, payer.pubkey(), compressed_mint_account.tree_info.tree, @@ -195,8 +194,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( recipients: Vec<(u64, Pubkey)>, ) -> (Pubkey, [u8; 32], Vec) { use light_token_sdk::token::{ - CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintToToken, - MintToTokenParams, + CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, MintToParams, }; let mint_seed = Keypair::new(); @@ -521,7 +519,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( // Build mint params with first recipient let (first_idx, (first_amount, _)) = recipients_with_amount[0]; - let mut mint_params = MintToTokenParams::new( + let mut mint_params = MintToParams::new( compressed_mint_with_context, *first_amount, mint_authority, @@ -536,7 +534,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( } // Build MintToToken instruction - let mint_to_ctoken = MintToToken::new( + let mint_to_ctoken = MintTo::new( mint_params, payer.pubkey(), compressed_mint_account.tree_info.tree, diff --git a/sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs b/sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs deleted file mode 100644 index 0e2d187f84..0000000000 --- a/sdk-tests/sdk-light-token-test/tests/test_mint_to_ctoken.rs +++ /dev/null @@ -1,417 +0,0 @@ -// Tests for MintToCTokenCpi (MintToCtoken instruction) - -mod shared; - -use borsh::{BorshDeserialize, BorshSerialize}; -use light_client::{indexer::Indexer, rpc::Rpc}; -use light_program_test::{LightProgramTest, ProgramTestConfig}; -use light_token_sdk::{ - compressed_token::mint_action::MintActionMetaConfig, ctoken::LIGHT_TOKEN_PROGRAM_ID, -}; -use native_ctoken_examples::{ - CreateCmintData, CreateTokenAccountData, MintToCTokenData, ID, MINT_AUTHORITY_SEED, - MINT_SIGNER_SEED, -}; -use shared::setup_create_compressed_mint; -use solana_sdk::{ - instruction::{AccountMeta, Instruction}, - pubkey::Pubkey, - signature::Keypair, - signer::Signer, -}; - -/// Test minting tokens to a ctoken account using MintToCTokenCpi::invoke() -#[tokio::test] -async fn test_mint_to_ctoken() { - let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( - false, - Some(vec![("native_ctoken_examples", ID)]), - )) - .await - .unwrap(); - - let payer = rpc.get_payer().insecure_clone(); - let mint_authority = payer.pubkey(); - - // Setup: Create compressed mint directly (not via wrapper program) - let (mint_pda, compression_address, _, _mint_seed) = - setup_create_compressed_mint(&mut rpc, &payer, mint_authority, 9, vec![]).await; - - let ctoken_account = Keypair::new(); - let owner = payer.pubkey(); - // Create a ctoken account to mint tokens to via wrapper program - { - let create_token_account_data = CreateTokenAccountData { - owner, - pre_pay_num_epochs: 2, - lamports_per_write: 1, - }; - let instruction_data = - [vec![2u8], create_token_account_data.try_to_vec().unwrap()].concat(); - - use light_token_sdk::token::{config_pda, rent_sponsor_pda}; - let config = config_pda(); - let rent_sponsor = rent_sponsor_pda(); - - let instruction = Instruction { - program_id: ID, - accounts: vec![ - AccountMeta::new(payer.pubkey(), true), - AccountMeta::new(ctoken_account.pubkey(), true), - AccountMeta::new_readonly(mint_pda, false), - AccountMeta::new_readonly(config, false), - AccountMeta::new_readonly(Pubkey::default(), false), // system_program - AccountMeta::new(rent_sponsor, false), - AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), // token_program - ], - data: instruction_data, - }; - - rpc.create_and_send_transaction( - &[instruction], - &payer.pubkey(), - &[&payer, &ctoken_account], - ) - .await - .unwrap(); - } - - // Get the compressed mint account to build CompressedMintWithContext - let compressed_mint_account = rpc - .get_compressed_account(compression_address, None) - .await - .unwrap() - .value - .expect("Compressed mint should exist"); - - // Deserialize the compressed mint data - use light_token_interface::state::CompressedMint; - let compressed_mint = - CompressedMint::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) - .unwrap(); - - let amount = 1_000_000_000u64; // 1 token with 9 decimals - - // Mint ctokens with test program. - { - // Get validity proof for the mint operation - let rpc_result = rpc - .get_validity_proof(vec![compressed_mint_account.hash], vec![], None) - .await - .unwrap() - .value; - - // Build CompressedMintWithContext from the compressed account - let compressed_mint_with_context = - light_token_interface::instructions::mint_action::CompressedMintWithContext { - address: compression_address, - leaf_index: compressed_mint_account.leaf_index, - prove_by_index: true, - root_index: rpc_result.accounts[0] - .root_index - .root_index() - .unwrap_or_default(), // Will be updated with validity proof - mint: Some(compressed_mint.try_into().unwrap()), - }; - // Build instruction data for wrapper program - let mint_to_data = MintToCTokenData { - compressed_mint_inputs: compressed_mint_with_context.clone(), - amount, - mint_authority, - proof: rpc_result.proof, - }; - let wrapper_instruction_data = [vec![1u8], mint_to_data.try_to_vec().unwrap()].concat(); - - // Build wrapper instruction with compressed token program as first account - let compressed_token_program_id = - Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); - - let mut wrapper_accounts = vec![AccountMeta::new_readonly( - compressed_token_program_id, - false, - )]; - let account_metas = MintActionMetaConfig::new( - payer.pubkey(), - mint_authority, - compressed_mint_account.tree_info.tree, - compressed_mint_account.tree_info.queue, - compressed_mint_account.tree_info.queue, - ) - .with_token_accounts(vec![ctoken_account.pubkey()]) - .to_account_metas(); - wrapper_accounts.extend(account_metas); - - let instruction = Instruction { - program_id: ID, - accounts: wrapper_accounts, - data: wrapper_instruction_data, - }; - - rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) - .await - .unwrap(); - } - - // Verify tokens were minted to the ctoken account - let ctoken_account_data = rpc - .get_account(ctoken_account.pubkey()) - .await - .unwrap() - .unwrap(); - - // Parse the account data to verify balance - use light_token_interface::state::Token; - let account_state = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); - assert_eq!(account_state.amount, amount, "Token amount should match"); - assert_eq!( - account_state.mint.to_bytes(), - mint_pda.to_bytes(), - "Mint should match" - ); - assert_eq!( - account_state.owner.to_bytes(), - owner.to_bytes(), - "Owner should match" - ); -} - -/// Test minting tokens with PDA mint authority using MintToCTokenCpi::invoke_signed() -/// -/// This test uses the wrapper program to: -/// 1. Create a compressed mint with PDA authority (discriminator 14 - CreateCmintWithPdaAuthority) -/// 2. Mint tokens using PDA authority (discriminator 13 - MintToCtokenInvokeSigned) -#[tokio::test] -async fn test_mint_to_ctoken_invoke_signed() { - let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( - false, - Some(vec![("native_ctoken_examples", ID)]), - )) - .await - .unwrap(); - - let payer = rpc.get_payer().insecure_clone(); - - // Derive both PDAs from our wrapper program - let (mint_signer_pda, _) = Pubkey::find_program_address(&[MINT_SIGNER_SEED], &ID); - let (mint_authority_pda, _) = Pubkey::find_program_address(&[MINT_AUTHORITY_SEED], &ID); - - let decimals = 9u8; - let address_tree = rpc.get_address_tree_v2(); - let output_queue = rpc.get_random_state_tree_info().unwrap().queue; - - // Derive compression address using the PDA mint_signer - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( - &mint_signer_pda, - &address_tree.tree, - ); - - let mint_pda = light_token_sdk::token::find_cmint_address(&mint_signer_pda).0; - - let rpc_result = rpc - .get_validity_proof( - vec![], - vec![light_client::indexer::AddressWithTree { - address: compression_address, - tree: address_tree.tree, - }], - None, - ) - .await - .unwrap() - .value; - - let compressed_token_program_id = - Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); - let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); - - // Step 1: Create compressed mint with PDA authority using wrapper program (discriminator 14) - { - let create_cmint_data = CreateCmintData { - decimals, - address_merkle_tree_root_index: rpc_result.addresses[0].root_index, - mint_authority: mint_authority_pda, // Will be overridden by the handler - proof: rpc_result.proof.0.unwrap(), - compression_address, - mint: mint_pda, - freeze_authority: None, - extensions: None, - }; - // Discriminator 14 = CreateCmintWithPdaAuthority - let wrapper_instruction_data = - [vec![14u8], create_cmint_data.try_to_vec().unwrap()].concat(); - - // Account order for CreateCmintWithPdaAuthority: - // [0] compressed_token_program, [1] light_system_program, [2] mint_signer (PDA), - // [3] authority (PDA), [4] fee_payer, [5] cpi_authority_pda, [6] registered_program_pda, - // [7] account_compression_authority, [8] account_compression_program, [9] system_program, - // [10] output_queue, [11] address_tree - let wrapper_accounts = vec![ - AccountMeta::new_readonly(compressed_token_program_id, false), - AccountMeta::new_readonly(default_pubkeys.light_system_program, false), - AccountMeta::new_readonly(mint_signer_pda, false), // PDA - program signs - AccountMeta::new(mint_authority_pda, false), // writable PDA - program signs - AccountMeta::new(payer.pubkey(), true), // fee_payer - AccountMeta::new_readonly(default_pubkeys.cpi_authority_pda, false), - AccountMeta::new_readonly(default_pubkeys.registered_program_pda, false), - AccountMeta::new_readonly(default_pubkeys.account_compression_authority, false), - AccountMeta::new_readonly(default_pubkeys.account_compression_program, false), - AccountMeta::new_readonly(default_pubkeys.system_program, false), - AccountMeta::new(output_queue, false), - AccountMeta::new(address_tree.tree, false), - ]; - - let create_mint_ix = Instruction { - program_id: ID, - accounts: wrapper_accounts, - data: wrapper_instruction_data, - }; - - rpc.create_and_send_transaction(&[create_mint_ix], &payer.pubkey(), &[&payer]) - .await - .unwrap(); - } - - let ctoken_account = Keypair::new(); - let owner = payer.pubkey(); - - // Create a ctoken account to mint tokens to via wrapper program - { - let create_token_account_data = CreateTokenAccountData { - owner, - pre_pay_num_epochs: 2, - lamports_per_write: 1, - }; - let instruction_data = - [vec![2u8], create_token_account_data.try_to_vec().unwrap()].concat(); - - use light_token_sdk::token::{config_pda, rent_sponsor_pda}; - let config = config_pda(); - let rent_sponsor = rent_sponsor_pda(); - - let instruction = Instruction { - program_id: ID, - accounts: vec![ - AccountMeta::new(payer.pubkey(), true), - AccountMeta::new(ctoken_account.pubkey(), true), - AccountMeta::new_readonly(mint_pda, false), - AccountMeta::new_readonly(config, false), - AccountMeta::new_readonly(Pubkey::default(), false), // system_program - AccountMeta::new(rent_sponsor, false), - AccountMeta::new_readonly(LIGHT_TOKEN_PROGRAM_ID, false), - ], - data: instruction_data, - }; - - rpc.create_and_send_transaction( - &[instruction], - &payer.pubkey(), - &[&payer, &ctoken_account], - ) - .await - .unwrap(); - } - - // Get the compressed mint account to build CompressedMintWithContext - let compressed_mint_account = rpc - .get_compressed_account(compression_address, None) - .await - .unwrap() - .value - .expect("Compressed mint should exist"); - - // Deserialize the compressed mint data - use light_token_interface::state::CompressedMint; - let compressed_mint = - CompressedMint::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) - .unwrap(); - - let amount = 1_000_000_000u64; // 1 token with 9 decimals - - // Mint ctokens with PDA authority via invoke_signed - { - // Get validity proof for the mint operation - let rpc_result = rpc - .get_validity_proof(vec![compressed_mint_account.hash], vec![], None) - .await - .unwrap() - .value; - - // Build CompressedMintWithContext from the compressed account - let compressed_mint_with_context = - light_token_interface::instructions::mint_action::CompressedMintWithContext { - address: compression_address, - leaf_index: compressed_mint_account.leaf_index, - prove_by_index: true, - root_index: rpc_result.accounts[0] - .root_index - .root_index() - .unwrap_or_default(), - mint: Some(compressed_mint.try_into().unwrap()), - }; - - // Build instruction data for wrapper program - let mint_to_data = MintToCTokenData { - compressed_mint_inputs: compressed_mint_with_context.clone(), - amount, - mint_authority: mint_authority_pda, - proof: rpc_result.proof, - }; - // Discriminator 13 = MintToCtokenInvokeSigned - let wrapper_instruction_data = [vec![13u8], mint_to_data.try_to_vec().unwrap()].concat(); - - // Build accounts manually since SDK marks authority as signer, but we need it as non-signer - // for invoke_signed (the wrapper program signs via CPI) - let compressed_token_program_id = - Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); - let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); - - let wrapper_accounts = vec![ - AccountMeta::new_readonly(compressed_token_program_id, false), - AccountMeta::new_readonly(default_pubkeys.light_system_program, false), - // authority NOT marked as signer - program will sign via invoke_signed - AccountMeta::new_readonly(mint_authority_pda, false), - AccountMeta::new(payer.pubkey(), true), - AccountMeta::new_readonly(default_pubkeys.cpi_authority_pda, false), - AccountMeta::new_readonly(default_pubkeys.registered_program_pda, false), - AccountMeta::new_readonly(default_pubkeys.account_compression_authority, false), - AccountMeta::new_readonly(default_pubkeys.account_compression_program, false), - AccountMeta::new_readonly(default_pubkeys.system_program, false), - AccountMeta::new(compressed_mint_account.tree_info.queue, false), // output_queue - AccountMeta::new(compressed_mint_account.tree_info.tree, false), // state_tree - AccountMeta::new(compressed_mint_account.tree_info.queue, false), // input_queue - AccountMeta::new(ctoken_account.pubkey(), false), // ctoken_account - ]; - let instruction = Instruction { - program_id: ID, - accounts: wrapper_accounts, - data: wrapper_instruction_data, - }; - - // Note: only payer signs, the mint_authority PDA is signed by the program via invoke_signed - rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) - .await - .unwrap(); - } - - // Verify tokens were minted to the ctoken account - let ctoken_account_data = rpc - .get_account(ctoken_account.pubkey()) - .await - .unwrap() - .unwrap(); - - // Parse the account data to verify balance - use light_token_interface::state::Token; - let account_state = Token::deserialize(&mut &ctoken_account_data.data[..]).unwrap(); - assert_eq!(account_state.amount, amount, "Token amount should match"); - assert_eq!( - account_state.mint.to_bytes(), - mint_pda.to_bytes(), - "Mint should match" - ); - assert_eq!( - account_state.owner.to_bytes(), - owner.to_bytes(), - "Owner should match" - ); -} diff --git a/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs index 757db21c45..5d8b722eb9 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs @@ -11,7 +11,7 @@ use light_test_utils::{ }; use light_token_interface::state::Token; use light_token_sdk::{ - ctoken::{derive_token_ata, CreateAssociatedCTokenAccount, TransferSplToToken}, + ctoken::{derive_token_ata, CreateAssociatedTokenAccount, TransferFromSpl}, spl_interface::{find_spl_interface_pda_with_index, CreateSplInterfacePda}, }; use native_ctoken_examples::{InstructionType, TransferCheckedData, ID}; @@ -99,10 +99,10 @@ async fn test_ctoken_transfer_checked_spl_mint() { let (source_ata, _) = derive_token_ata(&source_owner, &mint); let (dest_ata, _) = derive_token_ata(&dest_owner, &mint); - let create_source_ata = CreateAssociatedCTokenAccount::new(payer.pubkey(), source_owner, mint) + let create_source_ata = CreateAssociatedTokenAccount::new(payer.pubkey(), source_owner, mint) .instruction() .unwrap(); - let create_dest_ata = CreateAssociatedCTokenAccount::new(payer.pubkey(), dest_owner, mint) + let create_dest_ata = CreateAssociatedTokenAccount::new(payer.pubkey(), dest_owner, mint) .instruction() .unwrap(); @@ -117,7 +117,7 @@ async fn test_ctoken_transfer_checked_spl_mint() { // Transfer SPL tokens to source cToken ATA let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, false); - let transfer_to_ctoken = TransferSplToToken { + let transfer_to_ctoken = TransferFromSpl { amount: 1000, spl_interface_pda_bump, decimals, @@ -202,11 +202,11 @@ async fn test_ctoken_transfer_checked_t22_mint() { ..Default::default() }; - let create_source_ata = CreateAssociatedCTokenAccount::new(payer.pubkey(), source_owner, mint) + let create_source_ata = CreateAssociatedTokenAccount::new(payer.pubkey(), source_owner, mint) .with_compressible(compressible_params.clone()) .instruction() .unwrap(); - let create_dest_ata = CreateAssociatedCTokenAccount::new(payer.pubkey(), dest_owner, mint) + let create_dest_ata = CreateAssociatedTokenAccount::new(payer.pubkey(), dest_owner, mint) .with_compressible(compressible_params) .instruction() .unwrap(); @@ -222,7 +222,7 @@ async fn test_ctoken_transfer_checked_t22_mint() { // Transfer T22 tokens to source cToken ATA (use restricted=true for mints with restricted extensions) let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint, 0, true); - let transfer_to_ctoken = TransferSplToToken { + let transfer_to_ctoken = TransferFromSpl { amount: 1000, spl_interface_pda_bump, decimals, diff --git a/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs index 4c0861a9ea..1ba58b59c4 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs @@ -9,7 +9,7 @@ use light_test_utils::spl::{ create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, }; use light_token_sdk::{ - ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, + ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, spl_interface::find_spl_interface_pda_with_index, }; use light_token_types::CPI_AUTHORITY_PDA; @@ -68,7 +68,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke() { .await .unwrap(); - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .unwrap(); rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) @@ -161,7 +161,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke() { .unwrap(); // Create and fund CToken ATA - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) .instruction() .unwrap(); rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) @@ -297,7 +297,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { let transfer_amount = 5000u64; // Create sender CToken ATA - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), sender.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), sender.pubkey(), mint) .instruction() .unwrap(); rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) @@ -306,7 +306,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { let sender_ctoken = derive_token_ata(&sender.pubkey(), &mint).0; // Create recipient CToken ATA - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .unwrap(); rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) @@ -471,7 +471,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke_signed() { .await .unwrap(); - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .unwrap(); rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) @@ -569,7 +569,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { // Create CToken ATA owned by PDA let (ctoken_account, bump) = derive_token_ata(&authority_pda, &mint); - let instruction = CreateAssociatedCTokenAccount { + let instruction = CreateAssociatedTokenAccount { idempotent: false, bump, payer: payer.pubkey(), @@ -714,7 +714,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { // Create source CToken ATA owned by PDA let (source_ctoken, bump) = derive_token_ata(&authority_pda, &mint); - let instruction = CreateAssociatedCTokenAccount { + let instruction = CreateAssociatedTokenAccount { idempotent: false, bump, payer: payer.pubkey(), @@ -734,7 +734,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { light_test_utils::airdrop_lamports(&mut rpc, &recipient.pubkey(), 1_000_000_000) .await .unwrap(); - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .unwrap(); rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) diff --git a/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs index fa7f8e49d5..314eadd6fb 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs @@ -1,4 +1,4 @@ -// Tests for TransferSplToTokenCpi and TransferTokenToSplCpi +// Tests for TransferFromSplCpi and TransferTokenToSplCpi mod shared; @@ -9,12 +9,12 @@ use light_test_utils::spl::{ create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, }; use light_token_sdk::{ - ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, spl_interface::find_spl_interface_pda_with_index, + token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, }; use light_token_types::CPI_AUTHORITY_PDA; use native_ctoken_examples::{ - TransferSplToTokenData, TransferTokenToSplData, ID, TRANSFER_AUTHORITY_SEED, + TransferFromSplData, TransferTokenToSplData, ID, TRANSFER_AUTHORITY_SEED, }; use solana_sdk::{ instruction::{AccountMeta, Instruction}, @@ -23,7 +23,7 @@ use solana_sdk::{ signer::Signer, }; -/// Test transferring SPL tokens to CToken using TransferSplToTokenCpi::invoke() +/// Test transferring SPL tokens to CToken using TransferFromSplCpi::invoke() #[tokio::test] async fn test_spl_to_ctoken_invoke() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -67,7 +67,7 @@ async fn test_spl_to_ctoken_invoke() { .await .unwrap(); - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .unwrap(); rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) @@ -95,7 +95,7 @@ async fn test_spl_to_ctoken_invoke() { let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Build wrapper instruction for SPL to CToken transfer - let data = TransferSplToTokenData { + let data = TransferFromSplData { amount: transfer_amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, @@ -189,7 +189,7 @@ async fn test_ctoken_to_spl_invoke() { .unwrap(); // Create ctoken ATA and fund it via SPL transfer first - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) .instruction() .unwrap(); rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) @@ -222,7 +222,7 @@ async fn test_ctoken_to_spl_invoke() { let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); { - let data = TransferSplToTokenData { + let data = TransferFromSplData { amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, @@ -379,7 +379,7 @@ async fn test_spl_to_ctoken_invoke_signed() { .await .unwrap(); - let instruction = CreateAssociatedCTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) + let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .unwrap(); rpc.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer]) @@ -395,7 +395,7 @@ async fn test_spl_to_ctoken_invoke_signed() { let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); // Build wrapper instruction for SPL to CToken transfer with PDA authority - let data = TransferSplToTokenData { + let data = TransferFromSplData { amount: transfer_amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, @@ -485,7 +485,7 @@ async fn test_ctoken_to_spl_invoke_signed() { // Create ctoken ATA owned by the PDA let (ctoken_account, bump) = derive_token_ata(&authority_pda, &mint); - let instruction = CreateAssociatedCTokenAccount { + let instruction = CreateAssociatedTokenAccount { idempotent: false, bump, payer: payer.pubkey(), @@ -535,7 +535,7 @@ async fn test_ctoken_to_spl_invoke_signed() { let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); { - let data = TransferSplToTokenData { + let data = TransferFromSplData { amount, spl_interface_pda_bump, decimals: CREATE_MINT_HELPER_DECIMALS, diff --git a/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs b/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs index bd6214f176..6c64fbe75b 100644 --- a/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs +++ b/sdk-tests/sdk-token-test/src/process_compress_full_and_close.rs @@ -8,7 +8,7 @@ use light_token_sdk::{ }, CTokenAccount2, }, - ctoken::CloseCTokenAccount, + token::CloseAccount, }; use crate::Generic; @@ -93,7 +93,7 @@ pub fn process_compress_full_and_close<'info>( let compressed_token_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); // Create close instruction with rent_sponsor for compressible accounts - let close_instruction = CloseCTokenAccount::new( + let close_instruction = CloseAccount::new( compressed_token_program_id, *token_account_info.key, *close_recipient_info.key, diff --git a/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs b/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs index b1c5118292..2b9d7898f2 100644 --- a/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs +++ b/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs @@ -55,7 +55,7 @@ async fn setup_decompress_full_test(num_inputs: usize) -> (LightProgramTest, Tes .unwrap(); use light_token_sdk::token::{ - derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount, + derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount, }; let mut destination_accounts = Vec::with_capacity(num_inputs); @@ -87,7 +87,7 @@ async fn setup_decompress_full_test(num_inputs: usize) -> (LightProgramTest, Tes }; let create_token_account_ix = - CreateAssociatedCTokenAccount::new(payer.pubkey(), destination_owner, mint_pubkey) + CreateAssociatedTokenAccount::new(payer.pubkey(), destination_owner, mint_pubkey) .with_compressible(compressible_params) .instruction() .unwrap(); diff --git a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs index da1fa4e000..97cf65c8e3 100644 --- a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs +++ b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs @@ -18,7 +18,7 @@ use light_token_sdk::{ compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }, - ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedCTokenAccount}, + token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, }; use light_token_types::CPI_AUTHORITY_PDA; use sdk_token_test::{ChainedCtokenInstructionData, PdaCreationData, ID}; @@ -217,7 +217,7 @@ pub async fn create_mint( }; let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), mint_authority.pubkey(), mint) + CreateAssociatedTokenAccount::new(payer.pubkey(), mint_authority.pubkey(), mint) .with_compressible(compressible_params) .instruction() .unwrap(); diff --git a/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs b/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs index e7ffa520af..bfd8f57ecb 100644 --- a/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs +++ b/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs @@ -18,7 +18,7 @@ use light_token_sdk::{ create_compressed_mint::{create_compressed_mint, CreateCompressedMintInputs}, mint_to_compressed::{create_mint_to_compressed_instruction, MintToCompressedInputs}, }, - ctoken::CreateAssociatedCTokenAccount, + token::CreateAssociatedTokenAccount, utils::CTokenDefaultAccounts, }; use solana_sdk::{ @@ -97,7 +97,7 @@ async fn create_compressed_mints_and_tokens( let (token_account1_pubkey, _bump) = light_token_sdk::token::derive_token_ata(&payer.pubkey(), &mint1_pda); let create_ata_instruction = - CreateAssociatedCTokenAccount::new(payer.pubkey(), payer.pubkey(), mint1_pda) + CreateAssociatedTokenAccount::new(payer.pubkey(), payer.pubkey(), mint1_pda) .instruction() .unwrap(); rpc.create_and_send_transaction(&[create_ata_instruction], &payer.pubkey(), &[payer]) diff --git a/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs b/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs index 5f49ebd3be..96e08b9395 100644 --- a/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs +++ b/sdk-tests/sdk-token-test/tests/test_compress_full_and_close.rs @@ -17,9 +17,9 @@ use light_token_sdk::{ create_compressed_mint::{create_compressed_mint, CreateCompressedMintInputs}, mint_to_compressed::{create_mint_to_compressed_instruction, MintToCompressedInputs}, }, - ctoken::{ + token::{ config_pda, derive_token_ata, rent_sponsor_pda, CompressibleParams, - CreateAssociatedCTokenAccount, + CreateAssociatedTokenAccount, }, }; use sdk_token_test::instruction; @@ -189,7 +189,7 @@ async fn test_compress_full_and_close() { rent_sponsor: rent_sponsor_pda(), compression_only: true, }; - let create_ata_instruction = CreateAssociatedCTokenAccount::new_with_bump( + let create_ata_instruction = CreateAssociatedTokenAccount::new_with_bump( payer.pubkey(), recipient, mint_pda, From 36603bb7edc2b30b0c6984e1b013c5be411ae74d Mon Sep 17 00:00:00 2001 From: ananas Date: Tue, 13 Jan 2026 02:24:17 +0000 Subject: [PATCH 7/9] chore: rename mint_to_token to mint_to and remove Token suffix from functions --- .../src/instructions/mint_action/builder.rs | 6 +- .../mint_action/instruction_data.rs | 8 +- .../{mint_to_token.rs => mint_to.rs} | 2 +- .../src/instructions/mint_action/mod.rs | 4 +- .../tests/compress_only/all.rs | 2 +- .../compress_only/decompress_restrictions.rs | 2 +- .../compress_only/invalid_destination.rs | 2 +- .../compress_only/invalid_extension_state.rs | 2 +- .../tests/compress_only/mod.rs | 2 +- .../tests/compress_only/withheld_fee.rs | 2 +- .../tests/ctoken/extensions_failing.rs | 2 +- .../tests/ctoken/transfer_checked.rs | 5 +- .../tests/freeze/compress_only.rs | 2 +- .../tests/mint/cpi_context.rs | 4 +- .../tests/mint/failing.rs | 4 +- .../tests/transfer2/compress_failing.rs | 4 +- .../tests/transfer2/decompress_failing.rs | 2 +- .../no_system_program_cpi_failing.rs | 57 +++--- .../tests/transfer2/spl_ctoken.rs | 2 +- .../registry-test/tests/compressible.rs | 12 +- .../compressed_token/mint_action/accounts.rs | 2 +- .../mint_action/actions/mint_to_ctoken.rs | 4 +- .../mint_action/actions/process_actions.rs | 2 +- .../program/tests/mint_action.rs | 12 +- .../src/actions/transfer2/ctoken_to_spl.rs | 3 +- .../src/actions/transfer2/spl_to_ctoken.rs | 3 +- .../src/instructions/mint_action.rs | 6 +- .../src/instructions/transfer2.rs | 4 +- .../src/compressed_token/v2/account2.rs | 10 +- .../compressed_token/v2/decompress_full.rs | 2 +- sdk-libs/token-sdk/src/token/decompress.rs | 2 +- sdk-libs/token-sdk/src/token/mint_to.rs | 2 +- .../src/token/transfer_spl_to_token.rs | 2 +- .../src/token/transfer_token_to_spl.rs | 2 +- .../tests/multi_account_tests.rs | 10 +- .../src/ctoken_mint_to.rs | 2 +- .../src/decompress_cmint.rs | 2 +- .../tests/scenario_cmint_compression_only.rs | 4 +- .../tests/scenario_spl.rs | 9 +- .../sdk-light-token-test/tests/shared.rs | 175 ++++++++++-------- .../tests/test_transfer_checked.rs | 2 +- .../tests/test_transfer_interface.rs | 2 +- .../sdk-token-test/src/pda_ctoken/mint.rs | 4 +- .../src/process_four_transfer2.rs | 2 +- 44 files changed, 199 insertions(+), 195 deletions(-) rename program-libs/token-interface/src/instructions/mint_action/{mint_to_token.rs => mint_to.rs} (90%) diff --git a/program-libs/token-interface/src/instructions/mint_action/builder.rs b/program-libs/token-interface/src/instructions/mint_action/builder.rs index 67aa716dc1..99e2f77133 100644 --- a/program-libs/token-interface/src/instructions/mint_action/builder.rs +++ b/program-libs/token-interface/src/instructions/mint_action/builder.rs @@ -6,7 +6,7 @@ use light_compressed_account::instruction_data::{ use crate::instructions::mint_action::{ Action, CompressAndCloseCMintAction, CompressedMintInstructionData, CompressedMintWithContext, CpiContext, CreateMint, DecompressMintAction, MintActionCompressedInstructionData, - MintToCompressedAction, MintToTokenAction, RemoveMetadataKeyAction, UpdateAuthority, + MintToAction, MintToCompressedAction, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }; @@ -85,8 +85,8 @@ impl MintActionCompressedInstructionData { } #[must_use = "with_mint_to returns a new value"] - pub fn with_mint_to(mut self, action: MintToTokenAction) -> Self { - self.actions.push(Action::MintToToken(action)); + pub fn with_mint_to(mut self, action: MintToAction) -> Self { + self.actions.push(Action::MintTo(action)); self } diff --git a/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs b/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs index 11105b9be5..8cb4b90da8 100644 --- a/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs +++ b/program-libs/token-interface/src/instructions/mint_action/instruction_data.rs @@ -3,9 +3,9 @@ use light_compressible::compression_info::CompressionInfo; use light_zero_copy::ZeroCopy; use super::{ - CompressAndCloseCMintAction, CpiContext, DecompressMintAction, MintToCompressedAction, - MintToTokenAction, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, - UpdateMetadataFieldAction, + CompressAndCloseCMintAction, CpiContext, DecompressMintAction, MintToAction, + MintToCompressedAction, RemoveMetadataKeyAction, UpdateAuthority, + UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }; use crate::{ instructions::extensions::{ExtensionInstructionData, ZExtensionInstructionData}, @@ -27,7 +27,7 @@ pub enum Action { UpdateFreezeAuthority(UpdateAuthority), /// Mint tokens from a compressed mint to a token solana account /// (tokens are not compressed but not spl tokens). - MintToToken(MintToTokenAction), + MintTo(MintToAction), UpdateMetadataField(UpdateMetadataFieldAction), UpdateMetadataAuthority(UpdateMetadataAuthorityAction), RemoveMetadataKey(RemoveMetadataKeyAction), diff --git a/program-libs/token-interface/src/instructions/mint_action/mint_to_token.rs b/program-libs/token-interface/src/instructions/mint_action/mint_to.rs similarity index 90% rename from program-libs/token-interface/src/instructions/mint_action/mint_to_token.rs rename to program-libs/token-interface/src/instructions/mint_action/mint_to.rs index 10928f8641..26422776c3 100644 --- a/program-libs/token-interface/src/instructions/mint_action/mint_to_token.rs +++ b/program-libs/token-interface/src/instructions/mint_action/mint_to.rs @@ -4,7 +4,7 @@ use crate::{AnchorDeserialize, AnchorSerialize}; #[repr(C)] #[derive(Debug, Clone, Copy, AnchorSerialize, AnchorDeserialize, ZeroCopy)] -pub struct MintToTokenAction { +pub struct MintToAction { pub account_index: u8, // Index into remaining accounts for the recipient token account pub amount: u64, } diff --git a/program-libs/token-interface/src/instructions/mint_action/mod.rs b/program-libs/token-interface/src/instructions/mint_action/mod.rs index 791c74c997..27585fd79d 100644 --- a/program-libs/token-interface/src/instructions/mint_action/mod.rs +++ b/program-libs/token-interface/src/instructions/mint_action/mod.rs @@ -3,8 +3,8 @@ mod compress_and_close_cmint; mod cpi_context; mod decompress_mint; mod instruction_data; +mod mint_to; mod mint_to_compressed; -mod mint_to_token; mod update_metadata; mod update_mint; @@ -12,7 +12,7 @@ pub use compress_and_close_cmint::*; pub use cpi_context::*; pub use decompress_mint::*; pub use instruction_data::*; +pub use mint_to::*; pub use mint_to_compressed::*; -pub use mint_to_token::*; pub use update_metadata::*; pub use update_mint::*; diff --git a/program-tests/compressed-token-test/tests/compress_only/all.rs b/program-tests/compressed-token-test/tests/compress_only/all.rs index 8b5720f3ac..34d7071f7c 100644 --- a/program-tests/compressed-token-test/tests/compress_only/all.rs +++ b/program-tests/compressed-token-test/tests/compress_only/all.rs @@ -31,8 +31,8 @@ async fn test_compress_and_close_ctoken_with_extensions() { state::TokenDataVersion, }; use light_token_sdk::{ - token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, }; let mut context = setup_extensions_test(ALL_EXTENSIONS).await.unwrap(); diff --git a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs index 919b71dd4f..30325634f0 100644 --- a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs +++ b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs @@ -22,8 +22,8 @@ use light_token_interface::{ state::TokenDataVersion, }; use light_token_sdk::{ - token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, }; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs index a70723b939..9c1cadf328 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs @@ -25,8 +25,8 @@ use light_token_interface::{ state::TokenDataVersion, }; use light_token_sdk::{ - token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, }; use serial_test::serial; use solana_sdk::{program_pack::Pack, pubkey::Pubkey, signature::Keypair, signer::Signer}; diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs index 2282960e1f..d95bc53a7c 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs @@ -27,8 +27,8 @@ use light_token_interface::{ }; use light_token_sdk::{ constants::CPI_AUTHORITY_PDA, - token::{CompressibleParams, CreateTokenAccount, TransferFromSpl, TransferToSpl}, spl_interface::find_spl_interface_pda_with_index as sdk_find_spl_interface_pda, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl, TransferToSpl}, }; use serial_test::serial; use solana_sdk::{instruction::Instruction, pubkey::Pubkey, signature::Keypair, signer::Signer}; diff --git a/program-tests/compressed-token-test/tests/compress_only/mod.rs b/program-tests/compressed-token-test/tests/compress_only/mod.rs index 664cd42c14..9b9f69bbc3 100644 --- a/program-tests/compressed-token-test/tests/compress_only/mod.rs +++ b/program-tests/compressed-token-test/tests/compress_only/mod.rs @@ -166,8 +166,8 @@ pub async fn run_compress_and_close_extension_test( }, }; use light_token_sdk::{ - token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, }; let mut context = setup_extensions_test(config.extensions).await?; diff --git a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs index 73281ddb80..21b4f005d6 100644 --- a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs +++ b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs @@ -21,8 +21,8 @@ use light_token_interface::{ }, }; use light_token_sdk::{ - token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, }; use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; diff --git a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs b/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs index 033d1c3c50..2a51416573 100644 --- a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs +++ b/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs @@ -19,7 +19,7 @@ use light_test_utils::{ use light_token_interface::state::TokenDataVersion; use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, - token::{CompressibleParams, CreateTokenAccount, TransferFromSpl, TransferChecked}, + token::{CompressibleParams, CreateTokenAccount, TransferChecked, TransferFromSpl}, }; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; diff --git a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs b/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs index 4614cc1c1f..a2c069af23 100644 --- a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs +++ b/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs @@ -13,10 +13,7 @@ use light_test_utils::{ use light_token_interface::state::TokenDataVersion; use light_token_sdk::{ spl_interface::find_spl_interface_pda_with_index, - token::{ - CompressibleParams, CreateTokenAccount, TransferFromSpl, Transfer, - TransferChecked, - }, + token::{CompressibleParams, CreateTokenAccount, Transfer, TransferChecked, TransferFromSpl}, }; use serial_test::serial; use solana_sdk::{native_token::LAMPORTS_PER_SOL, signature::Keypair, signer::Signer}; diff --git a/program-tests/compressed-token-test/tests/freeze/compress_only.rs b/program-tests/compressed-token-test/tests/freeze/compress_only.rs index 8f26062d44..e7085f9efb 100644 --- a/program-tests/compressed-token-test/tests/freeze/compress_only.rs +++ b/program-tests/compressed-token-test/tests/freeze/compress_only.rs @@ -25,8 +25,8 @@ use light_token_interface::{ }; use light_token_sdk::{ compat::{AccountState, TokenDataWithMerkleContext}, - token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, spl_interface::find_spl_interface_pda_with_index, + token::{CompressibleParams, CreateTokenAccount, TransferFromSpl}, }; use serial_test::serial; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; diff --git a/program-tests/compressed-token-test/tests/mint/cpi_context.rs b/program-tests/compressed-token-test/tests/mint/cpi_context.rs index 53dafe0510..20f15748b4 100644 --- a/program-tests/compressed-token-test/tests/mint/cpi_context.rs +++ b/program-tests/compressed-token-test/tests/mint/cpi_context.rs @@ -7,7 +7,7 @@ use light_test_utils::Rpc; use light_token_interface::{ instructions::mint_action::{ CompressedMintInstructionData, CompressedMintWithContext, CpiContext, DecompressMintAction, - MintActionCompressedInstructionData, MintToTokenAction, + MintActionCompressedInstructionData, MintToAction, }, state::CompressedMintMetadata, CMINT_ADDRESS_TREE, LIGHT_TOKEN_PROGRAM_ID, @@ -617,7 +617,7 @@ async fn test_write_to_cpi_context_mint_to_ctoken_fails() { CompressedProof::default(), compressed_mint_inputs.mint.clone().unwrap(), ) - .with_mint_to_token(MintToTokenAction { + .with_mint_to(MintToAction { account_index: 0, amount: 1000, }) diff --git a/program-tests/compressed-token-test/tests/mint/failing.rs b/program-tests/compressed-token-test/tests/mint/failing.rs index 42f781fa1c..0f3e505ed0 100644 --- a/program-tests/compressed-token-test/tests/mint/failing.rs +++ b/program-tests/compressed-token-test/tests/mint/failing.rs @@ -815,7 +815,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { use light_compressed_account::instruction_data::traits::LightInstructionData; use light_token_interface::{ instructions::mint_action::{ - CompressedMintWithContext, MintActionCompressedInstructionData, MintToTokenAction, + CompressedMintWithContext, MintActionCompressedInstructionData, MintToAction, }, state::TokenDataVersion, LIGHT_TOKEN_PROGRAM_ID, @@ -921,7 +921,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { // Build instruction data with max_top_up = 1 (too low to cover rent top-up) let instruction_data = MintActionCompressedInstructionData::new(compressed_mint_inputs, rpc_proof_result.proof.0) - .with_mint_to_token(MintToTokenAction { + .with_mint_to(MintToAction { account_index: 0, amount: 1000u64, }) diff --git a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs index 8ef5809a95..c7536e8abc 100644 --- a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs @@ -223,7 +223,7 @@ fn create_compression_inputs( // Compress tokens from CToken ATA compression_account - .compress_token(compress_amount, ctoken_ata_index, authority_index) + .compress(compress_amount, ctoken_ata_index, authority_index) .map_err(|e| RpcError::AssertRpcError(format!("Failed to compress: {:?}", e)))?; // Get account metas from PackedAccounts @@ -672,7 +672,7 @@ async fn test_compression_max_top_up_exceeded() -> Result<(), RpcError> { let mut compression_account = CTokenAccount2::new_empty(recipient_index, mint_index); compression_account - .compress_token(token_amount, ctoken_ata_index, authority_index) + .compress(token_amount, ctoken_ata_index, authority_index) .map_err(|e| RpcError::AssertRpcError(format!("Failed to compress: {:?}", e)))?; let (account_metas, _, _) = packed_accounts.to_account_metas(); diff --git a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs index 785382ca1b..87b6744f26 100644 --- a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs @@ -253,7 +253,7 @@ async fn create_decompression_inputs( // Add decompression token_account - .decompress_token(decompress_amount, ctoken_ata_index) + .decompress(decompress_amount, ctoken_ata_index) .map_err(|e| RpcError::AssertRpcError(format!("Failed to decompress: {:?}", e)))?; // Get account metas diff --git a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs index 41cd0d90b7..0fc8d48448 100644 --- a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs @@ -196,7 +196,7 @@ fn create_compressions_and_packed_accounts( // Create compressions let mut compressions = Vec::new(); if compress_amount > 0 { - compressions.push(Compression::compress_token( + compressions.push(Compression::compress( compress_amount, mint_index, source_ata_index, @@ -204,7 +204,7 @@ fn create_compressions_and_packed_accounts( )); } if decompress_amount > 0 { - compressions.push(Compression::decompress_token( + compressions.push(Compression::decompress( decompress_amount, mint_index, recipient_ata_index, @@ -533,8 +533,8 @@ async fn test_invalid_authority_compress() { let recipient_ata_index = packed_accounts.insert_or_get_config(recipient_ata, false, true); let compressions = vec![ - Compression::compress_token(500, mint_index, source_ata_index, wrong_authority_index), - Compression::decompress_token(500, mint_index, recipient_ata_index), + Compression::compress(500, mint_index, source_ata_index, wrong_authority_index), + Compression::decompress(500, mint_index, recipient_ata_index), ]; let (account_metas, _, _) = packed_accounts.to_account_metas(); @@ -574,8 +574,8 @@ async fn test_authority_not_signer_compress() { let recipient_ata_index = packed_accounts.insert_or_get_config(recipient_ata, false, true); let compressions = vec![ - Compression::compress_token(500, mint_index, source_ata_index, owner_index), - Compression::decompress_token(500, mint_index, recipient_ata_index), + Compression::compress(500, mint_index, source_ata_index, owner_index), + Compression::decompress(500, mint_index, recipient_ata_index), ]; let (account_metas, _, _) = packed_accounts.to_account_metas(); @@ -651,11 +651,10 @@ async fn test_decompress_with_nonzero_authority() { // Create compress with valid authority using helper let compress_compression = - Compression::compress_token(500, mint_index, source_ata_index, owner_index); + Compression::compress(500, mint_index, source_ata_index, owner_index); // Create decompress but manually set authority to non-zero (should be 0) - let mut decompress_compression = - Compression::decompress_token(500, mint_index, recipient_ata_index); + let mut decompress_compression = Compression::decompress(500, mint_index, recipient_ata_index); decompress_compression.authority = owner_index; // Invalid: should be 0 for decompress let compressions = vec![compress_compression, decompress_compression]; @@ -776,17 +775,13 @@ async fn test_too_many_mints() { let source_index = packed_accounts.insert_or_get_config(context.source_ata, false, true); let recipient_index = packed_accounts.insert_or_get_config(context.recipient_ata, false, true); - compressions.push(Compression::compress_token( + compressions.push(Compression::compress( 100, mint_index, source_index, owner_index, )); - compressions.push(Compression::decompress_token( - 100, - mint_index, - recipient_index, - )); + compressions.push(Compression::decompress(100, mint_index, recipient_index)); // Add compressions for the 5 additional mints for (mint, source_ata, recipient_ata) in &mints_with_atas { @@ -794,17 +789,13 @@ async fn test_too_many_mints() { let source_index = packed_accounts.insert_or_get_config(*source_ata, false, true); let recipient_index = packed_accounts.insert_or_get_config(*recipient_ata, false, true); - compressions.push(Compression::compress_token( + compressions.push(Compression::compress( 100, mint_index, source_index, owner_index, )); - compressions.push(Compression::decompress_token( - 100, - mint_index, - recipient_index, - )); + compressions.push(Compression::decompress(100, mint_index, recipient_index)); } let (account_metas, _, _) = packed_accounts.to_account_metas(); @@ -854,23 +845,19 @@ async fn test_duplicate_mint_validation() { // Create compression and decompress for first mint index (balanced) let mut compressions = vec![ - Compression::compress_token(500, mint_index_1, source_index, owner_index), - Compression::decompress_token(500, mint_index_1, recipient_index), + Compression::compress(500, mint_index_1, source_index, owner_index), + Compression::decompress(500, mint_index_1, recipient_index), ]; // Create compression and decompress for second mint index (balanced) // This is the duplicate - same pubkey as mint_index_1 but different index - compressions.push(Compression::compress_token( + compressions.push(Compression::compress( 1, mint_index_2, source_index, owner_index, )); - compressions.push(Compression::decompress_token( - 1, - mint_index_2, - recipient_index, - )); + compressions.push(Compression::decompress(1, mint_index_2, recipient_index)); // Build instruction let instruction = build_compressions_only_instruction( @@ -913,8 +900,8 @@ async fn test_mint_index_out_of_bounds() { let invalid_mint_index = 99u8; let compressions = vec![ - Compression::compress_token(500, invalid_mint_index, source_index, owner_index), - Compression::decompress_token(500, invalid_mint_index, recipient_index), + Compression::compress(500, invalid_mint_index, source_index, owner_index), + Compression::decompress(500, invalid_mint_index, recipient_index), ]; // Build instruction @@ -957,8 +944,8 @@ async fn test_account_index_out_of_bounds() { let invalid_account_index = 99u8; let compressions = vec![ - Compression::compress_token(500, mint_index, invalid_account_index, owner_index), - Compression::decompress_token(500, mint_index, invalid_account_index), + Compression::compress(500, mint_index, invalid_account_index, owner_index), + Compression::decompress(500, mint_index, invalid_account_index), ]; // Build instruction @@ -1003,8 +990,8 @@ async fn test_authority_index_out_of_bounds() { let invalid_authority_index = 99u8; let compressions = vec![ - Compression::compress_token(500, mint_index, source_index, invalid_authority_index), - Compression::decompress_token(500, mint_index, recipient_index), + Compression::compress(500, mint_index, source_index, invalid_authority_index), + Compression::decompress(500, mint_index, recipient_index), ]; // Build instruction diff --git a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs index f71e47a968..9778dcad48 100644 --- a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs +++ b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs @@ -356,7 +356,7 @@ impl CtokenToSplTransferAndClose { let compress_to_pool = CTokenAccount2 { inputs: vec![], output: MultiTokenTransferOutputData::default(), - compression: Some(Compression::compress_and_close_token( + compression: Some(Compression::compress_and_close( self.amount, 0, // mint index 1, // source ctoken account index diff --git a/program-tests/registry-test/tests/compressible.rs b/program-tests/registry-test/tests/compressible.rs index cb4aafe6ca..7799d328a9 100644 --- a/program-tests/registry-test/tests/compressible.rs +++ b/program-tests/registry-test/tests/compressible.rs @@ -36,7 +36,7 @@ use light_token_client::{ }; use light_token_sdk::{ compressed_token::create_compressed_mint::find_cmint_address, - token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount, TokenMintTo}, + token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount, MintTo}, }; use solana_sdk::{ instruction::Instruction, @@ -1232,7 +1232,7 @@ async fn assert_not_compressible_cmint( Ok(()) } -/// Helper function to mint tokens to a CToken account using TokenMintTo instruction +/// Helper function to mint tokens to a CToken account using MintTo instruction async fn mint_to_token( rpc: &mut R, cmint: Pubkey, @@ -1241,7 +1241,7 @@ async fn mint_to_token( mint_authority: &Keypair, payer: &Keypair, ) -> Result { - let ix = TokenMintTo { + let ix = MintTo { cmint, destination, amount, @@ -1249,9 +1249,7 @@ async fn mint_to_token( max_top_up: None, } .instruction() - .map_err(|e| { - RpcError::CustomError(format!("Failed to create TokenMintTo instruction: {:?}", e)) - })?; + .map_err(|e| RpcError::CustomError(format!("Failed to create MintTo instruction: {:?}", e)))?; rpc.create_and_send_transaction(&[ix], &payer.pubkey(), &[payer, mint_authority]) .await @@ -1346,7 +1344,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { .await .unwrap(); - // Mint initial tokens to Account A via TokenMintTo (this also writes to the CMint, triggering top-up) + // Mint initial tokens to Account A via MintTo (this also writes to the CMint, triggering top-up) let transfer_amount = 1_000_000u64; mint_to_token( &mut rpc, diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs b/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs index 2f33cafb16..c7acefa99b 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/accounts.rs @@ -457,7 +457,7 @@ impl AccountsConfig { let has_mint_to_ctoken_actions = parsed_instruction_data .actions .iter() - .any(|action| matches!(action, ZAction::MintToToken(_))); + .any(|action| matches!(action, ZAction::MintTo(_))); if has_mint_to_ctoken_actions { msg!("Mint to ctokens not allowed when writing to cpi context"); return Err(ErrorCode::CpiContextSetNotUsable.into()); diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs index 475ed4cf1d..60cc19acae 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/mint_to_ctoken.rs @@ -3,7 +3,7 @@ use anchor_lang::solana_program::program_error::ProgramError; use light_account_checks::packed_accounts::ProgramPackedAccounts; use light_compressed_account::Pubkey; use light_program_profiler::profile; -use light_token_interface::{instructions::mint_action::ZMintToTokenAction, state::CompressedMint}; +use light_token_interface::{instructions::mint_action::ZMintToAction, state::CompressedMint}; use pinocchio::account_info::AccountInfo; use crate::compressed_token::{ @@ -14,7 +14,7 @@ use crate::compressed_token::{ #[allow(clippy::too_many_arguments)] #[profile] pub fn process_mint_to_ctoken_action( - action: &ZMintToTokenAction, + action: &ZMintToAction, compressed_mint: &mut CompressedMint, validated_accounts: &MintActionAccounts, packed_accounts: &ProgramPackedAccounts<'_, AccountInfo>, diff --git a/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs b/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs index b245286df7..0134cf9cc1 100644 --- a/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs +++ b/programs/compressed-token/program/src/compressed_token/mint_action/actions/process_actions.rs @@ -86,7 +86,7 @@ pub fn process_actions<'a>( compressed_mint.base.freeze_authority = update_action.new_authority.as_ref().map(|a| **a); } - ZAction::MintToToken(mint_to_ctoken_action) => { + ZAction::MintTo(mint_to_ctoken_action) => { let account_index = mint_to_ctoken_action.account_index as usize; if account_index >= MAX_PACKED_ACCOUNTS { msg!( diff --git a/programs/compressed-token/program/tests/mint_action.rs b/programs/compressed-token/program/tests/mint_action.rs index 7a06a297cd..d8ec62a28b 100644 --- a/programs/compressed-token/program/tests/mint_action.rs +++ b/programs/compressed-token/program/tests/mint_action.rs @@ -10,8 +10,8 @@ use light_token_interface::{ extensions::{token_metadata::TokenMetadataInstructionData, ExtensionInstructionData}, mint_action::{ Action, CompressedMintInstructionData, CpiContext, CreateMint, - MintActionCompressedInstructionData, MintToCompressedAction, MintToTokenAction, - Recipient, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, + MintActionCompressedInstructionData, MintToAction, MintToCompressedAction, Recipient, + RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }, }, @@ -71,8 +71,8 @@ fn random_mint_to_action(rng: &mut StdRng) -> MintToCompressedAction { } } -fn random_mint_to_decompressed_action(rng: &mut StdRng) -> MintToTokenAction { - MintToTokenAction { +fn random_mint_to_decompressed_action(rng: &mut StdRng) -> MintToAction { + MintToAction { amount: rng.gen_range(1..=1_000_000), account_index: rng.gen_range(1..=255), } @@ -113,7 +113,7 @@ fn random_action(rng: &mut StdRng) -> Action { 0 => Action::MintToCompressed(random_mint_to_action(rng)), 1 => Action::UpdateMintAuthority(random_update_authority_action(rng)), 2 => Action::UpdateFreezeAuthority(random_update_authority_action(rng)), - 3 => Action::MintToToken(random_mint_to_decompressed_action(rng)), + 3 => Action::MintTo(random_mint_to_decompressed_action(rng)), 4 => Action::UpdateMetadataField(random_update_metadata_field_action(rng)), 5 => Action::UpdateMetadataAuthority(random_update_metadata_authority_action(rng)), 6 => Action::RemoveMetadataKey(random_remove_metadata_key_action(rng)), @@ -328,7 +328,7 @@ fn check_if_config_should_error(instruction_data: &MintActionCompressedInstructi let has_mint_to_ctoken = instruction_data .actions .iter() - .any(|action| matches!(action, Action::MintToToken(_))); + .any(|action| matches!(action, Action::MintTo(_))); // Check for MintToCompressed actions let require_token_output_queue = instruction_data diff --git a/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs b/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs index 72965f53b9..138298ae6d 100644 --- a/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs +++ b/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs @@ -3,8 +3,7 @@ use light_client::{ rpc::{Rpc, RpcError}, }; use light_token_sdk::{ - constants::SPL_TOKEN_PROGRAM_ID, token::TransferToSpl, - spl_interface::find_spl_interface_pda, + constants::SPL_TOKEN_PROGRAM_ID, spl_interface::find_spl_interface_pda, token::TransferToSpl, }; use solana_keypair::Keypair; use solana_pubkey::Pubkey; diff --git a/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs b/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs index b1333668ad..458ce13c9f 100644 --- a/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs +++ b/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs @@ -3,8 +3,7 @@ use light_client::{ rpc::{Rpc, RpcError}, }; use light_token_sdk::{ - constants::SPL_TOKEN_PROGRAM_ID, token::TransferFromSpl, - spl_interface::find_spl_interface_pda, + constants::SPL_TOKEN_PROGRAM_ID, spl_interface::find_spl_interface_pda, token::TransferFromSpl, }; use solana_keypair::Keypair; use solana_pubkey::Pubkey; diff --git a/sdk-libs/token-client/src/instructions/mint_action.rs b/sdk-libs/token-client/src/instructions/mint_action.rs index 2a887aa693..f2b210295f 100644 --- a/sdk-libs/token-client/src/instructions/mint_action.rs +++ b/sdk-libs/token-client/src/instructions/mint_action.rs @@ -10,8 +10,8 @@ use light_token_interface::{ extensions::{token_metadata::TokenMetadataInstructionData, ExtensionInstructionData}, mint_action::{ CompressAndCloseCMintAction, CompressedMintWithContext, DecompressMintAction, - MintActionCompressedInstructionData, MintToCompressedAction, MintToTokenAction, - Recipient, RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, + MintActionCompressedInstructionData, MintToAction, MintToCompressedAction, Recipient, + RemoveMetadataKeyAction, UpdateAuthority, UpdateMetadataAuthorityAction, UpdateMetadataFieldAction, }, }, @@ -263,7 +263,7 @@ pub async fn create_mint_action_instruction( let current_index = ctoken_account_index; ctoken_account_index += 1; - instruction_data.with_mint_to_token(MintToTokenAction { + instruction_data.with_mint_to(MintToAction { account_index: current_index, amount, }) diff --git a/sdk-libs/token-client/src/instructions/transfer2.rs b/sdk-libs/token-client/src/instructions/transfer2.rs index 1bf3cdc213..ebdf50eaec 100644 --- a/sdk-libs/token-client/src/instructions/transfer2.rs +++ b/sdk-libs/token-client/src/instructions/transfer2.rs @@ -329,7 +329,7 @@ pub async fn create_generic_transfer2_instruction( )?; } else { // Regular compression for compressed token accounts - token_account.compress_token(input.amount, source_index, authority_index)?; + token_account.compress(input.amount, source_index, authority_index)?; } token_accounts.push(token_account); } @@ -443,7 +443,7 @@ pub async fn create_generic_transfer2_instruction( )?; } else { // Use the new SPL-specific decompress method - token_account.decompress_token(input.decompress_amount, recipient_index)?; + token_account.decompress(input.decompress_amount, recipient_index)?; } out_lamports.push( diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/account2.rs b/sdk-libs/token-sdk/src/compressed_token/v2/account2.rs index 74a2ce335f..b1a1179d00 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/account2.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/account2.rs @@ -166,7 +166,7 @@ impl CTokenAccount2 { // TODO: consider this might be confusing because it must not be used in combination with fn compress() #[profile] - pub fn compress_token( + pub fn compress( &mut self, amount: u64, source_or_recipient_index: u8, @@ -178,7 +178,7 @@ impl CTokenAccount2 { } self.output.amount += amount; - self.compression = Some(Compression::compress_token( + self.compression = Some(Compression::compress( amount, self.output.mint, source_or_recipient_index, @@ -224,7 +224,7 @@ impl CTokenAccount2 { // TODO: consider this might be confusing because it must not be used in combination with fn decompress() #[profile] - pub fn decompress_token(&mut self, amount: u64, source_index: u8) -> Result<(), TokenSdkError> { + pub fn decompress(&mut self, amount: u64, source_index: u8) -> Result<(), TokenSdkError> { // Check if there's already a compression set if self.compression.is_some() { return Err(TokenSdkError::CompressionCannotBeSetTwice); @@ -235,7 +235,7 @@ impl CTokenAccount2 { } self.output.amount -= amount; - self.compression = Some(Compression::decompress_token( + self.compression = Some(Compression::decompress( amount, self.output.mint, source_index, @@ -333,7 +333,7 @@ impl CTokenAccount2 { self.output.amount += amount; // Use the compress_and_close method from Compression - self.compression = Some(Compression::compress_and_close_token( + self.compression = Some(Compression::compress_and_close( amount, self.output.mint, source_or_recipient_index, diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs b/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs index 9b6733fb30..faedd9e69c 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs @@ -75,7 +75,7 @@ pub fn decompress_full_token_accounts_with_indices<'info>( let mut token_account = CTokenAccount2::new(vec![idx.source])?; // Set up decompress_full - decompress entire balance to destination ctoken account - token_account.decompress_token(idx.source.amount, idx.destination_index)?; + token_account.decompress(idx.source.amount, idx.destination_index)?; token_accounts.push(token_account); // Collect TLV data for this input diff --git a/sdk-libs/token-sdk/src/token/decompress.rs b/sdk-libs/token-sdk/src/token/decompress.rs index 91a4530350..32275f9c8f 100644 --- a/sdk-libs/token-sdk/src/token/decompress.rs +++ b/sdk-libs/token-sdk/src/token/decompress.rs @@ -156,7 +156,7 @@ impl Decompress { let mut token_account = CTokenAccount2::new(vec![indices.source]) .map_err(|_| ProgramError::InvalidAccountData)?; token_account - .decompress_token(self.token_data.amount, indices.destination_index) + .decompress(self.token_data.amount, indices.destination_index) .map_err(|_| ProgramError::InvalidAccountData)?; // Build instruction inputs diff --git a/sdk-libs/token-sdk/src/token/mint_to.rs b/sdk-libs/token-sdk/src/token/mint_to.rs index 338a22d358..781c3c2461 100644 --- a/sdk-libs/token-sdk/src/token/mint_to.rs +++ b/sdk-libs/token-sdk/src/token/mint_to.rs @@ -115,7 +115,7 @@ impl MintTo { AccountMeta::new_readonly(Pubkey::default(), false), // System program for lamport transfers ], data: { - let mut data = vec![7u8]; // TokenMintTo discriminator + let mut data = vec![7u8]; // MintTo discriminator data.extend_from_slice(&self.amount.to_le_bytes()); // Include max_top_up if set (10-byte format) if let Some(max_top_up) = self.max_top_up { diff --git a/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs b/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs index ed0d01452a..1293af3e93 100644 --- a/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs +++ b/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs @@ -195,7 +195,7 @@ impl TransferFromSpl { let ctoken_account = CTokenAccount2 { inputs: vec![], output: MultiTokenTransferOutputData::default(), - compression: Some(Compression::decompress_token(self.amount, 0, 1)), + compression: Some(Compression::decompress(self.amount, 0, 1)), delegate_is_set: false, method_used: true, }; diff --git a/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs b/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs index f4554752dc..dbbe262fba 100644 --- a/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs +++ b/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs @@ -171,7 +171,7 @@ impl TransferToSpl { let compress_to_pool = CTokenAccount2 { inputs: vec![], output: MultiTokenTransferOutputData::default(), - compression: Some(Compression::compress_token( + compression: Some(Compression::compress( self.amount, 0, // mint index 1, // source ctoken account index diff --git a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs index 11caa17f23..966c5411f9 100644 --- a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs +++ b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs @@ -23,8 +23,8 @@ use light_token_sdk::{ compressed_token::create_compressed_mint::{ derive_cmint_compressed_address, find_cmint_address, }, - ctoken, pack::compat::CTokenDataWithVariant, + token, }; use light_token_types::CPI_AUTHORITY_PDA; use sdk_compressible_test::{ @@ -559,7 +559,7 @@ pub async fn decompress_multiple_pdas_with_ctoken( .unwrap() .value; - let ctoken_config = ctoken::config_pda(); + let ctoken_config = token::config_pda(); let instruction = light_compressible_client::compressible_instruction::decompress_accounts_idempotent( program_id, @@ -636,10 +636,10 @@ pub async fn decompress_multiple_pdas_with_ctoken( fee_payer: payer.pubkey(), config: CompressibleConfig::derive_pda(program_id, 0).0, rent_sponsor: payer.pubkey(), - ctoken_rent_sponsor: Some(ctoken::rent_sponsor_pda()), + ctoken_rent_sponsor: Some(token::rent_sponsor_pda()), ctoken_config: Some(ctoken_config), - ctoken_program: Some(ctoken::id()), - ctoken_cpi_authority: Some(ctoken::cpi_authority()), + ctoken_program: Some(token::id()), + ctoken_cpi_authority: Some(token::cpi_authority()), some_mint: ctoken_account.token.mint, system_program: Pubkey::default(), } diff --git a/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs b/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs index 1558c2c046..7387418b3f 100644 --- a/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs +++ b/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs @@ -1,5 +1,5 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use solana_program::{program_error::ProgramError, account_info::AccountInfo}; +use solana_program::{account_info::AccountInfo, program_error::ProgramError}; /// Instruction data for CTokenMintTo operations #[derive(BorshSerialize, BorshDeserialize)] diff --git a/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs b/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs index 1ee1521f22..93d97a07e5 100644 --- a/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs +++ b/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs @@ -5,7 +5,7 @@ use light_token_sdk::{ }; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; -use crate::{MINT_AUTHORITY_SEED, ID}; +use crate::{ID, MINT_AUTHORITY_SEED}; /// Instruction data for DecompressCMint operations #[derive(BorshSerialize, BorshDeserialize)] diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs b/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs index 1e618f5d99..2a15f648d0 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs @@ -17,7 +17,7 @@ use borsh::BorshDeserialize; use light_client::{indexer::Indexer, rpc::Rpc}; use light_program_test::{program_test::TestRpc, LightProgramTest, ProgramTestConfig}; use light_token_sdk::token::{ - CompressibleParams, CreateAssociatedTokenAccount, DecompressToCtoken, Token, Transfer, + CompressibleParams, CreateAssociatedTokenAccount, Decompress, Token, Transfer, }; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -243,7 +243,7 @@ async fn test_cmint_to_ctoken_scenario_compression_only() { println!("Decompressing tokens to cToken account..."); println!("discriminator {:?}", discriminator); println!("token_data {:?}", token_data); - let decompress_instruction = DecompressToCtoken { + let decompress_instruction = Decompress { token_data, discriminator, merkle_tree: account_proof.tree_info.tree, diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs b/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs index 446be45022..bc5cfafd19 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs @@ -23,8 +23,7 @@ use light_test_utils::spl::{create_token_account, mint_spl_tokens}; use light_token_sdk::{ spl_interface::{find_spl_interface_pda_with_index, CreateSplInterfacePda}, token::{ - derive_token_ata, CreateAssociatedTokenAccount, DecompressToToken, FreezeToken, ThawToken, - TransferFromSpl, + derive_token_ata, CreateAssociatedTokenAccount, Decompress, Freeze, Thaw, TransferFromSpl, }, }; use solana_sdk::{signature::Keypair, signer::Signer}; @@ -221,7 +220,7 @@ async fn test_spl_to_ctoken_scenario() { // 8. Freeze the cToken account println!("\nFreezing cToken account..."); - let freeze_instruction = FreezeToken { + let freeze_instruction = Freeze { token_account: ctoken_ata, mint, freeze_authority: payer.pubkey(), @@ -246,7 +245,7 @@ async fn test_spl_to_ctoken_scenario() { // 9. Thaw the cToken account println!("Thawing cToken account..."); - let thaw_instruction = ThawToken { + let thaw_instruction = Thaw { token_account: ctoken_ata, mint, freeze_authority: payer.pubkey(), @@ -366,7 +365,7 @@ async fn test_spl_to_ctoken_scenario() { // 13. Decompress compressed tokens to cToken account println!("Decompressing tokens to cToken account..."); - let decompress_instruction = DecompressToToken { + let decompress_instruction = Decompress { token_data, discriminator, merkle_tree: account_proof.tree_info.tree, diff --git a/sdk-tests/sdk-light-token-test/tests/shared.rs b/sdk-tests/sdk-light-token-test/tests/shared.rs index be830de506..4567f09363 100644 --- a/sdk-tests/sdk-light-token-test/tests/shared.rs +++ b/sdk-tests/sdk-light-token-test/tests/shared.rs @@ -6,6 +6,7 @@ use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; /// Setup helper: Creates a compressed mint directly using the ctoken SDK (not via wrapper program) /// Optionally creates ATAs and mints tokens for each recipient. +/// Note: This decompresses the mint first, then uses MintTo to mint to ctoken accounts. /// Returns (mint_pda, compression_address, ata_pubkeys, mint_seed_keypair) #[allow(unused)] pub async fn setup_create_compressed_mint( @@ -16,7 +17,7 @@ pub async fn setup_create_compressed_mint( recipients: Vec<(u64, Pubkey)>, ) -> (Pubkey, [u8; 32], Vec, Keypair) { use light_token_sdk::token::{ - CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, MintToParams, + CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, }; let mint_seed = Keypair::new(); @@ -114,7 +115,13 @@ pub async fn setup_create_compressed_mint( .collect(); if !recipients_with_amount.is_empty() { - // Get the compressed mint account for minting + // First, decompress the compressed mint to get a CMint account + // Then use MintTo to mint to ctoken accounts + use light_token_interface::{ + instructions::mint_action::CompressedMintWithContext, state::CompressedMint, + }; + use light_token_sdk::token::DecompressCMint; + let compressed_mint_account = rpc .get_compressed_account(compression_address, None) .await @@ -122,20 +129,23 @@ pub async fn setup_create_compressed_mint( .value .expect("Compressed mint should exist"); - use light_token_interface::state::CompressedMint; - let compressed_mint = - CompressedMint::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) - .unwrap(); + let compressed_mint = CompressedMint::deserialize( + &mut compressed_mint_account + .data + .as_ref() + .unwrap() + .data + .as_slice(), + ) + .unwrap(); - // Get validity proof for the mint operation + // Get validity proof for the decompress operation let rpc_result = rpc .get_validity_proof(vec![compressed_mint_account.hash], vec![], None) .await .unwrap() .value; - // Build CompressedMintWithContext - use light_token_interface::instructions::mint_action::CompressedMintWithContext; let compressed_mint_with_context = CompressedMintWithContext { address: compression_address, leaf_index: compressed_mint_account.leaf_index, @@ -147,36 +157,41 @@ pub async fn setup_create_compressed_mint( mint: Some(compressed_mint.try_into().unwrap()), }; - // Build mint params with first recipient - let (first_idx, (first_amount, _)) = recipients_with_amount[0]; - let mut mint_params = MintToParams::new( + let decompress_ix = DecompressCMint { + mint_seed_pubkey: mint_seed.pubkey(), + payer: payer.pubkey(), + authority: mint_authority, + state_tree: compressed_mint_account.tree_info.tree, + input_queue: compressed_mint_account.tree_info.queue, + output_queue, compressed_mint_with_context, - *first_amount, - mint_authority, - rpc_result.proof, - ); - // Override the account_index for the first action - mint_params.mint_to_actions[0].account_index = first_idx as u8; - - // Add remaining recipients - for (idx, (amount, _)) in recipients_with_amount.iter().skip(1) { - mint_params = mint_params.add_mint_to_action(*idx as u8, *amount); + proof: rpc_result.proof, + rent_payment: 16, // ~24 hours rent (16 epochs * 1.5h per epoch) + write_top_up: 766, // ~3 hours per write } + .instruction() + .unwrap(); - // Build MintToToken instruction - let mint_to_ctoken = MintTo::new( - mint_params, - payer.pubkey(), - compressed_mint_account.tree_info.tree, - compressed_mint_account.tree_info.queue, - compressed_mint_account.tree_info.queue, - ata_pubkeys.clone(), - ); - let mint_instruction = mint_to_ctoken.instruction().unwrap(); - - rpc.create_and_send_transaction(&[mint_instruction], &payer.pubkey(), &[payer]) + rpc.create_and_send_transaction(&[decompress_ix], &payer.pubkey(), &[payer]) .await .unwrap(); + + // Now mint to each recipient using the decompressed CMint + for (idx, (amount, _)) in &recipients_with_amount { + let mint_instruction = MintTo { + cmint: mint, + destination: ata_pubkeys[*idx], + amount: *amount, + authority: mint_authority, + max_top_up: None, + } + .instruction() + .unwrap(); + + rpc.create_and_send_transaction(&[mint_instruction], &payer.pubkey(), &[payer]) + .await + .unwrap(); + } } (mint, compression_address, ata_pubkeys, mint_seed) @@ -194,7 +209,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( recipients: Vec<(u64, Pubkey)>, ) -> (Pubkey, [u8; 32], Vec) { use light_token_sdk::token::{ - CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, MintToParams, + CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, }; let mint_seed = Keypair::new(); @@ -336,8 +351,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( .unwrap(); } - // After decompression, use TokenMintTo (simple 3-account instruction) - // instead of MintToToken (which uses compressed mint) + // After decompression, use MintTo (simple 3-account instruction) let recipients_with_amount: Vec<_> = recipients .iter() .enumerate() @@ -345,10 +359,8 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( .collect(); if !recipients_with_amount.is_empty() { - use light_token_sdk::token::TokenMintTo; - for (idx, (amount, _)) in &recipients_with_amount { - let mint_instruction = TokenMintTo { + let mint_instruction = MintTo { cmint: mint, destination: ata_pubkeys[*idx], amount: *amount, @@ -378,8 +390,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( compression_only: bool, ) -> (Pubkey, [u8; 32], Vec) { use light_token_sdk::token::{ - CompressibleParams, CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, - MintToToken, MintToTokenParams, + CompressibleParams, CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, }; let mint_seed = Keypair::new(); @@ -484,7 +495,13 @@ pub async fn setup_create_compressed_mint_with_compression_only( .collect(); if !recipients_with_amount.is_empty() { - // Get the compressed mint account for minting + // First, decompress the compressed mint to get a CMint account + // Then use MintTo to mint to ctoken accounts + use light_token_interface::{ + instructions::mint_action::CompressedMintWithContext, state::CompressedMint, + }; + use light_token_sdk::token::DecompressCMint; + let compressed_mint_account = rpc .get_compressed_account(compression_address, None) .await @@ -492,20 +509,23 @@ pub async fn setup_create_compressed_mint_with_compression_only( .value .expect("Compressed mint should exist"); - use light_token_interface::state::CompressedMint; - let compressed_mint = - CompressedMint::deserialize(&mut compressed_mint_account.data.unwrap().data.as_slice()) - .unwrap(); + let compressed_mint = CompressedMint::deserialize( + &mut compressed_mint_account + .data + .as_ref() + .unwrap() + .data + .as_slice(), + ) + .unwrap(); - // Get validity proof for the mint operation + // Get validity proof for the decompress operation let rpc_result = rpc .get_validity_proof(vec![compressed_mint_account.hash], vec![], None) .await .unwrap() .value; - // Build CompressedMintWithContext - use light_token_interface::instructions::mint_action::CompressedMintWithContext; let compressed_mint_with_context = CompressedMintWithContext { address: compression_address, leaf_index: compressed_mint_account.leaf_index, @@ -517,36 +537,41 @@ pub async fn setup_create_compressed_mint_with_compression_only( mint: Some(compressed_mint.try_into().unwrap()), }; - // Build mint params with first recipient - let (first_idx, (first_amount, _)) = recipients_with_amount[0]; - let mut mint_params = MintToParams::new( + let decompress_ix = DecompressCMint { + mint_seed_pubkey: mint_seed.pubkey(), + payer: payer.pubkey(), + authority: mint_authority, + state_tree: compressed_mint_account.tree_info.tree, + input_queue: compressed_mint_account.tree_info.queue, + output_queue, compressed_mint_with_context, - *first_amount, - mint_authority, - rpc_result.proof, - ); - // Override the account_index for the first action - mint_params.mint_to_actions[0].account_index = first_idx as u8; - - // Add remaining recipients - for (idx, (amount, _)) in recipients_with_amount.iter().skip(1) { - mint_params = mint_params.add_mint_to_action(*idx as u8, *amount); + proof: rpc_result.proof, + rent_payment: 16, // ~24 hours rent (16 epochs * 1.5h per epoch) + write_top_up: 766, // ~3 hours per write } + .instruction() + .unwrap(); - // Build MintToToken instruction - let mint_to_ctoken = MintTo::new( - mint_params, - payer.pubkey(), - compressed_mint_account.tree_info.tree, - compressed_mint_account.tree_info.queue, - compressed_mint_account.tree_info.queue, - ata_pubkeys.clone(), - ); - let mint_instruction = mint_to_ctoken.instruction().unwrap(); - - rpc.create_and_send_transaction(&[mint_instruction], &payer.pubkey(), &[payer]) + rpc.create_and_send_transaction(&[decompress_ix], &payer.pubkey(), &[payer]) .await .unwrap(); + + // Now mint to each recipient using the decompressed CMint + for (idx, (amount, _)) in &recipients_with_amount { + let mint_instruction = MintTo { + cmint: mint, + destination: ata_pubkeys[*idx], + amount: *amount, + authority: mint_authority, + max_top_up: None, + } + .instruction() + .unwrap(); + + rpc.create_and_send_transaction(&[mint_instruction], &payer.pubkey(), &[payer]) + .await + .unwrap(); + } } (mint, compression_address, ata_pubkeys) diff --git a/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs index 5d8b722eb9..90e146343b 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs @@ -11,8 +11,8 @@ use light_test_utils::{ }; use light_token_interface::state::Token; use light_token_sdk::{ - ctoken::{derive_token_ata, CreateAssociatedTokenAccount, TransferFromSpl}, spl_interface::{find_spl_interface_pda_with_index, CreateSplInterfacePda}, + token::{derive_token_ata, CreateAssociatedTokenAccount, TransferFromSpl}, }; use native_ctoken_examples::{InstructionType, TransferCheckedData, ID}; use shared::*; diff --git a/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs index 1ba58b59c4..d8393b2789 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs @@ -9,8 +9,8 @@ use light_test_utils::spl::{ create_mint_helper, create_token_2022_account, mint_spl_tokens, CREATE_MINT_HELPER_DECIMALS, }; use light_token_sdk::{ - ctoken::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, spl_interface::find_spl_interface_pda_with_index, + token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, }; use light_token_types::CPI_AUTHORITY_PDA; use native_ctoken_examples::{TransferInterfaceData, ID, TRANSFER_INTERFACE_AUTHORITY_SEED}; diff --git a/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs b/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs index d755acd0f0..794a4c09c9 100644 --- a/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs +++ b/sdk-tests/sdk-token-test/src/pda_ctoken/mint.rs @@ -1,7 +1,7 @@ use anchor_lang::{prelude::*, solana_program::program::invoke}; use light_sdk_types::cpi_accounts::v2::CpiAccounts; use light_token_interface::instructions::mint_action::{ - MintActionCompressedInstructionData, MintToCompressedAction, MintToTokenAction, UpdateAuthority, + MintActionCompressedInstructionData, MintToAction, MintToCompressedAction, UpdateAuthority, }; use light_token_sdk::compressed_token::{ ctoken_instruction::CTokenInstruction, mint_action::MintActionCpiAccounts, @@ -26,7 +26,7 @@ pub fn process_mint_action<'a, 'info>( token_account_version: 2, recipients: input.token_recipients.clone(), }) - .with_mint_to_token(MintToTokenAction { + .with_mint_to(MintToAction { account_index: 0, // Index in remaining accounts amount: input.token_recipients[0].amount, }) diff --git a/sdk-tests/sdk-token-test/src/process_four_transfer2.rs b/sdk-tests/sdk-token-test/src/process_four_transfer2.rs index c9c8cc9891..1312e04126 100644 --- a/sdk-tests/sdk-token-test/src/process_four_transfer2.rs +++ b/sdk-tests/sdk-token-test/src/process_four_transfer2.rs @@ -180,7 +180,7 @@ pub fn process_four_transfer2<'info>( four_invokes_params.compress_1.mint, ); token_account_compress - .compress_token( + .compress( four_invokes_params.compress_1.amount, four_invokes_params.compress_1.solana_token_account, four_invokes_params.compress_1.authority, From 1169c18bdbff33c64e5a0b7427a21139421d1256 Mon Sep 17 00:00:00 2001 From: ananas Date: Tue, 13 Jan 2026 03:00:56 +0000 Subject: [PATCH 8/9] chore: rename CMint to Mint and CTokenDefaultAccounts to TokenDefaultAccounts --- forester/src/compressible/bootstrap.rs | 4 +- forester/src/compressible/compressor.rs | 2 +- forester/src/compressible/state.rs | 4 +- forester/src/compressible/subscriber.rs | 4 +- forester/tests/test_compressible_ctoken.rs | 4 +- js/compressed-token/src/v3/derivation.ts | 2 +- program-libs/compressible/src/config.rs | 2 +- .../tests/compress_only.rs | 4 +- .../tests/compress_only/all.rs | 28 +++--- .../tests/compress_only/ata_decompress.rs | 10 +-- .../compress_only/decompress_restrictions.rs | 14 +-- .../tests/compress_only/default_state.rs | 26 +++--- .../tests/compress_only/frozen.rs | 2 +- .../compress_only/invalid_destination.rs | 6 +- .../compress_only/invalid_extension_state.rs | 44 +++++----- .../tests/compress_only/mod.rs | 28 +++--- .../compress_only/restricted_required.rs | 6 +- .../tests/compress_only/withheld_fee.rs | 20 +++-- .../compressed-token-test/tests/ctoken.rs | 51 ----------- .../tests/freeze/compress_only.rs | 12 +-- .../tests/light_token.rs | 51 +++++++++++ .../{ctoken => light_token}/approve_revoke.rs | 24 ++--- .../tests/{ctoken => light_token}/burn.rs | 22 ++--- .../tests/{ctoken => light_token}/close.rs | 0 .../compress_and_close.rs | 8 +- .../tests/{ctoken => light_token}/create.rs | 2 +- .../{ctoken => light_token}/create_ata.rs | 2 +- .../{ctoken => light_token}/create_ata2.rs | 0 .../{ctoken => light_token}/extensions.rs | 32 +++---- .../extensions_failing.rs | 44 +++++----- .../{ctoken => light_token}/freeze_thaw.rs | 12 +-- .../{ctoken => light_token}/functional.rs | 4 +- .../{ctoken => light_token}/functional_ata.rs | 0 .../tests/{ctoken => light_token}/shared.rs | 8 +- .../spl_instruction_compat.rs | 12 +-- .../tests/{ctoken => light_token}/transfer.rs | 4 +- .../transfer_checked.rs | 4 +- .../compressed-token-test/tests/mint/burn.rs | 14 +-- .../tests/mint/cpi_context.rs | 6 +- .../tests/mint/edge_cases.rs | 10 +-- .../tests/mint/failing.rs | 22 +++-- .../tests/mint/functional.rs | 35 ++++---- .../tests/mint/mint_to.rs | 10 +-- .../tests/mint/random.rs | 12 ++- .../tests/transfer2/compress_failing.rs | 42 ++++----- .../tests/transfer2/compress_spl_failing.rs | 6 +- .../tests/transfer2/decompress_failing.rs | 20 ++--- .../tests/transfer2/functional.rs | 84 +++++++++--------- .../no_system_program_cpi_failing.rs | 28 +++--- .../tests/transfer2/random.rs | 12 +-- .../tests/transfer2/shared.rs | 65 +++++++------- .../tests/transfer2/spl_ctoken.rs | 6 +- .../tests/transfer2/transfer_failing.rs | 4 +- .../registry-test/tests/compressible.rs | 22 ++--- program-tests/utils/src/assert_claim.rs | 18 ++-- .../utils/src/assert_ctoken_approve_revoke.rs | 30 +++---- program-tests/utils/src/assert_ctoken_burn.rs | 22 ++--- .../utils/src/assert_ctoken_freeze_thaw.rs | 30 +++---- .../utils/src/assert_ctoken_mint_to.rs | 22 ++--- program-tests/utils/src/assert_mint_action.rs | 16 ++-- .../utils/src/assert_mint_to_compressed.rs | 4 +- program-tests/utils/src/assert_transfer2.rs | 2 +- sdk-libs/macros/src/compressible/GUIDE.md | 8 +- .../macros/src/compressible/seed_providers.rs | 2 +- .../forester/compress_and_close_forester.rs | 6 +- .../token-client/src/actions/mint_action.rs | 8 +- .../src/instructions/create_mint.rs | 10 +-- .../src/instructions/mint_action.rs | 12 +-- .../src/instructions/mint_to_compressed.rs | 4 +- .../src/instructions/transfer2.rs | 12 +-- .../v1/approve/account_metas.rs | 4 +- .../v1/batch_compress/account_metas.rs | 4 +- .../v1/transfer/account_metas.rs | 4 +- .../compressed_token/v2/compress_and_close.rs | 10 +-- .../create_compressed_mint/account_metas.rs | 6 +- .../v2/create_compressed_mint/instruction.rs | 14 +-- .../v2/create_compressed_mint/mod.rs | 2 +- .../compressed_token/v2/decompress_full.rs | 10 +-- .../v2/mint_action/account_metas.rs | 26 +++--- .../v2/mint_to_compressed/account_metas.rs | 6 +- .../v2/transfer2/account_metas.rs | 4 +- .../update_compressed_mint/account_metas.rs | 4 +- sdk-libs/token-sdk/src/error.rs | 2 +- sdk-libs/token-sdk/src/lib.rs | 2 +- sdk-libs/token-sdk/src/token/approve.rs | 8 +- .../token-sdk/src/token/approve_checked.rs | 10 +-- sdk-libs/token-sdk/src/token/burn.rs | 4 +- sdk-libs/token-sdk/src/token/burn_checked.rs | 4 +- .../token/{create_cmint.rs => create_mint.rs} | 64 +++++++------- ...decompress_cmint.rs => decompress_mint.rs} | 26 +++--- sdk-libs/token-sdk/src/token/freeze.rs | 6 +- sdk-libs/token-sdk/src/token/mint_to.rs | 2 +- .../token-sdk/src/token/mint_to_checked.rs | 2 +- sdk-libs/token-sdk/src/token/mod.rs | 14 +-- sdk-libs/token-sdk/src/token/revoke.rs | 8 +- sdk-libs/token-sdk/src/token/thaw.rs | 6 +- sdk-libs/token-sdk/src/utils.rs | 4 +- .../token-sdk/tests/account_metas_test.rs | 8 +- sdk-tests/csdk-anchor-derived-test/src/lib.rs | 4 +- .../tests/basic_test.rs | 10 +-- .../csdk-anchor-full-derived-test/src/lib.rs | 8 +- .../tests/basic_test.rs | 10 +-- .../create_user_record_and_game_session.rs | 4 +- .../tests/multi_account_tests.rs | 12 ++- sdk-tests/sdk-light-token-test/src/approve.rs | 4 +- sdk-tests/sdk-light-token-test/src/burn.rs | 4 +- .../sdk-light-token-test/src/create_cmint.rs | 16 ++-- .../src/ctoken_mint_to.rs | 81 +++++++++++++---- .../src/decompress_cmint.rs | 4 +- sdk-tests/sdk-light-token-test/src/freeze.rs | 4 +- sdk-tests/sdk-light-token-test/src/lib.rs | 38 ++++---- sdk-tests/sdk-light-token-test/src/revoke.rs | 4 +- sdk-tests/sdk-light-token-test/src/thaw.rs | 4 +- .../src/transfer_interface.rs | 20 ++--- .../src/transfer_spl_ctoken.rs | 12 +-- .../sdk-light-token-test/tests/shared.rs | 42 ++++----- .../sdk-light-token-test/tests/test_burn.rs | 4 +- .../tests/test_create_cmint.rs | 8 +- .../tests/test_ctoken_mint_to.rs | 16 ++-- .../tests/test_decompress_cmint.rs | 44 +++++----- .../tests/test_freeze_thaw.rs | 8 +- .../tests/test_transfer_interface.rs | 88 +++++++++---------- .../tests/test_transfer_spl_ctoken.rs | 40 ++++----- sdk-tests/sdk-token-test/tests/ctoken_pda.rs | 6 +- .../tests/decompress_full_cpi.rs | 6 +- sdk-tests/sdk-token-test/tests/pda_ctoken.rs | 8 +- .../tests/test_4_invocations.rs | 4 +- .../sdk-token-test/tests/test_4_transfer2.rs | 4 +- .../sdk-token-test/tests/test_deposit.rs | 6 +- 129 files changed, 963 insertions(+), 930 deletions(-) delete mode 100644 program-tests/compressed-token-test/tests/ctoken.rs create mode 100644 program-tests/compressed-token-test/tests/light_token.rs rename program-tests/compressed-token-test/tests/{ctoken => light_token}/approve_revoke.rs (95%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/burn.rs (95%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/close.rs (100%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/compress_and_close.rs (99%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/create.rs (99%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/create_ata.rs (99%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/create_ata2.rs (100%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/extensions.rs (94%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/extensions_failing.rs (90%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/freeze_thaw.rs (94%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/functional.rs (98%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/functional_ata.rs (100%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/shared.rs (99%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/spl_instruction_compat.rs (98%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/transfer.rs (99%) rename program-tests/compressed-token-test/tests/{ctoken => light_token}/transfer_checked.rs (97%) rename sdk-libs/token-sdk/src/token/{create_cmint.rs => create_mint.rs} (91%) rename sdk-libs/token-sdk/src/token/{decompress_cmint.rs => decompress_mint.rs} (92%) diff --git a/forester/src/compressible/bootstrap.rs b/forester/src/compressible/bootstrap.rs index 0c6b9a5649..802b1f21c1 100644 --- a/forester/src/compressible/bootstrap.rs +++ b/forester/src/compressible/bootstrap.rs @@ -194,7 +194,7 @@ async fn bootstrap_with_v2_api( // Build request payload // Filter for accounts with account_type = 2 at position 165 - // This indicates a CToken account with extensions (e.g., Compressible) + // This indicates a Light Token account with extensions (e.g., Compressible) let mut params = json!([ program_id.to_string(), { @@ -310,7 +310,7 @@ async fn bootstrap_with_standard_api( let program_id = Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID); // Filter for accounts with account_type = 2 at position 165 - // This indicates a CToken account with extensions (e.g., Compressible) + // This indicates a Light Token account with extensions (e.g., Compressible) let payload = json!({ "jsonrpc": "2.0", "id": 1, diff --git a/forester/src/compressible/compressor.rs b/forester/src/compressible/compressor.rs index 1607d13b7d..00d7d0f30a 100644 --- a/forester/src/compressible/compressor.rs +++ b/forester/src/compressible/compressor.rs @@ -134,7 +134,7 @@ impl Compressor { }) }) .ok_or_else(|| { - anyhow::anyhow!("Missing Compressible extension on CToken account") + anyhow::anyhow!("Missing Compressible extension on Light Token account") })?; // Determine owner based on compress_to_pubkey flag diff --git a/forester/src/compressible/state.rs b/forester/src/compressible/state.rs index 4ef3e6d446..ed27ad07fe 100644 --- a/forester/src/compressible/state.rs +++ b/forester/src/compressible/state.rs @@ -45,7 +45,7 @@ fn calculate_compressible_slot(account: &Token, lamports: u64, account_size: usi Ok(last_funded_epoch * SLOTS_PER_EPOCH) } -/// Tracker for compressible CToken accounts +/// Tracker for compressible Light Token accounts #[derive(Debug)] pub struct CompressibleAccountTracker { accounts: Arc>, @@ -129,7 +129,7 @@ impl CompressibleAccountTracker { } }; - // Create state with full CToken account + // Create state with full Light Token account let state = CompressibleAccountState { pubkey, account: ctoken, diff --git a/forester/src/compressible/subscriber.rs b/forester/src/compressible/subscriber.rs index 563e51c32b..5cf2044e96 100644 --- a/forester/src/compressible/subscriber.rs +++ b/forester/src/compressible/subscriber.rs @@ -25,7 +25,7 @@ const REGISTRY_PROGRAM_ID_STR: &str = "Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEm /// Log prefix emitted by registry program when closing accounts const COMPRESS_AND_CLOSE_LOG_PREFIX: &str = "compress_and_close:"; -/// Subscribes to account changes for all compressible CToken accounts +/// Subscribes to account changes for all compressible Light Token accounts pub struct AccountSubscriber { ws_url: String, tracker: Arc, @@ -55,7 +55,7 @@ impl AccountSubscriber { let program_id = Pubkey::new_from_array(LIGHT_TOKEN_PROGRAM_ID); // Subscribe to compressed token program accounts with filter for account_type = 2 at position 165 - // This indicates a CToken account with extensions (e.g., Compressible) + // This indicates a Light Token account with extensions (e.g., Compressible) // "3" is base58 encoding of byte value 2 (ACCOUNT_TYPE_TOKEN_ACCOUNT) let (mut subscription, unsubscribe) = pubsub_client .program_subscribe( diff --git a/forester/tests/test_compressible_ctoken.rs b/forester/tests/test_compressible_ctoken.rs index 8fe4013dff..d6aef471c4 100644 --- a/forester/tests/test_compressible_ctoken.rs +++ b/forester/tests/test_compressible_ctoken.rs @@ -239,7 +239,7 @@ async fn test_compressible_ctoken_compression() { // Create mint let mint_seed = Keypair::new(); let address_tree = rpc.get_address_tree_v2().tree; - let mint = Pubkey::from(create_compressed_mint::derive_cmint_compressed_address( + let mint = Pubkey::from(create_compressed_mint::derive_mint_compressed_address( &mint_seed.pubkey(), &address_tree, )); @@ -395,7 +395,7 @@ async fn test_compressible_ctoken_bootstrap() { // Create mint let mint_seed = Keypair::new(); let address_tree = rpc.get_address_tree_v2().tree; - let mint = Pubkey::from(create_compressed_mint::derive_cmint_compressed_address( + let mint = Pubkey::from(create_compressed_mint::derive_mint_compressed_address( &mint_seed.pubkey(), &address_tree, )); diff --git a/js/compressed-token/src/v3/derivation.ts b/js/compressed-token/src/v3/derivation.ts index 4232569bd5..5010a537f6 100644 --- a/js/compressed-token/src/v3/derivation.ts +++ b/js/compressed-token/src/v3/derivation.ts @@ -13,7 +13,7 @@ export function deriveCMintAddress( mintSeed: PublicKey, addressTreeInfo: TreeInfo, ) { - // find_cmint_address returns [CMint, bump], we want CMint + // find_mint_address returns [CMint, bump], we want CMint // In JS, just use the mintSeed directly as the CMint address const address = deriveAddressV2( findMintAddress(mintSeed)[0].toBytes(), diff --git a/program-libs/compressible/src/config.rs b/program-libs/compressible/src/config.rs index 8f8ae32e69..f304fd7c7f 100644 --- a/program-libs/compressible/src/config.rs +++ b/program-libs/compressible/src/config.rs @@ -43,7 +43,7 @@ pub struct CompressibleConfig { pub update_authority: Pubkey, /// Withdrawal authority can withdraw funds from the rent recipient pda. pub withdrawal_authority: Pubkey, - /// CToken program pda: + /// Light Token program pda: /// 1. pays rent exemption at compressible ctoken account creation /// 2. receives rent exemption at compressible ctoken account closure /// 3. receives rent from compressible ctoken accounts with Claim, or compress and close instructions. diff --git a/program-tests/compressed-token-test/tests/compress_only.rs b/program-tests/compressed-token-test/tests/compress_only.rs index 7ab70a2449..52c558521f 100644 --- a/program-tests/compressed-token-test/tests/compress_only.rs +++ b/program-tests/compressed-token-test/tests/compress_only.rs @@ -1,6 +1,6 @@ //! Integration tests for compress_only extension behavior. //! -//! Tests for compression and decompression of CToken accounts with Token-2022 extensions. +//! Tests for compression and decompression of Light Token accounts with Token-2022 extensions. //! These tests verify the compress_only mode behavior for restricted extensions. //! //! ## Test Coverage (see .claude/test-coverage/transfer2-compress-and-close-tests.md) @@ -97,7 +97,7 @@ mod invalid_destination; mod invalid_extension_state; // Failing tests for CompressedOnly decompress restrictions -// - Cannot decompress to SPL Token-2022 account (must use CToken) +// - Cannot decompress to SPL Token-2022 account (must use Light Token) // - Cannot do partial decompress (would create change output) #[path = "compress_only/decompress_restrictions.rs"] mod decompress_restrictions; diff --git a/program-tests/compressed-token-test/tests/compress_only/all.rs b/program-tests/compressed-token-test/tests/compress_only/all.rs index 34d7071f7c..250a3827fe 100644 --- a/program-tests/compressed-token-test/tests/compress_only/all.rs +++ b/program-tests/compressed-token-test/tests/compress_only/all.rs @@ -12,8 +12,8 @@ use solana_sdk::{signature::Keypair, signer::Signer}; use super::shared::{setup_extensions_test, Rpc, ALL_EXTENSIONS}; -/// Test that forester can compress and close a CToken account with Token-2022 extensions -/// after prepaid epochs expire, and then decompress it back to a CToken account. +/// Test that forester can compress and close a Light Token account with Token-2022 extensions +/// after prepaid epochs expire, and then decompress it back to a Light Token account. #[tokio::test] #[serial] async fn test_compress_and_close_ctoken_with_extensions() { @@ -52,7 +52,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { ) .await; - // 2. Create CToken account with 0 prepaid epochs (immediately compressible) + // 2. Create Light Token account with 0 prepaid epochs (immediately compressible) let owner = Keypair::new(); let account_keypair = Keypair::new(); let ctoken_account = account_keypair.pubkey(); @@ -85,7 +85,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { .await .unwrap(); - // 3. Transfer tokens to CToken using hot path (required for mints with restricted extensions) + // 3. Transfer tokens to Light Token using hot path (required for mints with restricted extensions) let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); let transfer_ix = TransferFromSpl { @@ -109,7 +109,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { .await .unwrap(); - // Verify tokens are in the CToken account + // Verify tokens are in the Light Token account let account_before = context .rpc .get_account(ctoken_account) @@ -129,7 +129,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { let account_after = context.rpc.get_account(ctoken_account).await.unwrap(); assert!( account_after.is_none() || account_after.unwrap().lamports == 0, - "CToken account should be closed" + "Light Token account should be closed" ); let compressed_accounts = context @@ -147,7 +147,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { ); // Build expected TokenData with CompressedOnly extension - // The CToken had marker extensions (PausableAccount, PermanentDelegateAccount), + // The Light Token had marker extensions (PausableAccount, PermanentDelegateAccount), // so the compressed token should have CompressedOnly TLV extension use light_token_interface::state::{ CompressedOnlyExtension, CompressedTokenAccountState, TokenData, @@ -174,7 +174,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { "Compressed token account should match expected TokenData" ); - // 6. Create a new CToken account for decompress destination + // 6. Create a new Light Token account for decompress destination let decompress_dest_keypair = Keypair::new(); let decompress_dest_account = decompress_dest_keypair.pubkey(); @@ -215,11 +215,11 @@ async fn test_compress_and_close_ctoken_with_extensions() { .unwrap(); println!( - "Created decompress destination CToken account: {}", + "Created decompress destination Light Token account: {}", decompress_dest_account ); - // 7. Decompress the compressed account back to the new CToken account + // 7. Decompress the compressed account back to the new Light Token account // Need to include in_tlv for the CompressedOnly extension let in_tlv = vec![vec![ExtensionInstructionData::CompressedOnly( CompressedOnlyExtensionInstructionData { @@ -256,7 +256,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { .await .unwrap(); - // 8. Verify the CToken account has the tokens and proper extension state + // 8. Verify the Light Token account has the tokens and proper extension state let dest_account_data = context .rpc @@ -266,9 +266,9 @@ async fn test_compress_and_close_ctoken_with_extensions() { .unwrap(); let dest_ctoken = Token::deserialize(&mut &dest_account_data.data[..]) - .expect("Failed to deserialize destination CToken account"); + .expect("Failed to deserialize destination Light Token account"); - // Build expected CToken account + // Build expected Light Token account // Compression fields are now in the Compressible extension let expected_dest_token = Token { mint: mint_pubkey.to_bytes().into(), @@ -286,7 +286,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { assert_eq!( dest_ctoken, expected_dest_token, - "Decompressed CToken account should match expected with all extensions" + "Decompressed Light Token account should match expected with all extensions" ); // Verify no more compressed accounts for this owner diff --git a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs index c299b98060..cd020b2b32 100644 --- a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs +++ b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs @@ -418,7 +418,7 @@ async fn test_ata_decompress_to_non_ata_fails() { .await .unwrap(); - // Create a regular (non-ATA) CToken account with same owner + // Create a regular (non-ATA) Light Token account with same owner let regular_account_keypair = Keypair::new(); let create_regular_ix = CreateTokenAccount::new( context.payer.pubkey(), @@ -859,7 +859,7 @@ async fn test_ata_decompress_with_mismatched_amount_fails() { let wallet_owner_index = packed_accounts.insert_or_get_config(context.owner.pubkey(), true, false); - // Add CToken ATA recipient account - this is also the compressed token owner for ATAs + // Add Light Token ATA recipient account - this is also the compressed token owner for ATAs let ctoken_ata_index = packed_accounts.insert_or_get_config(context.ata_pubkey, false, true); // Create input token data with FULL amount (what merkle proof verifies) @@ -1337,7 +1337,7 @@ async fn test_non_ata_compress_only_decompress() { ) .await; - // Create regular (non-ATA) CToken account with compression_only=true + // Create regular (non-ATA) Light Token account with compression_only=true let owner = Keypair::new(); let account_keypair = Keypair::new(); let ctoken_account = account_keypair.pubkey(); @@ -1370,7 +1370,7 @@ async fn test_non_ata_compress_only_decompress() { .await .unwrap(); - // Transfer tokens to CToken + // Transfer tokens to Light Token let has_restricted = [ExtensionType::Pausable] .iter() .any(|ext| RESTRICTED_EXTENSIONS.contains(ext)); @@ -1436,7 +1436,7 @@ async fn test_non_ata_compress_only_decompress() { "Non-ATA compressed account owner should be wallet owner" ); - // Create new CToken account with SAME owner for decompress + // Create new Light Token account with SAME owner for decompress let new_account_keypair = Keypair::new(); let create_new_ix = CreateTokenAccount::new( payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs index 30325634f0..4ad3a5f970 100644 --- a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs +++ b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs @@ -1,7 +1,7 @@ //! Tests for CompressedOnly decompress restrictions. //! //! This module tests: -//! - Spec #13: CompressedOnly inputs can only decompress to CToken, not SPL +//! - Spec #13: CompressedOnly inputs can only decompress to Light Token, not SPL //! - Spec #14: CompressedOnly inputs must decompress complete account (no change output) use light_client::indexer::Indexer; @@ -62,7 +62,7 @@ async fn setup_compressed_token_for_decompress( let mint_amount = 1_000_000_000u64; mint_spl_tokens_22(&mut rpc, &payer, &mint_pubkey, &spl_account, mint_amount).await; - // Create CToken account with compression_only=true + // Create Light Token account with compression_only=true let owner = Keypair::new(); let account_keypair = Keypair::new(); let ctoken_account = account_keypair.pubkey(); @@ -88,7 +88,7 @@ async fn setup_compressed_token_for_decompress( .await .unwrap(); - // Transfer tokens to CToken + // Transfer tokens to Light Token let has_restricted = extensions .iter() .any(|ext| RESTRICTED_EXTENSIONS.contains(ext)); @@ -142,7 +142,7 @@ async fn setup_compressed_token_for_decompress( /// Test that CompressedOnly accounts cannot decompress to SPL Token-2022 accounts. /// -/// Covers spec requirement #13: Can only decompress to CToken, not SPL account +/// Covers spec requirement #13: Can only decompress to Light Token, not SPL account #[tokio::test] #[serial] async fn test_decompress_compressed_only_rejects_spl_destination() { @@ -150,7 +150,7 @@ async fn test_decompress_compressed_only_rejects_spl_destination() { let (mut rpc, payer, mint_pubkey, owner, compressed_account, amount) = setup_compressed_token_for_decompress(&[ExtensionType::Pausable]).await; - // Create SPL Token-2022 account (NOT CToken) as destination + // Create SPL Token-2022 account (NOT Light Token) as destination let spl_destination = create_token_22_account(&mut rpc, &payer, &mint_pubkey, &owner.pubkey()).await; @@ -188,7 +188,7 @@ async fn test_decompress_compressed_only_rejects_spl_destination() { .create_and_send_transaction(&[decompress_ix], &payer.pubkey(), &[&payer, &owner]) .await; - // Should fail because CompressedOnly inputs must decompress to CToken, not SPL + // Should fail because CompressedOnly inputs must decompress to Light Token, not SPL assert_rpc_error(result, 0, COMPRESSED_ONLY_REQUIRES_CTOKEN_DECOMPRESS).unwrap(); } @@ -202,7 +202,7 @@ async fn test_decompress_compressed_only_rejects_partial_decompress() { let (mut rpc, payer, mint_pubkey, owner, compressed_account, amount) = setup_compressed_token_for_decompress(&[ExtensionType::Pausable]).await; - // Create destination CToken account + // Create destination Light Token account let dest_keypair = Keypair::new(); let destination_pubkey = dest_keypair.pubkey(); diff --git a/program-tests/compressed-token-test/tests/compress_only/default_state.rs b/program-tests/compressed-token-test/tests/compress_only/default_state.rs index c3365052f3..3086c388d9 100644 --- a/program-tests/compressed-token-test/tests/compress_only/default_state.rs +++ b/program-tests/compressed-token-test/tests/compress_only/default_state.rs @@ -14,7 +14,7 @@ use serial_test::serial; use solana_sdk::{signature::Keypair, signer::Signer}; use spl_token_2022::extension::ExtensionType; -/// Test creating a CToken account for a mint with DefaultAccountState set to Frozen. +/// Test creating a Light Token account for a mint with DefaultAccountState set to Frozen. /// Verifies that the account is created with state = Frozen (2) at offset 108. #[tokio::test] #[serial] @@ -37,7 +37,7 @@ async fn test_create_ctoken_with_frozen_default_state() { "Mint should have default_account_state_frozen = true" ); - // Create a compressible CToken account for the frozen mint + // Create a compressible Light Token account for the frozen mint let account_keypair = Keypair::new(); let account_pubkey = account_keypair.pubkey(); @@ -67,14 +67,14 @@ async fn test_create_ctoken_with_frozen_default_state() { assert_eq!( account.data.len(), 274, - "CToken account should be 274 bytes" + "Light Token account should be 274 bytes" ); - // Deserialize the CToken account using borsh + // Deserialize the Light Token account using borsh let ctoken = Token::deserialize(&mut &account.data[..]).expect("Failed to deserialize Token account"); - // Build expected CToken account for comparison + // Build expected Light Token account for comparison // Compression fields are now in the Compressible extension let expected_token = Token { mint: mint_pubkey.to_bytes().into(), @@ -92,17 +92,17 @@ async fn test_create_ctoken_with_frozen_default_state() { assert_eq!( ctoken, expected_token, - "CToken account should match expected" + "Light Token account should match expected" ); println!( - "Successfully created frozen CToken account: state={:?}, extensions={}", + "Successfully created frozen Light Token account: state={:?}, extensions={}", ctoken.state, ctoken.extensions.as_ref().map(|e| e.len()).unwrap_or(0) ); } -/// Test creating a CToken account for a mint with DefaultAccountState set to Initialized. +/// Test creating a Light Token account for a mint with DefaultAccountState set to Initialized. /// Verifies that the account is created with state = Initialized (1). #[tokio::test] #[serial] @@ -130,7 +130,7 @@ async fn test_create_ctoken_with_initialized_default_state() { "Mint should have default_account_state_frozen = false" ); - // Create a compressible CToken account + // Create a compressible Light Token account let account_keypair = Keypair::new(); let account_pubkey = account_keypair.pubkey(); @@ -158,11 +158,11 @@ async fn test_create_ctoken_with_initialized_default_state() { // Verify account was created let account = rpc.get_account(account_pubkey).await.unwrap().unwrap(); - // Deserialize the CToken account using borsh + // Deserialize the Light Token account using borsh let ctoken = Token::deserialize(&mut &account.data[..]).expect("Failed to deserialize Token account"); - // Build expected CToken account for comparison + // Build expected Light Token account for comparison // Extensions include Compressible (for compression fields) let expected_token = Token { mint: mint_pubkey.to_bytes().into(), @@ -179,11 +179,11 @@ async fn test_create_ctoken_with_initialized_default_state() { assert_eq!( ctoken, expected_token, - "CToken account should match expected" + "Light Token account should match expected" ); println!( - "Successfully created initialized CToken account: state={:?}", + "Successfully created initialized Light Token account: state={:?}", ctoken.state ); } diff --git a/program-tests/compressed-token-test/tests/compress_only/frozen.rs b/program-tests/compressed-token-test/tests/compress_only/frozen.rs index 1ecdf44d73..edec20cef4 100644 --- a/program-tests/compressed-token-test/tests/compress_only/frozen.rs +++ b/program-tests/compressed-token-test/tests/compress_only/frozen.rs @@ -1,7 +1,7 @@ //! Tests for frozen state preservation during compress/decompress. //! //! This module tests that frozen state is preserved when compressing -//! and decompressing CToken accounts with Token-2022 extensions. +//! and decompressing Light Token accounts with Token-2022 extensions. use serial_test::serial; diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs index 9c1cadf328..c9088e6c38 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs @@ -36,7 +36,7 @@ use super::shared::ExtensionType; /// Expected error code for DecompressDestinationMismatch (owner or ATA mismatch) const DECOMPRESS_DESTINATION_MISMATCH: u32 = 18057; -/// Helper to modify CToken account to have invalid state +/// Helper to modify Light Token account to have invalid state async fn set_invalid_destination_state( rpc: &mut LightProgramTest, account_pubkey: Pubkey, @@ -97,7 +97,7 @@ async fn setup_compressed_token_for_decompress( let mint_amount = 1_000_000_000u64; mint_spl_tokens_22(&mut rpc, &payer, &mint_pubkey, &spl_account, mint_amount).await; - // Create CToken account with compression_only=true + // Create Light Token account with compression_only=true let owner = Keypair::new(); let account_keypair = Keypair::new(); let ctoken_account = account_keypair.pubkey(); @@ -123,7 +123,7 @@ async fn setup_compressed_token_for_decompress( .await .unwrap(); - // Transfer tokens to CToken + // Transfer tokens to Light Token use spl_token_2022::ID as SPL_TOKEN_2022_ID; let has_restricted = extensions .iter() diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs index d95bc53a7c..64124ae36a 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs @@ -3,9 +3,9 @@ //! These tests verify: //! 1. Token pool creation FAILS when extension state is invalid //! 2. Bypass operations SUCCEED even with invalid extension state: -//! - CompressAndClose: CToken → CompressedOnly -//! - Decompress: CompressedOnly → CToken -//! - CToken→SPL: Transfer from CToken to SPL account +//! - CompressAndClose: Light Token → CompressedOnly +//! - Decompress: CompressedOnly → Light Token +//! - Light Token→SPL: Transfer from Light Token to SPL account use anchor_lang::{system_program, InstructionData, ToAccountMetas}; use light_client::indexer::Indexer; @@ -232,12 +232,12 @@ async fn test_transfer_hook_program_not_nil() { // Bypass Tests: Operations that should SUCCEED with invalid extension state // // These tests verify that exiting compressed state bypasses extension checks: -// - CompressAndClose: CToken → CompressedOnly -// - Decompress: CompressedOnly → CToken -// - CToken→SPL: CToken account to SPL account +// - CompressAndClose: Light Token → CompressedOnly +// - Decompress: CompressedOnly → Light Token +// - Light Token→SPL: Light Token account to SPL account // ============================================================================ -/// Helper: Create CToken account with tokens and return context for bypass tests. +/// Helper: Create Light Token account with tokens and return context for bypass tests. /// Uses zero-fee/nil-hook initially, then caller modifies state before testing. async fn setup_ctoken_for_bypass_test( context: &mut ExtensionsTestContext, @@ -258,7 +258,7 @@ async fn setup_ctoken_for_bypass_test( ) .await; - // Create owner and CToken account with 0 prepaid epochs (immediately compressible) + // Create owner and Light Token account with 0 prepaid epochs (immediately compressible) let owner = Keypair::new(); let account_keypair = Keypair::new(); let ctoken_account = account_keypair.pubkey(); @@ -291,7 +291,7 @@ async fn setup_ctoken_for_bypass_test( .await .unwrap(); - // Transfer SPL to CToken using hot path + // Transfer SPL to Light Token using hot path let (spl_interface_pda, spl_interface_pda_bump) = sdk_find_spl_interface_pda(&mint_pubkey, 0, true); @@ -320,10 +320,10 @@ async fn setup_ctoken_for_bypass_test( } // ============================================================================ -// CToken→SPL Bypass Tests +// Light Token→SPL Bypass Tests // ============================================================================ -/// Test that CToken→SPL succeeds even with non-zero transfer fees. +/// Test that Light Token→SPL succeeds even with non-zero transfer fees. /// This is a bypass operation because it's exiting compressed state. #[tokio::test] #[serial] @@ -334,7 +334,7 @@ async fn test_ctoken_to_spl_bypasses_non_zero_fee() { let payer = context.payer.insecure_clone(); let mint_pubkey = context.mint_pubkey; - // Setup CToken with tokens (while extension state is valid) + // Setup Light Token with tokens (while extension state is valid) let (ctoken_account, _spl_source, owner, _) = setup_ctoken_for_bypass_test(&mut context).await; // Create destination SPL account @@ -344,7 +344,7 @@ async fn test_ctoken_to_spl_bypasses_non_zero_fee() { // Set non-zero transfer fees AFTER funding set_mint_transfer_fee(&mut context.rpc, &mint_pubkey, 100, 1000).await; - // CToken→SPL should SUCCEED (bypass) + // Light Token→SPL should SUCCEED (bypass) let (spl_interface_pda, spl_interface_pda_bump) = sdk_find_spl_interface_pda(&mint_pubkey, 0, true); @@ -369,7 +369,7 @@ async fn test_ctoken_to_spl_bypasses_non_zero_fee() { .await .unwrap(); - println!("CToken→SPL bypassed non-zero transfer fee check"); + println!("Light Token→SPL bypassed non-zero transfer fee check"); } // Note: test_ctoken_to_spl_bypasses_non_nil_hook was removed because SPL Token-2022 @@ -392,7 +392,7 @@ async fn test_compress_and_close_bypasses_non_zero_fee() { let mint_pubkey = context.mint_pubkey; let owner = Keypair::new(); - // Setup CToken with tokens + // Setup Light Token with tokens let (ctoken_account, _spl_source, ctoken_owner, _) = setup_ctoken_for_bypass_test(&mut context).await; let _ = owner; // Use the owner from setup @@ -408,7 +408,7 @@ async fn test_compress_and_close_bypasses_non_zero_fee() { let account_after = context.rpc.get_account(ctoken_account).await.unwrap(); assert!( account_after.is_none() || account_after.unwrap().lamports == 0, - "CToken account should be closed after compression" + "Light Token account should be closed after compression" ); // Get compressed accounts and verify @@ -439,7 +439,7 @@ async fn test_compress_and_close_bypasses_non_nil_hook() { .unwrap(); let mint_pubkey = context.mint_pubkey; - // Setup CToken with tokens + // Setup Light Token with tokens let (ctoken_account, _spl_source, owner, _) = setup_ctoken_for_bypass_test(&mut context).await; // Set non-nil transfer hook AFTER funding @@ -453,7 +453,7 @@ async fn test_compress_and_close_bypasses_non_nil_hook() { let account_after = context.rpc.get_account(ctoken_account).await.unwrap(); assert!( account_after.is_none() || account_after.unwrap().lamports == 0, - "CToken account should be closed after compression" + "Light Token account should be closed after compression" ); // Get compressed accounts and verify @@ -489,7 +489,7 @@ async fn test_decompress_bypasses_non_zero_fee() { let payer = context.payer.insecure_clone(); let mint_pubkey = context.mint_pubkey; - // Setup CToken with tokens + // Setup Light Token with tokens let (ctoken_account, _spl_source, owner, _) = setup_ctoken_for_bypass_test(&mut context).await; let mint_amount = 1_000_000_000u64; @@ -513,7 +513,7 @@ async fn test_decompress_bypasses_non_zero_fee() { // Set non-zero transfer fees AFTER compression set_mint_transfer_fee(&mut context.rpc, &mint_pubkey, 100, 1000).await; - // Create destination CToken for decompress + // Create destination Light Token for decompress let dest_keypair = Keypair::new(); let dest_account = dest_keypair.pubkey(); @@ -595,7 +595,7 @@ async fn test_decompress_bypasses_non_nil_hook() { let payer = context.payer.insecure_clone(); let mint_pubkey = context.mint_pubkey; - // Setup CToken with tokens + // Setup Light Token with tokens let (ctoken_account, _spl_source, owner, _) = setup_ctoken_for_bypass_test(&mut context).await; let mint_amount = 1_000_000_000u64; @@ -620,7 +620,7 @@ async fn test_decompress_bypasses_non_nil_hook() { let dummy_hook_program = Pubkey::new_unique(); set_mint_transfer_hook(&mut context.rpc, &mint_pubkey, dummy_hook_program).await; - // Create destination CToken for decompress + // Create destination Light Token for decompress let dest_keypair = Keypair::new(); let dest_account = dest_keypair.pubkey(); diff --git a/program-tests/compressed-token-test/tests/compress_only/mod.rs b/program-tests/compressed-token-test/tests/compress_only/mod.rs index 9b9f69bbc3..4068e66e10 100644 --- a/program-tests/compressed-token-test/tests/compress_only/mod.rs +++ b/program-tests/compressed-token-test/tests/compress_only/mod.rs @@ -62,8 +62,8 @@ pub struct CompressAndCloseTestConfig { pub use_delegate_for_decompress: bool, } -/// Helper to modify CToken account state for testing using set_account -/// Only modifies the SPL token portion (first 165 bytes) - CToken::deserialize reads from there +/// Helper to modify Light Token account state for testing using set_account +/// Only modifies the SPL token portion (first 165 bytes) - Light Token::deserialize reads from there pub async fn set_ctoken_account_state( rpc: &mut LightProgramTest, account_pubkey: Pubkey, @@ -80,7 +80,7 @@ pub async fn set_ctoken_account_state( .ok_or_else(|| RpcError::CustomError("Account not found".to_string()))?; // Update SPL token state (first 165 bytes) - // CToken::deserialize reads delegate/delegated_amount/state from the SPL portion + // Light Token::deserialize reads delegate/delegated_amount/state from the SPL portion let mut spl_account = spl_token_2022::state::Account::unpack_unchecked(&account_info.data[..165]) .map_err(|e| RpcError::CustomError(format!("Failed to unpack SPL account: {:?}", e)))?; @@ -102,7 +102,7 @@ pub async fn set_ctoken_account_state( } /// Helper to set withheld_amount in TransferFeeAccount extension for testing -/// Finds the TransferFeeAccount extension in the CToken and modifies the withheld_amount field +/// Finds the TransferFeeAccount extension in the Light Token and modifies the withheld_amount field pub async fn set_ctoken_withheld_fee( rpc: &mut LightProgramTest, account_pubkey: Pubkey, @@ -192,7 +192,7 @@ pub async fn run_compress_and_close_extension_test( ) .await; - // 2. Create CToken account with 0 prepaid epochs (immediately compressible) + // 2. Create Light Token account with 0 prepaid epochs (immediately compressible) let owner = Keypair::new(); let account_keypair = Keypair::new(); let ctoken_account = account_keypair.pubkey(); @@ -224,7 +224,7 @@ pub async fn run_compress_and_close_extension_test( .create_and_send_transaction(&[create_ix], &payer.pubkey(), &[&payer, &account_keypair]) .await?; - // 3. Transfer tokens to CToken using hot path + // 3. Transfer tokens to Light Token using hot path // Determine if mint has restricted extensions for pool derivation let (spl_interface_pda, spl_interface_pda_bump) = @@ -251,7 +251,7 @@ pub async fn run_compress_and_close_extension_test( .create_and_send_transaction(&[transfer_ix], &payer.pubkey(), &[&payer]) .await?; - // 4. Modify CToken state based on config BEFORE warp + // 4. Modify Light Token state based on config BEFORE warp let delegate_pubkey = config.delegate_config.as_ref().map(|(kp, _)| kp.pubkey()); let delegated_amount = config .delegate_config @@ -277,7 +277,7 @@ pub async fn run_compress_and_close_extension_test( let account_after = context.rpc.get_account(ctoken_account).await?; assert!( account_after.is_none() || account_after.unwrap().lamports == 0, - "CToken account should be closed after compression" + "Light Token account should be closed after compression" ); // 7. Get compressed accounts and verify state @@ -322,7 +322,7 @@ pub async fn run_compress_and_close_extension_test( "Compressed token account should match expected TokenData" ); - // 8. Create destination CToken account for decompress + // 8. Create destination Light Token account for decompress let decompress_dest_keypair = Keypair::new(); let decompress_dest_account = decompress_dest_keypair.pubkey(); @@ -439,7 +439,7 @@ pub async fn run_compress_and_close_extension_test( .create_and_send_transaction(&[decompress_ix], &payer.pubkey(), &signers) .await?; - // 11. Verify decompressed CToken state + // 11. Verify decompressed Light Token state let dest_account_data = context .rpc .get_account(decompress_dest_account) @@ -458,24 +458,24 @@ pub async fn run_compress_and_close_extension_test( assert_eq!( dest_ctoken.state, expected_ctoken_state, - "Decompressed CToken state should match config" + "Decompressed Light Token state should match config" ); assert_eq!( dest_ctoken.delegated_amount, delegated_amount, - "Decompressed CToken delegated_amount should match" + "Decompressed Light Token delegated_amount should match" ); if let Some((delegate_kp, _)) = &config.delegate_config { assert_eq!( dest_ctoken.delegate, Some(delegate_kp.pubkey().to_bytes().into()), - "Decompressed CToken delegate should match" + "Decompressed Light Token delegate should match" ); } else { assert!( dest_ctoken.delegate.is_none(), - "Decompressed CToken should have no delegate" + "Decompressed Light Token should have no delegate" ); } diff --git a/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs b/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs index 598ba020a0..d090ebdbd2 100644 --- a/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs +++ b/program-tests/compressed-token-test/tests/compress_only/restricted_required.rs @@ -1,6 +1,6 @@ //! Tests for compression_only requirement with restricted extensions. //! -//! These tests verify that CToken accounts cannot be created without compression_only +//! These tests verify that Light Token accounts cannot be created without compression_only //! when the mint has restricted extensions (Pausable, PermanentDelegate, TransferFeeConfig, //! TransferHook, DefaultAccountState). @@ -17,7 +17,7 @@ use spl_token_2022::extension::ExtensionType; /// Expected error code for CompressionOnlyRequired const COMPRESSION_ONLY_REQUIRED: u32 = 6131; -/// Helper to test that creating a CToken account without compression_only fails +/// Helper to test that creating a Light Token account without compression_only fails /// when the mint has the specified extensions. async fn test_compression_only_required_for_extensions(extensions: &[ExtensionType]) { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) @@ -30,7 +30,7 @@ async fn test_compression_only_required_for_extensions(extensions: &[ExtensionTy create_mint_22_with_extension_types(&mut rpc, &payer, 9, extensions).await; let mint_pubkey = mint_keypair.pubkey(); - // Try to create CToken account WITHOUT compression_only (should fail) + // Try to create Light Token account WITHOUT compression_only (should fail) let token_account_keypair = Keypair::new(); let token_account_pubkey = token_account_keypair.pubkey(); diff --git a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs index 21b4f005d6..6938de0521 100644 --- a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs +++ b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs @@ -51,7 +51,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError let mint_amount = 1_000_000_000u64; mint_spl_tokens_22(&mut rpc, &payer, &mint_pubkey, &spl_account, mint_amount).await; - // 3. Create CToken account with compression_only + // 3. Create Light Token account with compression_only let owner = Keypair::new(); let account_keypair = Keypair::new(); let ctoken_account = account_keypair.pubkey(); @@ -76,7 +76,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError rpc.create_and_send_transaction(&[create_ix], &payer.pubkey(), &[&payer, &account_keypair]) .await?; - // 4. Transfer tokens to CToken + // 4. Transfer tokens to Light Token let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); // true = restricted let transfer_ix = TransferFromSpl { @@ -105,8 +105,9 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError // Verify the withheld_amount was set correctly let account_before = rpc.get_account(ctoken_account).await?.unwrap(); - let ctoken_before = Token::deserialize(&mut &account_before.data[..]) - .map_err(|e| RpcError::CustomError(format!("Failed to deserialize CToken: {:?}", e)))?; + let ctoken_before = Token::deserialize(&mut &account_before.data[..]).map_err(|e| { + RpcError::CustomError(format!("Failed to deserialize Light Token: {:?}", e)) + })?; let withheld_before = ctoken_before .extensions @@ -131,7 +132,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError let account_after = rpc.get_account(ctoken_account).await?; assert!( account_after.is_none() || account_after.unwrap().lamports == 0, - "CToken account should be closed after compression" + "Light Token account should be closed after compression" ); // 8. Get compressed account and verify withheld_transfer_fee in CompressedOnly extension @@ -169,7 +170,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError "Compressed token should have withheld_transfer_fee preserved" ); - // 9. Create destination CToken for decompress + // 9. Create destination Light Token for decompress let decompress_dest_keypair = Keypair::new(); let decompress_dest_account = decompress_dest_keypair.pubkey(); @@ -236,14 +237,15 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError rpc.create_and_send_transaction(&[decompress_ix], &payer.pubkey(), &[&payer, &owner]) .await?; - // 11. Verify decompressed CToken has withheld_amount restored + // 11. Verify decompressed Light Token has withheld_amount restored let dest_account_data = rpc .get_account(decompress_dest_account) .await? .ok_or_else(|| RpcError::CustomError("Dest account not found".to_string()))?; - let dest_ctoken = Token::deserialize(&mut &dest_account_data.data[..]) - .map_err(|e| RpcError::CustomError(format!("Failed to deserialize CToken: {:?}", e)))?; + let dest_ctoken = Token::deserialize(&mut &dest_account_data.data[..]).map_err(|e| { + RpcError::CustomError(format!("Failed to deserialize Light Token: {:?}", e)) + })?; let withheld_after = dest_ctoken .extensions diff --git a/program-tests/compressed-token-test/tests/ctoken.rs b/program-tests/compressed-token-test/tests/ctoken.rs deleted file mode 100644 index 8f377ed5aa..0000000000 --- a/program-tests/compressed-token-test/tests/ctoken.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Integration tests for compressed token account operations -// This file serves as the entry point for the ctoken test module - -// Declare submodules from the ctoken/ directory -#[path = "ctoken/shared.rs"] -mod shared; - -#[path = "ctoken/create.rs"] -mod create; - -#[path = "ctoken/transfer.rs"] -mod transfer; - -#[path = "ctoken/functional_ata.rs"] -mod functional_ata; - -#[path = "ctoken/functional.rs"] -mod functional; - -#[path = "ctoken/compress_and_close.rs"] -mod compress_and_close; - -#[path = "ctoken/close.rs"] -mod close; - -#[path = "ctoken/create_ata.rs"] -mod create_ata; - -#[path = "ctoken/create_ata2.rs"] -mod create_ata2; - -#[path = "ctoken/spl_instruction_compat.rs"] -mod spl_instruction_compat; - -#[path = "ctoken/extensions.rs"] -mod extensions; - -#[path = "ctoken/transfer_checked.rs"] -mod transfer_checked; - -#[path = "ctoken/freeze_thaw.rs"] -mod freeze_thaw; - -#[path = "ctoken/approve_revoke.rs"] -mod approve_revoke; - -#[path = "ctoken/burn.rs"] -mod burn; - -#[path = "ctoken/extensions_failing.rs"] -mod extensions_failing; diff --git a/program-tests/compressed-token-test/tests/freeze/compress_only.rs b/program-tests/compressed-token-test/tests/freeze/compress_only.rs index e7085f9efb..f290705afc 100644 --- a/program-tests/compressed-token-test/tests/freeze/compress_only.rs +++ b/program-tests/compressed-token-test/tests/freeze/compress_only.rs @@ -145,7 +145,7 @@ async fn freeze_or_thaw_compressed( /// /// Flow: /// 1. Create mint with restricted extensions -/// 2. Create compress-only CToken account +/// 2. Create compress-only Light Token account /// 3. Transfer tokens to it /// 4. Warp epoch to compress (compress and close) /// 5. Freeze the compressed token account @@ -179,7 +179,7 @@ async fn run_freeze_thaw_compressed_only_test( ) .await; - // 2. Create CToken account with 0 prepaid epochs (immediately compressible) + // 2. Create Light Token account with 0 prepaid epochs (immediately compressible) let owner = Keypair::new(); let account_keypair = Keypair::new(); let ctoken_account = account_keypair.pubkey(); @@ -211,7 +211,7 @@ async fn run_freeze_thaw_compressed_only_test( .create_and_send_transaction(&[create_ix], &payer.pubkey(), &[&payer, &account_keypair]) .await?; - // 3. Transfer tokens to CToken using hot path + // 3. Transfer tokens to Light Token using hot path let has_restricted = extensions .iter() .any(|ext| RESTRICTED_EXTENSIONS.contains(ext)); @@ -246,7 +246,7 @@ async fn run_freeze_thaw_compressed_only_test( let account_after = context.rpc.get_account(ctoken_account).await?; assert!( account_after.is_none() || account_after.unwrap().lamports == 0, - "CToken account should be closed after compression" + "Light Token account should be closed after compression" ); // 6. Get compressed accounts and verify state @@ -329,7 +329,7 @@ async fn run_freeze_thaw_compressed_only_test( "Token account should be thawed (Initialized)" ); - // 11. Create destination CToken account for decompress + // 11. Create destination Light Token account for decompress let dest_account_keypair = Keypair::new(); let create_dest_ix = CreateTokenAccount::new( payer.pubkey(), @@ -379,7 +379,7 @@ async fn run_freeze_thaw_compressed_only_test( }, )]]; - // 13. Decompress to CToken account + // 13. Decompress to Light Token account let compressed_account: CompressedTokenAccount = thawed_accounts[0].clone().try_into().unwrap(); let decompress_ix = create_generic_transfer2_instruction( &mut context.rpc, diff --git a/program-tests/compressed-token-test/tests/light_token.rs b/program-tests/compressed-token-test/tests/light_token.rs new file mode 100644 index 0000000000..678ee70d04 --- /dev/null +++ b/program-tests/compressed-token-test/tests/light_token.rs @@ -0,0 +1,51 @@ +// Integration tests for compressed token account operations +// This file serves as the entry point for the light_token test module + +// Declare submodules from the light_token/ directory +#[path = "light_token/shared.rs"] +mod shared; + +#[path = "light_token/create.rs"] +mod create; + +#[path = "light_token/transfer.rs"] +mod transfer; + +#[path = "light_token/functional_ata.rs"] +mod functional_ata; + +#[path = "light_token/functional.rs"] +mod functional; + +#[path = "light_token/compress_and_close.rs"] +mod compress_and_close; + +#[path = "light_token/close.rs"] +mod close; + +#[path = "light_token/create_ata.rs"] +mod create_ata; + +#[path = "light_token/create_ata2.rs"] +mod create_ata2; + +#[path = "light_token/spl_instruction_compat.rs"] +mod spl_instruction_compat; + +#[path = "light_token/extensions.rs"] +mod extensions; + +#[path = "light_token/transfer_checked.rs"] +mod transfer_checked; + +#[path = "light_token/freeze_thaw.rs"] +mod freeze_thaw; + +#[path = "light_token/approve_revoke.rs"] +mod approve_revoke; + +#[path = "light_token/burn.rs"] +mod burn; + +#[path = "light_token/extensions_failing.rs"] +mod extensions_failing; diff --git a/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs b/program-tests/compressed-token-test/tests/light_token/approve_revoke.rs similarity index 95% rename from program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs rename to program-tests/compressed-token-test/tests/light_token/approve_revoke.rs index ae1e2e6752..b0c1ffc04e 100644 --- a/program-tests/compressed-token-test/tests/ctoken/approve_revoke.rs +++ b/program-tests/compressed-token-test/tests/light_token/approve_revoke.rs @@ -1,4 +1,4 @@ -//! Approve and Revoke instruction tests for CToken accounts. +//! Approve and Revoke instruction tests for Light Token accounts. //! //! ## Test Matrix //! @@ -23,7 +23,7 @@ use super::shared::*; #[tokio::test] #[serial] async fn test_approve_success_cases() { - // Test 1: SPL compat (uses SPL instruction format with modifications for CToken) + // Test 1: SPL compat (uses SPL instruction format with modifications for Light Token) { let mut context = setup_account_test_with_created_account(Some((0, false))) .await @@ -88,7 +88,7 @@ async fn test_approve_fails() { .await; } - // Test 2: Invalid account - wrong program owner (valid CToken data but wrong owner) + // Test 2: Invalid account - wrong program owner (valid Light Token data but wrong owner) { use anchor_spl::token::spl_token; use light_program_test::program_test::TestRpc; @@ -104,7 +104,7 @@ async fn test_approve_fails() { .await .unwrap(); - // Get the valid CToken account data + // Get the valid Light Token account data let valid_account = context .rpc .get_account(context.token_account_keypair.pubkey()) @@ -176,7 +176,7 @@ async fn test_approve_fails() { #[tokio::test] #[serial] async fn test_revoke_success_cases() { - // Test 1: SPL compat (uses SPL instruction format with modifications for CToken) + // Test 1: SPL compat (uses SPL instruction format with modifications for Light Token) { let mut context = setup_account_test_with_created_account(Some((0, false))) .await @@ -258,7 +258,7 @@ async fn test_revoke_fails() { .await; } - // Test 2: Invalid account - wrong program owner (valid CToken data but wrong owner) + // Test 2: Invalid account - wrong program owner (valid Light Token data but wrong owner) { use anchor_spl::token::spl_token; use light_program_test::program_test::TestRpc; @@ -274,7 +274,7 @@ async fn test_revoke_fails() { .await .unwrap(); - // Get the valid CToken account data + // Get the valid Light Token account data let valid_account = context .rpc .get_account(context.token_account_keypair.pubkey()) @@ -348,8 +348,8 @@ use solana_sdk::program_pack::Pack; use super::extensions::setup_extensions_test; -/// Test approve and revoke with a compressible CToken account with extensions. -/// 1. Create compressible CToken account with all extensions +/// Test approve and revoke with a compressible Light Token account with extensions. +/// 1. Create compressible Light Token account with all extensions /// 2. Set token balance to 100 using set_account /// 3. Approve 10 tokens to delegate /// 4. Assert delegate and delegated_amount fields @@ -366,7 +366,7 @@ async fn test_approve_revoke_compressible() -> Result<(), RpcError> { let owner = Keypair::new(); let delegate = Keypair::new(); - // 1. Create compressible CToken account with all extensions + // 1. Create compressible Light Token account with all extensions let account_keypair = Keypair::new(); let account_pubkey = account_keypair.pubkey(); @@ -418,7 +418,7 @@ async fn test_approve_revoke_compressible() -> Result<(), RpcError> { // Verify initial state let account_data_initial = context.rpc.get_account(account_pubkey).await?.unwrap(); let ctoken_initial = Token::deserialize(&mut &account_data_initial.data[..]) - .expect("Failed to deserialize CToken"); + .expect("Failed to deserialize Light Token"); assert_eq!(ctoken_initial.amount, token_balance); assert!(ctoken_initial.delegate.is_none()); assert_eq!(ctoken_initial.delegated_amount, 0); @@ -472,6 +472,6 @@ async fn test_approve_revoke_compressible() -> Result<(), RpcError> { // 6. Assert delegate cleared and delegated_amount is 0 after revoke assert_ctoken_revoke(&mut context.rpc, account_pubkey).await; - println!("Successfully tested approve and revoke with compressible CToken"); + println!("Successfully tested approve and revoke with compressible Light Token"); Ok(()) } diff --git a/program-tests/compressed-token-test/tests/ctoken/burn.rs b/program-tests/compressed-token-test/tests/light_token/burn.rs similarity index 95% rename from program-tests/compressed-token-test/tests/ctoken/burn.rs rename to program-tests/compressed-token-test/tests/light_token/burn.rs index 041ffa6d66..94a82715fa 100644 --- a/program-tests/compressed-token-test/tests/ctoken/burn.rs +++ b/program-tests/compressed-token-test/tests/light_token/burn.rs @@ -1,4 +1,4 @@ -//! Burn instruction tests for CToken accounts. +//! Burn instruction tests for Light Token accounts. //! //! ## Test Matrix //! @@ -13,7 +13,7 @@ //! | Wrong authority | test_burn_fails | //! //! **Note**: Burn requires a real CMint account (owned by ctoken program) for supply tracking. -//! This is different from approve/revoke which only modify the CToken account. +//! This is different from approve/revoke which only modify the Light Token account. //! //! **Note**: Max top-up exceeded test requires compressible accounts with time warp. //! For comprehensive max_top_up testing, see sdk-tests/sdk-light-token-test/tests/test_burn.rs @@ -23,7 +23,7 @@ use light_program_test::{ use light_test_utils::assert_ctoken_burn::assert_ctoken_burn; use light_token_client::instructions::mint_action::DecompressMintParams; use light_token_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, + compressed_token::create_compressed_mint::find_mint_address, token::{derive_token_ata, Burn, CreateAssociatedTokenAccount, MintTo}, }; @@ -120,7 +120,7 @@ async fn test_burn_fails() { // Create a different CMint let other_mint_seed = Keypair::new(); - let (other_cmint_pda, _) = find_cmint_address(&other_mint_seed.pubkey()); + let (other_cmint_pda, _) = find_mint_address(&other_mint_seed.pubkey()); // Try to burn with wrong mint let burn_ix = Burn { @@ -172,7 +172,7 @@ async fn test_burn_fails() { ) .await; - // Non-existent CToken account returns NotRentExempt (SPL Token code 0 -> 6153) + // Non-existent Light Token account returns NotRentExempt (SPL Token code 0 -> 6153) assert_rpc_error(result, 0, 6153).unwrap(); println!("test_burn_fails: non-existent account passed"); } @@ -183,7 +183,7 @@ async fn test_burn_fails() { let mut ctx = setup_burn_test().await; - // Get the valid CToken account data + // Get the valid Light Token account data let valid_account = ctx .rpc .get_account(ctx.ctoken_account) @@ -308,12 +308,12 @@ struct BurnTestContext { owner_keypair: Keypair, } -/// Setup: Create CMint + CToken with 100 tokens +/// Setup: Create CMint + Light Token with 100 tokens /// /// Steps: /// 1. Init LightProgramTest /// 2. Create compressed mint + CMint via mint_action_comprehensive -/// 3. Create CToken ATA +/// 3. Create Light Token ATA /// 4. Mint 100 tokens async fn setup_burn_test() -> BurnTestContext { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) @@ -326,9 +326,9 @@ async fn setup_burn_test() -> BurnTestContext { let owner_keypair = Keypair::new(); // Derive CMint PDA - let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (cmint_pda, _) = find_mint_address(&mint_seed.pubkey()); - // Step 1: Create CToken ATA for owner + // Step 1: Create Light Token ATA for owner let (ctoken_ata, _) = derive_token_ata(&owner_keypair.pubkey(), &cmint_pda); let create_ata_ix = @@ -364,7 +364,7 @@ async fn setup_burn_test() -> BurnTestContext { .await .unwrap(); - // Step 3: Mint 100 tokens to the CToken account + // Step 3: Mint 100 tokens to the Light Token account let mint_ix = MintTo { cmint: cmint_pda, destination: ctoken_ata, diff --git a/program-tests/compressed-token-test/tests/ctoken/close.rs b/program-tests/compressed-token-test/tests/light_token/close.rs similarity index 100% rename from program-tests/compressed-token-test/tests/ctoken/close.rs rename to program-tests/compressed-token-test/tests/light_token/close.rs diff --git a/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs b/program-tests/compressed-token-test/tests/light_token/compress_and_close.rs similarity index 99% rename from program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs rename to program-tests/compressed-token-test/tests/light_token/compress_and_close.rs index 1dbb017dd0..6451153751 100644 --- a/program-tests/compressed-token-test/tests/ctoken/compress_and_close.rs +++ b/program-tests/compressed-token-test/tests/light_token/compress_and_close.rs @@ -445,14 +445,14 @@ async fn test_compress_and_close_compress_to_pubkey() { use light_token_interface::state::token::Token; - // Parse the CToken account + // Parse the Light Token account let (mut ctoken, _) = Token::zero_copy_at_mut(&mut token_account.data) .expect("Failed to deserialize ctoken account"); // Modify compress_to_pubkey in the Compressible extension let compressible = ctoken .get_compressible_extension_mut() - .expect("CToken should have Compressible extension"); + .expect("Light Token should have Compressible extension"); compressible.info.compress_to_pubkey = 1; // Write the modified account back @@ -795,14 +795,14 @@ async fn test_compress_and_close_output_validation_errors() { use light_token_interface::state::token::Token; - // Parse and modify the CToken account + // Parse and modify the Light Token account let (mut ctoken, _) = Token::zero_copy_at_mut(&mut token_account.data) .expect("Failed to deserialize ctoken account"); // Set compress_to_pubkey=true in the Compressible extension let compressible = ctoken .get_compressible_extension_mut() - .expect("CToken should have Compressible extension"); + .expect("Light Token should have Compressible extension"); compressible.info.compress_to_pubkey = 1; // Write the modified account back diff --git a/program-tests/compressed-token-test/tests/ctoken/create.rs b/program-tests/compressed-token-test/tests/light_token/create.rs similarity index 99% rename from program-tests/compressed-token-test/tests/ctoken/create.rs rename to program-tests/compressed-token-test/tests/light_token/create.rs index b70bdbafb5..85e8773386 100644 --- a/program-tests/compressed-token-test/tests/ctoken/create.rs +++ b/program-tests/compressed-token-test/tests/light_token/create.rs @@ -617,7 +617,7 @@ async fn test_create_compressible_token_account_failing() { create_token_22_account(&mut context.rpc, &context.payer, &real_mint, &payer_pubkey) .await; - // Try to create CToken with the token account as mint (should fail) + // Try to create Light Token with the token account as mint (should fail) let compressible_params = CompressibleParams { compressible_config: context.compressible_config, rent_sponsor: context.rent_sponsor, diff --git a/program-tests/compressed-token-test/tests/ctoken/create_ata.rs b/program-tests/compressed-token-test/tests/light_token/create_ata.rs similarity index 99% rename from program-tests/compressed-token-test/tests/ctoken/create_ata.rs rename to program-tests/compressed-token-test/tests/light_token/create_ata.rs index adaac35556..78db3428d3 100644 --- a/program-tests/compressed-token-test/tests/ctoken/create_ata.rs +++ b/program-tests/compressed-token-test/tests/light_token/create_ata.rs @@ -263,7 +263,7 @@ async fn test_create_ata_idempotent() { } /// Tests creation of an ATA with 0 prepaid epochs (immediately compressible). -/// All CToken accounts now have compression infrastructure, so we pass +/// All Light Token accounts now have compression infrastructure, so we pass /// CompressibleData with num_prepaid_epochs: 0. #[tokio::test] async fn test_create_non_compressible_ata() { diff --git a/program-tests/compressed-token-test/tests/ctoken/create_ata2.rs b/program-tests/compressed-token-test/tests/light_token/create_ata2.rs similarity index 100% rename from program-tests/compressed-token-test/tests/ctoken/create_ata2.rs rename to program-tests/compressed-token-test/tests/light_token/create_ata2.rs diff --git a/program-tests/compressed-token-test/tests/ctoken/extensions.rs b/program-tests/compressed-token-test/tests/light_token/extensions.rs similarity index 94% rename from program-tests/compressed-token-test/tests/ctoken/extensions.rs rename to program-tests/compressed-token-test/tests/light_token/extensions.rs index 72b6a8a053..8283bd394c 100644 --- a/program-tests/compressed-token-test/tests/ctoken/extensions.rs +++ b/program-tests/compressed-token-test/tests/light_token/extensions.rs @@ -74,7 +74,7 @@ async fn test_setup_mint_22_with_all_extensions() { ); } -/// Test minting SPL tokens and transferring to CToken using hot path with a Token 2022 mint with all extensions. +/// Test minting SPL tokens and transferring to Light Token using hot path with a Token 2022 mint with all extensions. /// Mints with restricted extensions (Pausable, PermanentDelegate, TransferFee, TransferHook) require hot path. #[tokio::test] #[serial] @@ -108,7 +108,7 @@ async fn test_mint_and_compress_with_extensions() { println!("Minted {} tokens to {}", mint_amount, spl_account); - // 3. Create CToken account with extensions (destination for hot path transfer) + // 3. Create Light Token account with extensions (destination for hot path transfer) let owner = Keypair::new(); let account_keypair = Keypair::new(); let create_ix = CreateTokenAccount::new( @@ -142,9 +142,9 @@ async fn test_mint_and_compress_with_extensions() { .await .unwrap(); - println!("Created CToken account: {}", account_keypair.pubkey()); + println!("Created Light Token account: {}", account_keypair.pubkey()); - // 4. Transfer SPL to CToken using hot path (compress + decompress in same tx) + // 4. Transfer SPL to Light Token using hot path (compress + decompress in same tx) let transfer_amount = 500_000_000u64; // Transfer half // Use restricted=true because this mint has restricted extensions (PermanentDelegate, etc.) let (spl_interface_pda, spl_interface_pda_bump) = @@ -170,7 +170,7 @@ async fn test_mint_and_compress_with_extensions() { .await .unwrap(); - // Verify CToken account has the tokens + // Verify Light Token account has the tokens let ctoken_account_data = context .rpc .get_account(account_keypair.pubkey()) @@ -184,17 +184,17 @@ async fn test_mint_and_compress_with_extensions() { assert_eq!( u64::from(ctoken_account.amount), transfer_amount, - "CToken account should have {} tokens", + "Light Token account should have {} tokens", transfer_amount ); println!( - "Successfully transferred {} tokens from SPL to CToken using hot path", + "Successfully transferred {} tokens from SPL to Light Token using hot path", transfer_amount ); } -/// Test creating a CToken account for a Token-2022 mint with permanent delegate extension +/// Test creating a Light Token account for a Token-2022 mint with permanent delegate extension /// Verifies that the account gets all extensions: compressible, pausable, permanent_delegate, transfer_fee, transfer_hook #[tokio::test] #[serial] @@ -209,7 +209,7 @@ async fn test_create_ctoken_with_extensions() { let payer = context.payer.insecure_clone(); let mint_pubkey = context.mint_pubkey; - // Create a compressible CToken account for the Token-2022 mint + // Create a compressible Light Token account for the Token-2022 mint let account_keypair = Keypair::new(); let account_pubkey = account_keypair.pubkey(); @@ -275,10 +275,10 @@ async fn test_create_ctoken_with_extensions() { ) .await; - println!("Successfully created CToken account with all extensions from Token-2022 mint"); + println!("Successfully created Light Token account with all extensions from Token-2022 mint"); } -/// Test complete flow: Create Token-2022 mint -> SPL account -> Mint -> Create CToken accounts -> Transfer SPL to CToken (hot path) -> Transfer with permanent delegate +/// Test complete flow: Create Token-2022 mint -> SPL account -> Mint -> Create Light Token accounts -> Transfer SPL to Light Token (hot path) -> Transfer with permanent delegate #[tokio::test] #[serial] async fn test_transfer_with_permanent_delegate() { @@ -310,7 +310,7 @@ async fn test_transfer_with_permanent_delegate() { ) .await; - // Step 2: Create two compressible CToken accounts (A and B) - must be created before transfer + // Step 2: Create two compressible Light Token accounts (A and B) - must be created before transfer let owner = Keypair::new(); let account_a_keypair = Keypair::new(); let account_a_pubkey = account_a_keypair.pubkey(); @@ -390,7 +390,7 @@ async fn test_transfer_with_permanent_delegate() { .await .unwrap(); - // Step 3: Transfer SPL to CToken account A using hot path (compress + decompress in same tx) + // Step 3: Transfer SPL to Light Token account A using hot path (compress + decompress in same tx) let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); @@ -477,7 +477,7 @@ async fn test_transfer_with_permanent_delegate() { // test_create_ctoken_with_frozen_default_state moved to compress_only/default_state.rs /// Test complete flow with owner as transfer authority: -/// Create mint -> Create CToken accounts -> Transfer SPL to CToken (hot path) -> Transfer using owner +/// Create mint -> Create Light Token accounts -> Transfer SPL to Light Token (hot path) -> Transfer using owner /// Verifies that transfer works with owner authority and all extensions are preserved #[tokio::test] #[serial] @@ -510,7 +510,7 @@ async fn test_transfer_with_owner_authority() { ) .await; - // Step 2: Create two compressible CToken accounts (A and B) with all extensions + // Step 2: Create two compressible Light Token accounts (A and B) with all extensions let owner = Keypair::new(); context .rpc @@ -618,7 +618,7 @@ async fn test_transfer_with_owner_authority() { "Account B should be larger than base size due to extensions" ); - // Step 3: Transfer SPL to CToken account A using hot path (compress + decompress in same tx) + // Step 3: Transfer SPL to Light Token account A using hot path (compress + decompress in same tx) let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); diff --git a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs b/program-tests/compressed-token-test/tests/light_token/extensions_failing.rs similarity index 90% rename from program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs rename to program-tests/compressed-token-test/tests/light_token/extensions_failing.rs index 2a51416573..49c0082675 100644 --- a/program-tests/compressed-token-test/tests/ctoken/extensions_failing.rs +++ b/program-tests/compressed-token-test/tests/light_token/extensions_failing.rs @@ -1,10 +1,10 @@ -//! Tests for extension validation failures in CToken operations. +//! Tests for extension validation failures in Light Token operations. //! //! This module tests extension validation for operations that FAIL with invalid state: -//! 1. CTokenTransfer(Checked) - transfers between CToken accounts -//! 2. SPL → CToken (TransferFromSpl) - entering via Compress mode +//! 1. CTokenTransfer(Checked) - transfers between Light Token accounts +//! 2. SPL → Light Token (TransferFromSpl) - entering via Compress mode //! -//! Note: CToken → SPL (TransferTokenToSpl) is a BYPASS operation and is tested +//! Note: Light Token → SPL (TransferTokenToSpl) is a BYPASS operation and is tested //! in compress_only/invalid_extension_state.rs. It succeeds with invalid extension //! state because it exits compressed state without creating new compressed accounts. @@ -35,7 +35,7 @@ const NON_ZERO_TRANSFER_FEE_NOT_SUPPORTED: u32 = 6129; /// Expected error code for TransferHookNotSupported const TRANSFER_HOOK_NOT_SUPPORTED: u32 = 6130; -/// Set up two CToken accounts with tokens for transfer testing. +/// Set up two Light Token accounts with tokens for transfer testing. /// Returns (source_account, destination_account, owner) async fn setup_ctoken_accounts_for_transfer( context: &mut ExtensionsTestContext, @@ -57,10 +57,10 @@ async fn setup_ctoken_accounts_for_transfer( ) .await; - // Create owner and CToken accounts + // Create owner and Light Token accounts let owner = Keypair::new(); - // Create source CToken account + // Create source Light Token account let account_a_keypair = Keypair::new(); let account_a_pubkey = account_a_keypair.pubkey(); let create_a_ix = CreateTokenAccount::new( @@ -99,7 +99,7 @@ async fn setup_ctoken_accounts_for_transfer( .await .unwrap(); - // Create destination CToken account + // Create destination Light Token account let account_b_keypair = Keypair::new(); let account_b_pubkey = account_b_keypair.pubkey(); let create_b_ix = CreateTokenAccount::new( @@ -138,7 +138,7 @@ async fn setup_ctoken_accounts_for_transfer( .await .unwrap(); - // Transfer SPL to source CToken account using hot path + // Transfer SPL to source Light Token account using hot path let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); @@ -170,7 +170,7 @@ async fn setup_ctoken_accounts_for_transfer( /// /// Setup: /// 1. Create mint with Pausable extension (not paused initially) -/// 2. Create token pool, two CToken accounts with tokens +/// 2. Create token pool, two Light Token accounts with tokens /// 3. Pause the mint via set_account /// 4. Attempt CTokenTransferChecked /// @@ -217,7 +217,7 @@ async fn test_ctoken_transfer_fails_when_mint_paused() { /// /// Setup: /// 1. Create mint with TransferFeeConfig (zero fees initially) -/// 2. Create token pool, two CToken accounts with tokens +/// 2. Create token pool, two Light Token accounts with tokens /// 3. Modify mint TransferFeeConfig to have non-zero fees /// 4. Attempt CTokenTransferChecked /// @@ -264,7 +264,7 @@ async fn test_ctoken_transfer_fails_with_non_zero_transfer_fee() { /// /// Setup: /// 1. Create mint with TransferHook (nil program initially) -/// 2. Create token pool, two CToken accounts with tokens +/// 2. Create token pool, two Light Token accounts with tokens /// 3. Modify mint TransferHook to have non-nil program_id /// 4. Attempt CTokenTransferChecked /// @@ -309,11 +309,11 @@ async fn test_ctoken_transfer_fails_with_non_nil_transfer_hook() { } // ============================================================================ -// SPL → CToken Transfer Tests (TransferFromSpl) +// SPL → Light Token Transfer Tests (TransferFromSpl) // These should FAIL when extension state is invalid (entering compressed state) // ============================================================================ -/// Set up SPL account with tokens and empty CToken account for SPL→CToken testing. +/// Set up SPL account with tokens and empty Light Token account for SPL→Light Token testing. /// Returns (spl_account, ctoken_account, owner) async fn setup_spl_to_ctoken_accounts( context: &mut ExtensionsTestContext, @@ -335,7 +335,7 @@ async fn setup_spl_to_ctoken_accounts( ) .await; - // Create CToken account (destination) + // Create Light Token account (destination) let owner = Keypair::new(); let ctoken_keypair = Keypair::new(); let ctoken_pubkey = ctoken_keypair.pubkey(); @@ -370,9 +370,9 @@ async fn setup_spl_to_ctoken_accounts( (spl_account, ctoken_pubkey, owner) } -/// Test that SPL→CToken transfer fails when the mint is paused. +/// Test that SPL→Light Token transfer fails when the mint is paused. /// -/// SPL→CToken uses Compress mode which enforces extension state checks. +/// SPL→Light Token uses Compress mode which enforces extension state checks. #[tokio::test] #[serial] async fn test_spl_to_ctoken_fails_when_mint_paused() { @@ -386,7 +386,7 @@ async fn test_spl_to_ctoken_fails_when_mint_paused() { // Pause the mint pause_mint(&mut context.rpc, &mint_pubkey).await; - // Attempt SPL→CToken transfer - should fail with MintPaused + // Attempt SPL→Light Token transfer - should fail with MintPaused let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); @@ -411,10 +411,10 @@ async fn test_spl_to_ctoken_fails_when_mint_paused() { .await; // fails because of token 2022 check Transferring, minting, and burning is paused on this mint assert_rpc_error(result, 0, 67).unwrap(); - println!("Correctly rejected SPL→CToken when mint is paused"); + println!("Correctly rejected SPL→Light Token when mint is paused"); } -/// Test that SPL→CToken transfer fails when the mint has non-zero transfer fees. +/// Test that SPL→Light Token transfer fails when the mint has non-zero transfer fees. #[tokio::test] #[serial] async fn test_spl_to_ctoken_fails_with_non_zero_transfer_fee() { @@ -428,7 +428,7 @@ async fn test_spl_to_ctoken_fails_with_non_zero_transfer_fee() { // Set non-zero transfer fees set_mint_transfer_fee(&mut context.rpc, &mint_pubkey, 100, 1000).await; - // Attempt SPL→CToken transfer - should fail + // Attempt SPL→Light Token transfer - should fail let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); @@ -452,5 +452,5 @@ async fn test_spl_to_ctoken_fails_with_non_zero_transfer_fee() { .create_and_send_transaction(&[transfer_ix], &payer.pubkey(), &[&payer]) .await .unwrap(); - println!("Correctly rejected SPL→CToken with non-zero transfer fees"); + println!("Correctly rejected SPL→Light Token with non-zero transfer fees"); } diff --git a/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs b/program-tests/compressed-token-test/tests/light_token/freeze_thaw.rs similarity index 94% rename from program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs rename to program-tests/compressed-token-test/tests/light_token/freeze_thaw.rs index 8c5a46b848..777b1ab08c 100644 --- a/program-tests/compressed-token-test/tests/ctoken/freeze_thaw.rs +++ b/program-tests/compressed-token-test/tests/light_token/freeze_thaw.rs @@ -1,4 +1,4 @@ -//! Tests for CToken freeze and thaw instructions +//! Tests for Light Token freeze and thaw instructions //! //! These tests verify that freeze and thaw instructions work correctly //! for both basic mints and Token-2022 mints with extensions. @@ -29,7 +29,7 @@ async fn test_freeze_thaw_with_basic_mint() -> Result<(), RpcError> { // 1. Create SPL Token mint with freeze_authority = payer let mint_pubkey = create_mint_helper(&mut rpc, &payer).await; - // 2. Create CToken account with 0 prepaid epochs (immediately compressible) + // 2. Create Light Token account with 0 prepaid epochs (immediately compressible) let token_account_keypair = Keypair::new(); let token_account_pubkey = token_account_keypair.pubkey(); @@ -66,7 +66,7 @@ async fn test_freeze_thaw_with_basic_mint() -> Result<(), RpcError> { // Verify initial state is Initialized let account_data = rpc.get_account(token_account_pubkey).await?.unwrap(); let ctoken_before = - Token::deserialize(&mut &account_data.data[..]).expect("Failed to deserialize CToken"); + Token::deserialize(&mut &account_data.data[..]).expect("Failed to deserialize Light Token"); assert_eq!( ctoken_before.state, AccountState::Initialized, @@ -117,7 +117,7 @@ async fn test_freeze_thaw_with_extensions() -> Result<(), RpcError> { let mint_pubkey = context.mint_pubkey; let owner = Keypair::new(); - // 1. Create compressible CToken account with all extensions + // 1. Create compressible Light Token account with all extensions let account_keypair = Keypair::new(); let account_pubkey = account_keypair.pubkey(); @@ -157,12 +157,12 @@ async fn test_freeze_thaw_with_extensions() -> Result<(), RpcError> { // The exact size depends on the extensions present. Just verify it's larger than base. assert!( account_data_initial.data.len() > 165, - "CToken account should be larger than base size due to extensions" + "Light Token account should be larger than base size due to extensions" ); // Deserialize and verify initial state let ctoken_initial = Token::deserialize(&mut &account_data_initial.data[..]) - .expect("Failed to deserialize CToken"); + .expect("Failed to deserialize Light Token"); assert_eq!( ctoken_initial.state, AccountState::Initialized, diff --git a/program-tests/compressed-token-test/tests/ctoken/functional.rs b/program-tests/compressed-token-test/tests/light_token/functional.rs similarity index 98% rename from program-tests/compressed-token-test/tests/ctoken/functional.rs rename to program-tests/compressed-token-test/tests/light_token/functional.rs index 281634291d..8c6fdbc209 100644 --- a/program-tests/compressed-token-test/tests/ctoken/functional.rs +++ b/program-tests/compressed-token-test/tests/light_token/functional.rs @@ -1,6 +1,6 @@ use super::shared::*; /// Test: -/// 1. SUCCESS: Create CToken account with 0 prepaid epochs (immediately compressible) +/// 1. SUCCESS: Create Light Token account with 0 prepaid epochs (immediately compressible) /// 2. SUCCESS: Verify account structure and ownership using existing assertion helpers /// 3. SUCCESS: Close account transferring lamports to destination /// 4. SUCCESS: Verify account closure and lamport transfer using existing assertion helpers @@ -11,7 +11,7 @@ async fn test_spl_sdk_compatible_account_lifecycle() -> Result<(), RpcError> { let payer_pubkey = context.payer.pubkey(); let token_account_pubkey = context.token_account_keypair.pubkey(); - // Create CToken account with 0 prepaid epochs (immediately compressible) + // Create Light Token account with 0 prepaid epochs (immediately compressible) let compressible_params = CompressibleParams { compressible_config: context.compressible_config, rent_sponsor: context.rent_sponsor, diff --git a/program-tests/compressed-token-test/tests/ctoken/functional_ata.rs b/program-tests/compressed-token-test/tests/light_token/functional_ata.rs similarity index 100% rename from program-tests/compressed-token-test/tests/ctoken/functional_ata.rs rename to program-tests/compressed-token-test/tests/light_token/functional_ata.rs diff --git a/program-tests/compressed-token-test/tests/ctoken/shared.rs b/program-tests/compressed-token-test/tests/light_token/shared.rs similarity index 99% rename from program-tests/compressed-token-test/tests/ctoken/shared.rs rename to program-tests/compressed-token-test/tests/light_token/shared.rs index 10397e77f8..b4e8bc7fde 100644 --- a/program-tests/compressed-token-test/tests/ctoken/shared.rs +++ b/program-tests/compressed-token-test/tests/light_token/shared.rs @@ -299,7 +299,7 @@ pub async fn close_and_assert_token_account( let (ctoken, _) = Token::zero_copy_at(&account_info.data).unwrap(); let compressible = ctoken .get_compressible_extension() - .expect("CToken should have Compressible extension"); + .expect("Light Token should have Compressible extension"); let rent_sponsor = Pubkey::from(compressible.info.rent_sponsor); let close_ix = CloseAccount { @@ -700,7 +700,7 @@ pub async fn compress_and_close_forester_with_invalid_output( // Extract compression info from Compressible extension let compressible = ctoken .get_compressible_extension() - .expect("CToken should have Compressible extension"); + .expect("Light Token should have Compressible extension"); let rent_sponsor = Pubkey::from(compressible.info.rent_sponsor); // Get output queue for compression @@ -798,7 +798,7 @@ pub async fn compress_and_close_forester_with_invalid_output( /// Execute SPL-format approve and assert success (uses spl_token_2022 instruction format) /// This tests SPL compatibility - building instruction with spl_token_2022 and changing program_id. -/// Note: CToken requires system_program account for compressible top-up, so we add it here. +/// Note: Light Token requires system_program account for compressible top-up, so we add it here. pub async fn approve_spl_compat_and_assert( context: &mut AccountTestContext, delegate: Pubkey, @@ -849,7 +849,7 @@ pub async fn approve_spl_compat_and_assert( /// Execute SPL-format revoke and assert success (uses spl_token_2022 instruction format) /// This tests SPL compatibility - building instruction with spl_token_2022 and changing program_id. -/// Note: CToken requires system_program account for compressible top-up, so we add it here. +/// Note: Light Token requires system_program account for compressible top-up, so we add it here. pub async fn revoke_spl_compat_and_assert(context: &mut AccountTestContext, name: &str) { use anchor_spl::token_2022::spl_token_2022; use solana_sdk::instruction::AccountMeta; diff --git a/program-tests/compressed-token-test/tests/ctoken/spl_instruction_compat.rs b/program-tests/compressed-token-test/tests/light_token/spl_instruction_compat.rs similarity index 98% rename from program-tests/compressed-token-test/tests/ctoken/spl_instruction_compat.rs rename to program-tests/compressed-token-test/tests/light_token/spl_instruction_compat.rs index e98c8c3ded..e786162273 100644 --- a/program-tests/compressed-token-test/tests/ctoken/spl_instruction_compat.rs +++ b/program-tests/compressed-token-test/tests/light_token/spl_instruction_compat.rs @@ -426,7 +426,7 @@ async fn test_spl_instruction_compatibility() { async fn test_spl_instruction_compatibility_with_cmint() { use light_program_test::ProgramTestConfig; use light_token_client::instructions::mint_action::DecompressMintParams; - use light_token_sdk::compressed_token::create_compressed_mint::find_cmint_address; + use light_token_sdk::compressed_token::create_compressed_mint::find_mint_address; // Set up test environment let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) @@ -440,7 +440,7 @@ async fn test_spl_instruction_compatibility_with_cmint() { let owner_keypair = Keypair::new(); // Derive CMint PDA - let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (cmint_pda, _) = find_mint_address(&mint_seed.pubkey()); let decimals: u8 = 8; println!("Creating decompressed cmint with freeze authority..."); @@ -471,11 +471,11 @@ async fn test_spl_instruction_compatibility_with_cmint() { println!("CMint created at: {}", cmint_pda); - // Create two non-compressible CToken accounts (165 bytes) using SPL instruction format + // Create two non-compressible Light Token accounts (165 bytes) using SPL instruction format let account1_keypair = Keypair::new(); let account2_keypair = Keypair::new(); - println!("Creating first non-compressible CToken account..."); + println!("Creating first non-compressible Light Token account..."); // Create first account { @@ -517,7 +517,7 @@ async fn test_spl_instruction_compatibility_with_cmint() { println!("First account created"); } - println!("Creating second non-compressible CToken account..."); + println!("Creating second non-compressible Light Token account..."); // Create second account { @@ -830,7 +830,7 @@ async fn test_spl_instruction_compatibility_with_cmint() { } println!("\nSPL instruction compatibility with CMint test passed!"); - println!(" - Created 2 non-compressible CToken accounts with CMint"); + println!(" - Created 2 non-compressible Light Token accounts with CMint"); println!(" - mint_to: Minted 1000 tokens"); println!(" - mint_to_checked: Minted 500 tokens with decimals validation"); println!(" - transfer_checked: Transferred 500 tokens with decimals validation"); diff --git a/program-tests/compressed-token-test/tests/ctoken/transfer.rs b/program-tests/compressed-token-test/tests/light_token/transfer.rs similarity index 99% rename from program-tests/compressed-token-test/tests/ctoken/transfer.rs rename to program-tests/compressed-token-test/tests/light_token/transfer.rs index da7f752a63..38757a82ec 100644 --- a/program-tests/compressed-token-test/tests/ctoken/transfer.rs +++ b/program-tests/compressed-token-test/tests/light_token/transfer.rs @@ -416,8 +416,8 @@ async fn test_ctoken_transfer_mint_mismatch() { let different_mint = Pubkey::new_unique(); let mut dest_account = context.rpc.get_account(destination).await.unwrap().unwrap(); - // CToken mint is the first 32 bytes after the account type discriminator - // The mint field is at bytes 0-32 in the CToken account data + // Light Token mint is the first 32 bytes after the account type discriminator + // The mint field is at bytes 0-32 in the Light Token account data dest_account.data[0..32].copy_from_slice(&different_mint.to_bytes()); context.rpc.set_account(destination, dest_account); diff --git a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs b/program-tests/compressed-token-test/tests/light_token/transfer_checked.rs similarity index 97% rename from program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs rename to program-tests/compressed-token-test/tests/light_token/transfer_checked.rs index a2c069af23..19f61e1dbd 100644 --- a/program-tests/compressed-token-test/tests/ctoken/transfer_checked.rs +++ b/program-tests/compressed-token-test/tests/light_token/transfer_checked.rs @@ -43,7 +43,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { ) .await; - // Step 2: Create two compressible CToken accounts (A and B) with all extensions + // Step 2: Create two compressible Light Token accounts (A and B) with all extensions let owner = Keypair::new(); context .rpc @@ -129,7 +129,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { .await .unwrap(); - // Step 3: Transfer SPL to CToken account A using hot path + // Step 3: Transfer SPL to Light Token account A using hot path let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda_with_index(&mint_pubkey, 0, true); diff --git a/program-tests/compressed-token-test/tests/mint/burn.rs b/program-tests/compressed-token-test/tests/mint/burn.rs index 29b12b3cb4..944c4072ee 100644 --- a/program-tests/compressed-token-test/tests/mint/burn.rs +++ b/program-tests/compressed-token-test/tests/mint/burn.rs @@ -3,7 +3,7 @@ use light_test_utils::{assert_ctoken_burn::assert_ctoken_burn, Rpc}; use light_token_client::instructions::mint_action::DecompressMintParams; use light_token_interface::instructions::mint_action::Recipient; use light_token_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, + compressed_token::create_compressed_mint::find_mint_address, token::{derive_token_ata, Burn, CreateAssociatedTokenAccount}, }; use serial_test::serial; @@ -18,13 +18,13 @@ struct BurnTestContext { owner_keypair: Keypair, } -/// Setup: Create CMint + CToken with tokens minted +/// Setup: Create CMint + Light Token with tokens minted /// /// Steps: /// 1. Init LightProgramTest /// 2. Create compressed mint + CMint via mint_action_comprehensive -/// 3. Create CToken ATA with compressible extension -/// 4. Mint tokens to CToken via mint_action_comprehensive +/// 3. Create Light Token ATA with compressible extension +/// 4. Mint tokens to Light Token via mint_action_comprehensive async fn setup_burn_test(mint_amount: u64) -> BurnTestContext { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) .await @@ -37,9 +37,9 @@ async fn setup_burn_test(mint_amount: u64) -> BurnTestContext { let owner_keypair = Keypair::new(); // Derive CMint PDA - let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (cmint_pda, _) = find_mint_address(&mint_seed.pubkey()); - // Step 1: Create CToken ATA for owner first (needed before minting) + // Step 1: Create Light Token ATA for owner first (needed before minting) let (ctoken_ata, _) = derive_token_ata(&owner_keypair.pubkey(), &cmint_pda); let create_ata_ix = @@ -63,7 +63,7 @@ async fn setup_burn_test(mint_amount: u64) -> BurnTestContext { vec![Recipient { recipient: owner_keypair.pubkey().into(), amount: mint_amount, - }], // Mint to CToken in same tx + }], // Mint to Light Token in same tx None, // No mint authority update None, // No freeze authority update Some(light_token_client::instructions::mint_action::NewMint { diff --git a/program-tests/compressed-token-test/tests/mint/cpi_context.rs b/program-tests/compressed-token-test/tests/mint/cpi_context.rs index 20f15748b4..63bce9a8f3 100644 --- a/program-tests/compressed-token-test/tests/mint/cpi_context.rs +++ b/program-tests/compressed-token-test/tests/mint/cpi_context.rs @@ -13,7 +13,7 @@ use light_token_interface::{ CMINT_ADDRESS_TREE, LIGHT_TOKEN_PROGRAM_ID, }; use light_token_sdk::compressed_token::{ - create_compressed_mint::{derive_cmint_compressed_address, find_cmint_address}, + create_compressed_mint::{derive_mint_compressed_address, find_mint_address}, mint_action::{ get_mint_action_instruction_account_metas_cpi_write, MintActionMetaConfig, MintActionMetaConfigCpiWrite, @@ -67,8 +67,8 @@ async fn test_setup() -> TestSetup { // Derive addresses let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree); - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); // 3. Build compressed mint inputs let compressed_mint_inputs = CompressedMintWithContext { diff --git a/program-tests/compressed-token-test/tests/mint/edge_cases.rs b/program-tests/compressed-token-test/tests/mint/edge_cases.rs index 3930c34e02..34c7adcf7d 100644 --- a/program-tests/compressed-token-test/tests/mint/edge_cases.rs +++ b/program-tests/compressed-token-test/tests/mint/edge_cases.rs @@ -12,9 +12,7 @@ use light_token_interface::state::{ extensions::AdditionalMetadata, CompressedMint, TokenDataVersion, }; use light_token_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, + compressed_token::create_compressed_mint::{derive_mint_compressed_address, find_mint_address}, token::{CompressibleParams, CreateAssociatedTokenAccount}, }; use serial_test::serial; @@ -46,10 +44,10 @@ async fn functional_all_in_one_instruction() { let address_tree_pubkey = rpc.get_address_tree_v2().tree; // Derive compressed mint address for verification let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Find mint PDA for the rest of the test - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); // 1. Create compressed mint with both authorities { create_mint( @@ -270,7 +268,7 @@ async fn functional_all_in_one_instruction() { assert!(result.is_ok(), "All-in-one mint action should succeed"); - // Use the new assert_mint_action function (now also validates CToken account state) + // Use the new assert_mint_action function (now also validates Light Token account state) assert_mint_action( &mut rpc, compressed_mint_address, diff --git a/program-tests/compressed-token-test/tests/mint/failing.rs b/program-tests/compressed-token-test/tests/mint/failing.rs index 0f3e505ed0..a19b80c818 100644 --- a/program-tests/compressed-token-test/tests/mint/failing.rs +++ b/program-tests/compressed-token-test/tests/mint/failing.rs @@ -12,9 +12,7 @@ use light_token_client::{ }; use light_token_interface::state::{extensions::AdditionalMetadata, CompressedMint}; use light_token_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, + compressed_token::create_compressed_mint::{derive_mint_compressed_address, find_mint_address}, token::{CompressibleParams, CreateAssociatedTokenAccount}, }; use serial_test::serial; @@ -60,10 +58,10 @@ async fn functional_and_failing_tests() { let address_tree_pubkey = rpc.get_address_tree_v2().tree; // Derive compressed mint address for verification let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Find mint PDA for the rest of the test - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); // 1. Create compressed mint with both authorities { create_mint( @@ -806,7 +804,7 @@ async fn functional_and_failing_tests() { } /// Test that mint_action fails when max_top_up is exceeded during MintToCToken. -/// Creates a compressible CToken ATA with pre_pay_num_epochs = 0 (no prepaid rent), +/// Creates a compressible Light Token ATA with pre_pay_num_epochs = 0 (no prepaid rent), /// which requires rent top-up on any mint write. Setting max_top_up = 1 (too low) /// should trigger MaxTopUpExceeded error (18043). #[tokio::test] @@ -821,7 +819,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { LIGHT_TOKEN_PROGRAM_ID, }; use light_token_sdk::compressed_token::{ - create_compressed_mint::derive_cmint_compressed_address, mint_action::MintActionMetaConfig, + create_compressed_mint::derive_mint_compressed_address, mint_action::MintActionMetaConfig, }; let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) @@ -841,8 +839,8 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); // 1. Create compressed mint light_token_client::actions::create_mint( @@ -857,7 +855,7 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() { .await .unwrap(); - // 2. Create compressible CToken ATA with pre_pay_num_epochs = 0 (NO prepaid rent) + // 2. Create compressible Light Token ATA with pre_pay_num_epochs = 0 (NO prepaid rent) let recipient = Keypair::new(); let compressible_params = CompressibleParams { @@ -1027,7 +1025,7 @@ async fn test_compress_and_close_cmint_must_be_only_action() { use light_compressible::rent::SLOTS_PER_EPOCH; use light_program_test::program_test::TestRpc; use light_token_client::instructions::mint_action::DecompressMintParams; - use light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address; + use light_token_sdk::compressed_token::create_compressed_mint::derive_mint_compressed_address; let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) .await @@ -1046,7 +1044,7 @@ async fn test_compress_and_close_cmint_must_be_only_action() { let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // 1. Create compressed mint with CMint (decompressed) light_token_client::actions::mint_action_comprehensive( diff --git a/program-tests/compressed-token-test/tests/mint/functional.rs b/program-tests/compressed-token-test/tests/mint/functional.rs index e044014622..0e0fa9f654 100644 --- a/program-tests/compressed-token-test/tests/mint/functional.rs +++ b/program-tests/compressed-token-test/tests/mint/functional.rs @@ -34,9 +34,7 @@ use light_token_interface::{ COMPRESSED_MINT_SEED, }; use light_token_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, + compressed_token::create_compressed_mint::{derive_mint_compressed_address, find_mint_address}, token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, }; use serial_test::serial; @@ -68,10 +66,10 @@ async fn test_create_compressed_mint() { let mint_seed = Keypair::new(); // Derive compressed mint address for verification let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Find mint PDA for the rest of the test - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); // 1. Create compressed mint (no metadata) { @@ -556,7 +554,7 @@ async fn test_update_compressed_mint_authority() { // Get the compressed mint address and info let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Get compressed mint account from indexer let compressed_mint_account = rpc @@ -687,7 +685,7 @@ async fn test_ctoken_transfer() { .unwrap(); // Derive addresses - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); // Create compressed token ATA for recipient let (recipient_ata, _) = derive_token_ata(&recipient_keypair.pubkey(), &spl_mint_pda); @@ -1050,10 +1048,7 @@ async fn test_create_compressed_mint_with_token_metadata() { &light_compressed_token::ID, ); let compressed_mint_address = - light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address( - &mint_seed.pubkey(), - &address_tree_pubkey, - ); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Verify the compressed mint was created let compressed_mint_account = rpc @@ -1171,8 +1166,8 @@ async fn test_mint_actions() { // Derive addresses let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); rpc.context.warp_to_slot(1); // === SINGLE MINT ACTION INSTRUCTION === // Execute ONE instruction with ALL actions @@ -1417,8 +1412,8 @@ async fn test_create_compressed_mint_with_cmint() { // Derive addresses let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); - let (cmint_pda, _cmint_bump) = find_cmint_address(&mint_seed.pubkey()); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + let (cmint_pda, _cmint_bump) = find_mint_address(&mint_seed.pubkey()); // Create mint + decompress in single instruction let signature = light_token_client::actions::mint_action_comprehensive( @@ -1550,8 +1545,8 @@ async fn test_compress_and_close_cmint_idempotent() { let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); - let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + let (cmint_pda, _) = find_mint_address(&mint_seed.pubkey()); // 1. Create compressed mint WITH CMint (decompress_mint = true) light_token_client::actions::mint_action_comprehensive( @@ -1673,8 +1668,8 @@ async fn test_decompress_existing_mint_to_cmint() { // Derive addresses let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); - let (cmint_pda, cmint_bump) = find_cmint_address(&mint_seed.pubkey()); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + let (cmint_pda, cmint_bump) = find_mint_address(&mint_seed.pubkey()); // === STEP 1: Create compressed mint WITHOUT CMint === create_mint( @@ -1709,7 +1704,7 @@ async fn test_decompress_existing_mint_to_cmint() { ); // === STEP 2: Mint tokens to recipient === - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); mint_to_compressed( &mut rpc, spl_mint_pda, diff --git a/program-tests/compressed-token-test/tests/mint/mint_to.rs b/program-tests/compressed-token-test/tests/mint/mint_to.rs index 4fc60aa0ca..31e593ba7f 100644 --- a/program-tests/compressed-token-test/tests/mint/mint_to.rs +++ b/program-tests/compressed-token-test/tests/mint/mint_to.rs @@ -2,7 +2,7 @@ use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_test_utils::{assert_ctoken_mint_to::assert_ctoken_mint_to, Rpc}; use light_token_client::instructions::mint_action::DecompressMintParams; use light_token_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, + compressed_token::create_compressed_mint::find_mint_address, token::{derive_token_ata, CreateAssociatedTokenAccount, MintTo}, }; use serial_test::serial; @@ -17,12 +17,12 @@ struct MintToTestContext { mint_authority: Keypair, } -/// Setup: Create CMint + CToken (without tokens) +/// Setup: Create CMint + Light Token (without tokens) /// /// Steps: /// 1. Init LightProgramTest /// 2. Create compressed mint + CMint via mint_action_comprehensive (no recipients) -/// 3. Create CToken ATA with compressible extension +/// 3. Create Light Token ATA with compressible extension async fn setup_mint_to_test() -> MintToTestContext { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)) .await @@ -35,9 +35,9 @@ async fn setup_mint_to_test() -> MintToTestContext { let owner_keypair = Keypair::new(); // Derive CMint PDA - let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (cmint_pda, _) = find_mint_address(&mint_seed.pubkey()); - // Step 1: Create CToken ATA for owner first + // Step 1: Create Light Token ATA for owner first let (ctoken_ata, _) = derive_token_ata(&owner_keypair.pubkey(), &cmint_pda); let create_ata_ix = diff --git a/program-tests/compressed-token-test/tests/mint/random.rs b/program-tests/compressed-token-test/tests/mint/random.rs index dbb61cbbdc..df81128674 100644 --- a/program-tests/compressed-token-test/tests/mint/random.rs +++ b/program-tests/compressed-token-test/tests/mint/random.rs @@ -11,9 +11,7 @@ use light_token_client::{ }; use light_token_interface::state::{extensions::AdditionalMetadata, CompressedMint}; use light_token_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, + compressed_token::create_compressed_mint::{derive_mint_compressed_address, find_mint_address}, token::CreateAssociatedTokenAccount, }; use serial_test::serial; @@ -67,10 +65,10 @@ async fn test_random_mint_action() { let address_tree_pubkey = rpc.get_address_tree_v2().tree; // Derive compressed mint address for verification let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Find mint PDA for the rest of the test - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); // Fund authority first rpc.airdrop_lamports(&authority.pubkey(), 10_000_000_000) @@ -125,7 +123,7 @@ async fn test_random_mint_action() { .await .unwrap(); - // Create 5 CToken ATAs upfront for MintToCToken actions + // Create 5 Light Token ATAs upfront for MintToCToken actions let mut ctoken_atas = Vec::new(); for _ in 0..5 { @@ -366,7 +364,7 @@ async fn test_random_mint_action() { assert!(result.is_ok(), "All-in-one mint action should succeed"); - // Use the new assert_mint_action function (now also validates CToken account state) + // Use the new assert_mint_action function (now also validates Light Token account state) assert_mint_action( &mut rpc, compressed_mint_address, diff --git a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs index c7536e8abc..646704f64a 100644 --- a/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/compress_failing.rs @@ -10,7 +10,7 @@ // 1. amount more than output (should fail with output sum check) // 2. amount less than output (should fail with input sum check) // -// CToken Compression Authority Validation: +// Light Token Compression Authority Validation: // 3. ctoken compression // 3.1 invalid authority has signed // 3.2 authority is valid but not signer @@ -45,7 +45,7 @@ use light_token_interface::{ }; use light_token_sdk::{ compressed_token::{ - create_compressed_mint::find_cmint_address, + create_compressed_mint::find_mint_address, transfer2::{ account_metas::Transfer2AccountsMetaConfig, create_transfer2_instruction, Transfer2Config, Transfer2Inputs, @@ -70,7 +70,7 @@ struct CompressionTestContext { pub system_accounts_offset: usize, // Offset to add to packed account indices to get instruction account indices } -/// Set up test environment with compressed mint and one CToken account with tokens +/// Set up test environment with compressed mint and one Light Token account with tokens async fn setup_compression_test(token_amount: u64) -> Result { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2(false, None)).await?; let payer = rpc.get_payer().insecure_clone(); @@ -88,10 +88,10 @@ async fn setup_compression_test(token_amount: u64) -> Result Result Result Result compressed) +/// Build Transfer2Inputs for compression (Light Token ATA -> compressed) /// This uses the low-level SDK abstractions for maximum control in failing tests /// Returns Transfer2Inputs so tests can modify it before creating the instruction fn create_compression_inputs( @@ -209,19 +209,19 @@ fn create_compression_inputs( // For compression (0 inputs, 1 output), add the output queue packed_accounts.insert_or_get(output_queue); - // Add mint, authority (owner of CToken ATA), recipient + // Add mint, authority (owner of Light Token ATA), recipient let mint_index = packed_accounts.insert_or_get_read_only(mint); let authority_index = packed_accounts.insert_or_get_config(authority, true, false); // is_signer, not writable let recipient_index = packed_accounts.insert_or_get_read_only(recipient); - // Add CToken ATA account + // Add Light Token ATA account let ctoken_ata_index = packed_accounts.insert_or_get_config(ctoken_ata, false, true); // not signer, is writable // Create CTokenAccount2 for compression (0 inputs, 1 output) // Use new_empty since we have no compressed input accounts let mut compression_account = CTokenAccount2::new_empty(recipient_index, mint_index); - // Compress tokens from CToken ATA + // Compress tokens from Light Token ATA compression_account .compress(compress_amount, ctoken_ata_index, authority_index) .map_err(|e| RpcError::AssertRpcError(format!("Failed to compress: {:?}", e)))?; @@ -262,7 +262,7 @@ async fn test_ctoken_compression_functional() -> Result<(), RpcError> { let ix = create_transfer2_instruction(compression_inputs) .map_err(|e| RpcError::AssertRpcError(format!("Failed to create instruction: {:?}", e)))?; - // Send transaction with owner as signer (owner of CToken ATA) + // Send transaction with owner as signer (owner of Light Token ATA) let result = rpc .create_and_send_transaction(&[ix], &payer.pubkey(), &[&payer, &owner]) .await; @@ -280,7 +280,7 @@ async fn test_ctoken_compression_functional() -> Result<(), RpcError> { #[tokio::test] async fn test_compression_amount_less_than_output() -> Result<(), RpcError> { // Test: Compression amount less than output (input sum check should fail) - // Compress 1000 tokens from CToken ATA but output shows 1001 tokens + // Compress 1000 tokens from Light Token ATA but output shows 1001 tokens let CompressionTestContext { mut rpc, payer, @@ -312,7 +312,7 @@ async fn test_compression_amount_less_than_output() -> Result<(), RpcError> { #[tokio::test] async fn test_compression_amount_more_than_output() -> Result<(), RpcError> { // Test: Compression amount more than output (output sum check should fail) - // Compress 1000 tokens from CToken ATA but output shows 999 tokens + // Compress 1000 tokens from Light Token ATA but output shows 999 tokens let CompressionTestContext { mut rpc, payer, @@ -343,7 +343,7 @@ async fn test_compression_amount_more_than_output() -> Result<(), RpcError> { #[tokio::test] async fn test_compression_invalid_authority_signed() -> Result<(), RpcError> { - // Test: Invalid authority has signed (not the CToken ATA owner) + // Test: Invalid authority has signed (not the Light Token ATA owner) let CompressionTestContext { mut rpc, payer, @@ -454,7 +454,7 @@ async fn test_compression_invalid_mint() -> Result<(), RpcError> { .create_and_send_transaction(&[ix], &payer.pubkey(), &[&payer, &owner]) .await; - // Should fail with InvalidAccountData - mint mismatch detected during CToken account validation + // Should fail with InvalidAccountData - mint mismatch detected during Light Token account validation assert_rpc_error(result, 0, TokenError::MintMismatch.into()).unwrap(); Ok(()) @@ -576,7 +576,7 @@ async fn test_compression_recipient_out_of_bounds() -> Result<(), RpcError> { } /// Test that transfer2 compression fails when max_top_up is exceeded. -/// Creates a compressible CToken ATA with pre_pay_num_epochs = 0 (no prepaid rent), +/// Creates a compressible Light Token ATA with pre_pay_num_epochs = 0 (no prepaid rent), /// which requires rent top-up on any compression write. Setting max_top_up = 1 (too low) /// should trigger MaxTopUpExceeded error (18043). #[tokio::test] @@ -597,10 +597,10 @@ async fn test_compression_max_top_up_exceeded() -> Result<(), RpcError> { let mint_seed = Keypair::new(); // Derive mint and ATA addresses - let (mint, _) = find_cmint_address(&mint_seed.pubkey()); + let (mint, _) = find_mint_address(&mint_seed.pubkey()); let (ctoken_ata, _) = derive_token_ata(&owner.pubkey(), &mint); - // Create compressible CToken ATA with pre_pay_num_epochs = 0 (NO prepaid rent) + // Create compressible Light Token ATA with pre_pay_num_epochs = 0 (NO prepaid rent) // This means any write operation will require immediate rent top-up let compressible_params = CompressibleParams { compressible_config: rpc @@ -624,7 +624,7 @@ async fn test_compression_max_top_up_exceeded() -> Result<(), RpcError> { rpc.create_and_send_transaction(&[create_ata_instruction], &payer.pubkey(), &[&payer]) .await?; - // Create mint and mint tokens to decompressed CToken ATA + // Create mint and mint tokens to decompressed Light Token ATA let token_amount = 1000u64; let decompressed_recipients = vec![Recipient::new(owner.pubkey(), token_amount)]; @@ -636,7 +636,7 @@ async fn test_compression_max_top_up_exceeded() -> Result<(), RpcError> { None, // no decompress mint false, // no close cmint vec![], // no compressed recipients - decompressed_recipients, // mint to decompressed CToken ATA + decompressed_recipients, // mint to decompressed Light Token ATA None, None, Some(light_token_client::instructions::mint_action::NewMint { diff --git a/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs b/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs index 2686abf6dc..5a1938d27b 100644 --- a/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/compress_spl_failing.rs @@ -69,7 +69,7 @@ struct SplCompressionTestContext { pub system_accounts_offset: usize, } -/// Set up test environment with SPL token account and CToken ATA +/// Set up test environment with SPL token account and Light Token ATA async fn setup_spl_compression_test( token_amount: u64, ) -> Result { @@ -125,7 +125,7 @@ async fn setup_spl_compression_test( spl_token_account_keypair.pubkey(), mint, sender.pubkey(), - ctoken_ata, // Pass CToken ATA, not recipient pubkey + ctoken_ata, // Pass Light Token ATA, not recipient pubkey token_amount, payer.pubkey(), output_queue, @@ -638,7 +638,7 @@ async fn test_spl_compression_mint_out_of_bounds() -> Result<(), RpcError> { #[tokio::test] async fn test_spl_compression_recipient_out_of_bounds() -> Result<(), RpcError> { - // Test: Recipient (CToken ATA owner) index out of bounds + // Test: Recipient (Light Token ATA owner) index out of bounds let SplCompressionTestContext { mut rpc, payer, diff --git a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs index 87b6744f26..902b09b57d 100644 --- a/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/decompress_failing.rs @@ -43,7 +43,7 @@ use light_token_interface::{ }; use light_token_sdk::{ compressed_token::{ - create_compressed_mint::find_cmint_address, + create_compressed_mint::find_mint_address, transfer2::{ account_metas::Transfer2AccountsMetaConfig, create_transfer2_instruction, Transfer2Config, Transfer2Inputs, @@ -68,7 +68,7 @@ struct DecompressionTestContext { pub system_accounts_offset: usize, } -/// Set up test environment with compressed tokens and an empty CToken recipient account +/// Set up test environment with compressed tokens and an empty Light Token recipient account async fn setup_decompression_test( compressed_amount: u64, ) -> Result { @@ -88,10 +88,10 @@ async fn setup_decompression_test( let mint_seed = Keypair::new(); // Derive mint and ATA addresses - let (mint, _) = find_cmint_address(&mint_seed.pubkey()); + let (mint, _) = find_mint_address(&mint_seed.pubkey()); let (ctoken_ata, _) = derive_token_ata(&owner.pubkey(), &mint); - // Create compressible CToken ATA for owner (recipient of decompression) + // Create compressible Light Token ATA for owner (recipient of decompression) let compressible_params = CompressibleParams { compressible_config: rpc .test_accounts @@ -114,7 +114,7 @@ async fn setup_decompression_test( rpc.create_and_send_transaction(&[create_ata_instruction], &payer.pubkey(), &[&payer]) .await?; - // Mint compressed tokens to owner and 1 token to decompressed CToken ATA + // Mint compressed tokens to owner and 1 token to decompressed Light Token ATA let compressed_recipients = vec![Recipient::new(owner.pubkey(), compressed_amount)]; let decompressed_recipients = vec![Recipient::new(owner.pubkey(), 0)]; @@ -126,7 +126,7 @@ async fn setup_decompression_test( None, // no decompress mint false, // compress_and_close_cmint compressed_recipients, // mint compressed tokens to owner - decompressed_recipients, // mint 1 token to decompressed CToken ATA + decompressed_recipients, // mint 1 token to decompressed Light Token ATA None, // no mint authority update None, // no freeze authority update Some(light_token_client::instructions::mint_action::NewMint { @@ -192,7 +192,7 @@ async fn setup_decompression_test( // Instruction Builder Helpers // ============================================================================ -/// Build Transfer2Inputs for decompression (compressed -> CToken ATA) +/// Build Transfer2Inputs for decompression (compressed -> Light Token ATA) async fn create_decompression_inputs( compressed_token_account: &CompressedTokenAccount, ctoken_ata: Pubkey, @@ -214,7 +214,7 @@ async fn create_decompression_inputs( let owner_index = packed_accounts.insert_or_get_config(compressed_token_account.token.owner, true, false); // is_signer, not writable - // Add CToken ATA recipient account + // Add Light Token ATA recipient account let ctoken_ata_index = packed_accounts.insert_or_get_config(ctoken_ata, false, true); // not signer, is writable println!("compressed_token_account: {:?}", compressed_token_account); // Manually create MultiInputTokenDataWithContext @@ -414,7 +414,7 @@ async fn test_decompression_mint_out_of_bounds() -> Result<(), RpcError> { #[tokio::test] async fn test_decompression_recipient_out_of_bounds() -> Result<(), RpcError> { - // Test: Recipient (CToken ATA) index out of bounds in decompression + // Test: Recipient (Light Token ATA) index out of bounds in decompression let DecompressionTestContext { mut rpc, payer, @@ -431,7 +431,7 @@ async fn test_decompression_recipient_out_of_bounds() -> Result<(), RpcError> { .unwrap() .len(); - // Set recipient (CToken ATA) index to out of bounds value in decompression + // Set recipient (Light Token ATA) index to out of bounds value in decompression decompression_inputs.token_accounts[0] .compression .as_mut() diff --git a/program-tests/compressed-token-test/tests/transfer2/functional.rs b/program-tests/compressed-token-test/tests/transfer2/functional.rs index 7587cb10f1..954593a480 100644 --- a/program-tests/compressed-token-test/tests/transfer2/functional.rs +++ b/program-tests/compressed-token-test/tests/transfer2/functional.rs @@ -62,21 +62,21 @@ use crate::transfer2::shared::{ // Compression Operations (Path A - no compressed accounts) // 39. Compress from SPL token only -// 40. Compress from CToken only -// 41. Decompress to CToken only +// 40. Compress from Light Token only +// 41. Decompress to Light Token only // 42. Multiple compress operations only // 43. Multiple decompress operations only // 44. Compress and decompress same amount (must balance) // 45. Decompress to SPL token only // 46. Compress SPL with multiple compressed account inputs -// 47. Mixed SPL and CToken operations +// 47. Mixed SPL and Light Token operations // Mixed Compression + Transfer (Path B) - NOT YET IMPLEMENTED // 48. Transfer + compress SPL in same transaction // 49. Transfer + decompress to SPL in same transaction -// 50. Transfer + compress CToken in same transaction -// 51. Transfer + decompress to CToken in same transaction +// 50. Transfer + compress Light Token in same transaction +// 51. Transfer + decompress to Light Token in same transaction // 52. Transfer + multiple compressions // 53. Transfer + multiple decompressions // 54. Transfer + compress + decompress (all must balance) @@ -1347,27 +1347,27 @@ fn test39_compress_from_spl_only() -> TestCase { } } -// Test 40: Compress from CToken only +// Test 40: Compress from Light Token only fn test40_compress_from_ctoken_only() -> TestCase { TestCase { - name: "Compress from CToken only".to_string(), + name: "Compress from Light Token only".to_string(), actions: vec![MetaTransfer2InstructionType::Compress(MetaCompressInput { num_input_compressed_accounts: 0, // No compressed inputs - amount: 1000, // Amount to compress from CToken ATA + amount: 1000, // Amount to compress from Light Token ATA token_data_version: TokenDataVersion::ShaFlat, - signer_index: 0, // Owner of the CToken ATA + signer_index: 0, // Owner of the Light Token ATA recipient_index: 0, // Compress to same owner mint_index: 0, - use_spl: false, // Use CToken ATA + use_spl: false, // Use Light Token ATA pool_index: None, })], } } -// Test 41: Decompress to CToken only +// Test 41: Decompress to Light Token only fn test41_decompress_to_ctoken_only() -> TestCase { TestCase { - name: "Decompress to CToken only".to_string(), + name: "Decompress to Light Token only".to_string(), actions: vec![MetaTransfer2InstructionType::Decompress( MetaDecompressInput { num_input_compressed_accounts: 1, // One compressed account as input @@ -1377,7 +1377,7 @@ fn test41_decompress_to_ctoken_only() -> TestCase { signer_index: 0, // Owner of compressed tokens recipient_index: 1, // Decompress to different recipient mint_index: 0, - to_spl: false, // Decompress to CToken ATA + to_spl: false, // Decompress to Light Token ATA pool_index: None, }, )], @@ -1397,7 +1397,7 @@ fn test42_multiple_compress_operations() -> TestCase { signer_index: 0, recipient_index: 0, mint_index: 0, - use_spl: false, // Use CToken ATA + use_spl: false, // Use Light Token ATA pool_index: None, }), // Second compress from signer 1 @@ -1408,7 +1408,7 @@ fn test42_multiple_compress_operations() -> TestCase { signer_index: 1, recipient_index: 1, mint_index: 0, - use_spl: false, // Use CToken ATA + use_spl: false, // Use Light Token ATA pool_index: None, }), // Third compress from signer 2 @@ -1419,7 +1419,7 @@ fn test42_multiple_compress_operations() -> TestCase { signer_index: 2, recipient_index: 2, mint_index: 0, - use_spl: false, // Use CToken ATA + use_spl: false, // Use Light Token ATA pool_index: None, }), ], @@ -1440,7 +1440,7 @@ fn test43_multiple_decompress_operations() -> TestCase { signer_index: 0, recipient_index: 3, // Different recipient mint_index: 0, - to_spl: false, // Decompress to CToken ATA + to_spl: false, // Decompress to Light Token ATA pool_index: None, }), // Second decompress to recipient 1 @@ -1452,7 +1452,7 @@ fn test43_multiple_decompress_operations() -> TestCase { signer_index: 1, recipient_index: 4, // Different recipient mint_index: 0, - to_spl: false, // Decompress to CToken ATA + to_spl: false, // Decompress to Light Token ATA pool_index: None, }), // Third decompress to recipient 2 @@ -1464,7 +1464,7 @@ fn test43_multiple_decompress_operations() -> TestCase { signer_index: 2, recipient_index: 5, // Different recipient mint_index: 0, - to_spl: false, // Decompress to CToken ATA + to_spl: false, // Decompress to Light Token ATA pool_index: None, }), ], @@ -1476,7 +1476,7 @@ fn test44_compress_decompress_balance() -> TestCase { TestCase { name: "Compress and decompress same amount (must balance)".to_string(), actions: vec![ - // Compress 1000 tokens from CToken + // Compress 1000 tokens from Light Token MetaTransfer2InstructionType::Compress(MetaCompressInput { num_input_compressed_accounts: 0, amount: 1000, @@ -1484,10 +1484,10 @@ fn test44_compress_decompress_balance() -> TestCase { signer_index: 0, recipient_index: 0, mint_index: 0, - use_spl: false, // Use CToken ATA + use_spl: false, // Use Light Token ATA pool_index: None, }), - // Decompress 1000 tokens to different CToken + // Decompress 1000 tokens to different Light Token MetaTransfer2InstructionType::Decompress(MetaDecompressInput { num_input_compressed_accounts: 1, decompress_amount: 1000, @@ -1496,7 +1496,7 @@ fn test44_compress_decompress_balance() -> TestCase { signer_index: 1, recipient_index: 2, // Different recipient mint_index: 0, - to_spl: false, // Decompress to CToken ATA + to_spl: false, // Decompress to Light Token ATA pool_index: None, }), ], @@ -1540,10 +1540,10 @@ fn test46_compress_spl_with_compressed_inputs() -> TestCase { } } -// Test 47: Mixed SPL and CToken operations +// Test 47: Mixed SPL and Light Token operations fn test47_mixed_spl_ctoken_operations() -> TestCase { TestCase { - name: "Mixed SPL and CToken operations".to_string(), + name: "Mixed SPL and Light Token operations".to_string(), actions: vec![ // Compress from SPL MetaTransfer2InstructionType::Compress(MetaCompressInput { @@ -1556,7 +1556,7 @@ fn test47_mixed_spl_ctoken_operations() -> TestCase { use_spl: true, // SPL source pool_index: None, }), - // Compress from CToken + // Compress from Light Token MetaTransfer2InstructionType::Compress(MetaCompressInput { num_input_compressed_accounts: 0, amount: 300, @@ -1564,10 +1564,10 @@ fn test47_mixed_spl_ctoken_operations() -> TestCase { signer_index: 1, recipient_index: 1, mint_index: 1, - use_spl: false, // CToken source + use_spl: false, // Light Token source pool_index: None, }), - // Decompress to CToken + // Decompress to Light Token MetaTransfer2InstructionType::Decompress(MetaDecompressInput { num_input_compressed_accounts: 1, decompress_amount: 400, @@ -1576,7 +1576,7 @@ fn test47_mixed_spl_ctoken_operations() -> TestCase { signer_index: 0, recipient_index: 3, // Different recipient mint_index: 0, - to_spl: false, // Decompress to CToken ATA + to_spl: false, // Decompress to Light Token ATA pool_index: None, }), ], @@ -1652,10 +1652,10 @@ fn test49_transfer_decompress_spl() -> TestCase { } } -// Test 50: Transfer + compress CToken in same transaction +// Test 50: Transfer + compress Light Token in same transaction fn test50_transfer_compress_ctoken() -> TestCase { TestCase { - name: "Transfer + compress CToken in same transaction".to_string(), + name: "Transfer + compress Light Token in same transaction".to_string(), actions: vec![ // First: Regular compressed-to-compressed transfer (uses compressed mint 0) MetaTransfer2InstructionType::Transfer(MetaTransferInput { @@ -1669,7 +1669,7 @@ fn test50_transfer_compress_ctoken() -> TestCase { change_amount: None, mint_index: 0, // Compressed mint }), - // Second: Compress from CToken ATA (uses compressed mint 1) + // Second: Compress from Light Token ATA (uses compressed mint 1) MetaTransfer2InstructionType::Compress(MetaCompressInput { num_input_compressed_accounts: 0, amount: 1000, @@ -1677,17 +1677,17 @@ fn test50_transfer_compress_ctoken() -> TestCase { signer_index: 2, recipient_index: 2, mint_index: 1, // Different compressed mint - use_spl: false, // Use CToken ATA + use_spl: false, // Use Light Token ATA pool_index: None, }), ], } } -// Test 51: Transfer + decompress to CToken in same transaction +// Test 51: Transfer + decompress to Light Token in same transaction fn test51_transfer_decompress_ctoken() -> TestCase { TestCase { - name: "Transfer + decompress to CToken in same transaction".to_string(), + name: "Transfer + decompress to Light Token in same transaction".to_string(), actions: vec![ // First: Regular compressed-to-compressed transfer (uses compressed mint 0) MetaTransfer2InstructionType::Transfer(MetaTransferInput { @@ -1701,7 +1701,7 @@ fn test51_transfer_decompress_ctoken() -> TestCase { change_amount: None, mint_index: 0, // Compressed mint }), - // Second: Decompress to CToken ATA (uses compressed mint 1) + // Second: Decompress to Light Token ATA (uses compressed mint 1) MetaTransfer2InstructionType::Decompress(MetaDecompressInput { num_input_compressed_accounts: 1, decompress_amount: 600, @@ -1710,7 +1710,7 @@ fn test51_transfer_decompress_ctoken() -> TestCase { signer_index: 2, recipient_index: 3, mint_index: 1, // Different compressed mint - to_spl: false, // Decompress to CToken ATA + to_spl: false, // Decompress to Light Token ATA pool_index: None, }), ], @@ -1745,7 +1745,7 @@ fn test52_transfer_multiple_compressions() -> TestCase { use_spl: true, pool_index: None, }), - // Third: Compress from CToken (mint 2) + // Third: Compress from Light Token (mint 2) MetaTransfer2InstructionType::Compress(MetaCompressInput { num_input_compressed_accounts: 0, amount: 600, @@ -1800,7 +1800,7 @@ fn test53_transfer_multiple_decompressions() -> TestCase { to_spl: true, pool_index: None, }), - // Third: Decompress to CToken (mint 2) + // Third: Decompress to Light Token (mint 2) MetaTransfer2InstructionType::Decompress(MetaDecompressInput { num_input_compressed_accounts: 1, decompress_amount: 500, @@ -1868,7 +1868,7 @@ fn test54_transfer_compress_decompress_balanced() -> TestCase { to_spl: true, pool_index: None, }), - // Fourth: Compress from CToken (mint 2) + // Fourth: Compress from Light Token (mint 2) MetaTransfer2InstructionType::Compress(MetaCompressInput { num_input_compressed_accounts: 0, amount: 600, @@ -1879,7 +1879,7 @@ fn test54_transfer_compress_decompress_balanced() -> TestCase { use_spl: false, pool_index: None, }), - // Fifth: Decompress to CToken (mint 2, different signer) + // Fifth: Decompress to Light Token (mint 2, different signer) MetaTransfer2InstructionType::Decompress(MetaDecompressInput { num_input_compressed_accounts: 1, decompress_amount: 500, @@ -1927,7 +1927,7 @@ fn test68_compress_to_pool_index_1() -> TestCase { signer_index: 0, recipient_index: 0, mint_index: 0, - use_spl: true, // SPL only - CToken doesn't use pools + use_spl: true, // SPL only - Light Token doesn't use pools pool_index: Some(1), // Use pool 1 (will be created by test setup) })], } diff --git a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs index 0fc8d48448..4a7fe2ead4 100644 --- a/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/no_system_program_cpi_failing.rs @@ -18,13 +18,13 @@ // Missing Required Data/Accounts: // 1. Empty compressions array → NoInputsProvided (25) // -// Sum Check Failures - CToken: +// Sum Check Failures - Light Token: // 2. Compress without decompress → SumCheckFailed (6005) // 3. Decompress without compress → SumCheckFailed (6005) // 4. Compress less, decompress more → SumCheckFailed (6005) // 5. Compress more, decompress less → SumCheckFailed (6005) // -// CToken Authority Failures: +// Light Token Authority Failures: // 6. Invalid authority compress → OwnerMismatch (75) // 7. Authority not signer compress → InvalidSigner (20009) // 8. Insufficient balance compress → ArithmeticOverflow (string match, not error code) @@ -50,7 +50,7 @@ use light_sdk::instruction::PackedAccounts; use light_test_utils::{airdrop_lamports, RpcError}; use light_token_interface::instructions::{mint_action::Recipient, transfer2::Compression}; use light_token_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, + compressed_token::create_compressed_mint::find_mint_address, token::{derive_token_ata, CreateAssociatedTokenAccount}, ValidityProof, }; @@ -73,7 +73,7 @@ struct NoSystemProgramCpiTestContext { pub packed_accounts: Vec, } -/// Set up test environment with two CToken accounts for compress/decompress testing +/// Set up test environment with two Light Token accounts for compress/decompress testing async fn setup_no_system_program_cpi_test( source_token_amount: u64, ) -> Result { @@ -101,11 +101,11 @@ async fn setup_no_system_program_cpi_test( // Create compressed mint seed let mint_seed = Keypair::new(); - let (mint, _) = find_cmint_address(&mint_seed.pubkey()); + let (mint, _) = find_mint_address(&mint_seed.pubkey()); let (source_ata, _) = derive_token_ata(&owner.pubkey(), &mint); let (recipient_ata, _) = derive_token_ata(&recipient.pubkey(), &mint); - // Create CToken ATA for owner (source) + // Create Light Token ATA for owner (source) let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) .instruction() .map_err(|e| RpcError::AssertRpcError(format!("Failed to create source ATA: {}", e))) @@ -114,7 +114,7 @@ async fn setup_no_system_program_cpi_test( .await .unwrap(); - // Create CToken ATA for recipient + // Create Light Token ATA for recipient let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .map_err(|e| RpcError::AssertRpcError(format!("Failed to create recipient ATA: {}", e))) @@ -123,7 +123,7 @@ async fn setup_no_system_program_cpi_test( .await .unwrap(); - // Create mint and mint tokens to source CToken ATA + // Create mint and mint tokens to source Light Token ATA let decompressed_recipients = if source_token_amount > 0 { vec![Recipient::new(owner.pubkey(), source_token_amount)] } else { @@ -138,7 +138,7 @@ async fn setup_no_system_program_cpi_test( None, // no decompress mint false, // no close cmint vec![], // no compressed recipients - decompressed_recipients, // mint to source CToken ATA (empty if token_amount is 0) + decompressed_recipients, // mint to source Light Token ATA (empty if token_amount is 0) None, None, Some(light_token_client::instructions::mint_action::NewMint { @@ -342,7 +342,7 @@ async fn test_empty_compressions_array() -> Result<(), RpcError> { } // ============================================================================ -// Sum Check Failures - CToken +// Sum Check Failures - Light Token // ============================================================================ #[tokio::test] @@ -501,7 +501,7 @@ async fn test_compress_more_decompress_less() -> Result<(), RpcError> { } // ============================================================================ -// CToken Authority Failures +// Light Token Authority Failures // ============================================================================ #[tokio::test] @@ -706,7 +706,7 @@ async fn test_too_many_mints() { for _ in 0..5 { // Create new mint seed let mint_seed = Keypair::new(); - let (mint, _) = find_cmint_address(&mint_seed.pubkey()); + let (mint, _) = find_mint_address(&mint_seed.pubkey()); let (source_ata, _) = derive_token_ata(&context.owner.pubkey(), &mint); let (recipient_ata, _) = derive_token_ata(&context.recipient.pubkey(), &mint); @@ -735,7 +735,7 @@ async fn test_too_many_mints() { .await .unwrap(); - // Create mint and mint tokens to source CToken ATA + // Create mint and mint tokens to source Light Token ATA let decompressed_recipients = vec![Recipient::new(context.owner.pubkey(), 1000)]; light_token_client::actions::mint_action_comprehensive( @@ -746,7 +746,7 @@ async fn test_too_many_mints() { None, // no decompress mint false, // no close cmint vec![], // no compressed recipients - decompressed_recipients, // mint to source CToken ATA + decompressed_recipients, // mint to source Light Token ATA None, None, Some(light_token_client::instructions::mint_action::NewMint { diff --git a/program-tests/compressed-token-test/tests/transfer2/random.rs b/program-tests/compressed-token-test/tests/transfer2/random.rs index 6269d39f1d..300a2d9600 100644 --- a/program-tests/compressed-token-test/tests/transfer2/random.rs +++ b/program-tests/compressed-token-test/tests/transfer2/random.rs @@ -77,7 +77,7 @@ fn generate_random_test_case(rng: &mut StdRng, config: &TestConfig) -> TestCase _ => { continue; } - // 25% chance: Compress (SPL/CToken → compressed) + // 25% chance: Compress (SPL/Light Token → compressed) 300..=549 => { // Simplify: No compressed inputs for now to avoid ownership complexity let num_inputs = 0u8; @@ -87,7 +87,7 @@ fn generate_random_test_case(rng: &mut StdRng, config: &TestConfig) -> TestCase } total_outputs += estimated_outputs; - // Use CToken only for now (no SPL) + // Use Light Token only for now (no SPL) let use_spl = false; let mint_index = rng.gen_range(0..config.max_supported_mints); @@ -103,7 +103,7 @@ fn generate_random_test_case(rng: &mut StdRng, config: &TestConfig) -> TestCase }) } - // 25% chance: Decompress (compressed → SPL/CToken) + // 25% chance: Decompress (compressed → SPL/Light Token) 550..=799 => { // Calculate how many inputs we can still add let max_inputs_remaining = 8u8.saturating_sub(total_inputs); @@ -116,7 +116,7 @@ fn generate_random_test_case(rng: &mut StdRng, config: &TestConfig) -> TestCase total_outputs += estimated_outputs; total_inputs += num_inputs; - // For now, only decompress to CToken (to_spl requires SPL-compressed tokens) + // For now, only decompress to Light Token (to_spl requires SPL-compressed tokens) let to_spl = false; let mint_index = rng.gen_range(0..config.max_supported_mints); @@ -244,13 +244,13 @@ fn balance_actions(actions: &mut Vec, _config: &Te // Append a Compress action to create the missing tokens // Order doesn't matter since all actions are batched in one transaction let compress_action = MetaTransfer2InstructionType::Compress(MetaCompressInput { - num_input_compressed_accounts: 0, // No compressed inputs, compress from CToken + num_input_compressed_accounts: 0, // No compressed inputs, compress from Light Token amount: amount_needed, token_data_version: TokenDataVersion::V2, // Default version signer_index: key.0, recipient_index: key.0, // Compress to same signer mint_index: key.1, - use_spl: false, // Use CToken ATA + use_spl: false, // Use Light Token ATA pool_index: None, }); diff --git a/program-tests/compressed-token-test/tests/transfer2/shared.rs b/program-tests/compressed-token-test/tests/transfer2/shared.rs index f1684f215a..e76d0bbb85 100644 --- a/program-tests/compressed-token-test/tests/transfer2/shared.rs +++ b/program-tests/compressed-token-test/tests/transfer2/shared.rs @@ -26,7 +26,7 @@ use light_token_interface::{ state::TokenDataVersion, }; use light_token_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, + compressed_token::create_compressed_mint::{derive_mint_compressed_address, find_mint_address}, token::{CompressibleParams, CreateAssociatedTokenAccount}, }; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer, transaction::Transaction}; @@ -181,7 +181,7 @@ pub struct MetaDecompressInput { pub signer_index: usize, // Index of keypair that signs this action pub recipient_index: usize, // Index of keypair to receive decompressed tokens pub mint_index: usize, // Index of which mint to use (0-4) - pub to_spl: bool, // If true, decompress to SPL; if false, decompress to CToken ATA + pub to_spl: bool, // If true, decompress to SPL; if false, decompress to Light Token ATA pub pool_index: Option, // For SPL only. None = default (0), Some(n) = specific pool } @@ -193,7 +193,7 @@ pub struct MetaCompressInput { pub signer_index: usize, // Index of keypair that signs this action pub recipient_index: usize, // Index of keypair to receive compressed tokens pub mint_index: usize, // Index of which mint to use (0-4) - pub use_spl: bool, // If true, use SPL token account; if false, use CToken ATA + pub use_spl: bool, // If true, use SPL token account; if false, use Light Token ATA pub pool_index: Option, // For SPL only. None = default (0), Some(n) = specific pool } @@ -203,7 +203,7 @@ pub struct MetaCompressAndCloseInput { pub signer_index: usize, // Index of keypair that signs this action pub destination_index: Option, // Index of keypair to receive lamports (None = no destination) pub mint_index: usize, // Index of which mint to use (0-4) - pub is_compressible: bool, // If true, account has extensions (compressible); if false, regular CToken ATA + pub is_compressible: bool, // If true, account has extensions (compressible); if false, regular Light Token ATA } #[derive(Debug, Clone)] @@ -238,7 +238,7 @@ struct TestRequirements { pub signer_mint_compressed_amounts: HashMap<(usize, usize), HashMap>>, pub signer_solana_amounts: HashMap, // For compress operations - pub signer_ctoken_amounts: HashMap<(usize, usize), u64>, // For CToken accounts (signer_index, mint_index) -> amount + pub signer_ctoken_amounts: HashMap<(usize, usize), u64>, // For Light Token accounts (signer_index, mint_index) -> amount pub signer_spl_amounts: HashMap<(usize, usize), u64>, // For SPL token accounts (signer_index, mint_index) -> amount pub signer_ctoken_compressible: HashMap<(usize, usize), bool>, // Track which accounts need compressible extensions } @@ -252,7 +252,7 @@ pub struct TestContext { mint_seeds: Vec, // Mint seeds used to derive mints mint_authorities: Vec, // One authority per mint payer: Keypair, - ctoken_atas: HashMap<(usize, usize), Pubkey>, // (signer_index, mint_index) -> CToken ATA pubkey + ctoken_atas: HashMap<(usize, usize), Pubkey>, // (signer_index, mint_index) -> Light Token ATA pubkey spl_token_accounts: HashMap<(usize, usize), Keypair>, // (signer_index, mint_index) -> SPL token account keypair config: TestConfig, } @@ -317,9 +317,9 @@ impl TestContext { mint_seeds.push(Keypair::new()); // Dummy seed for SPL mints mint_authorities.push(payer.insecure_clone()); // Use payer as authority for SPL mints } else { - // Create compressed mint for CToken operations + // Create compressed mint for Light Token operations let mint_seed = Keypair::new(); - let (mint, _) = find_cmint_address(&mint_seed.pubkey()); + let (mint, _) = find_mint_address(&mint_seed.pubkey()); create_mint( &mut rpc, @@ -429,7 +429,7 @@ impl TestContext { // Get compressible config from test accounts (already created in program test setup) let funding_pool_config = rpc.test_accounts.funding_pool_config; - // Create CToken ATAs for compress/decompress operations + // Create Light Token ATAs for compress/decompress operations let mut ctoken_atas = HashMap::new(); for ((signer_index, mint_index), &amount) in &requirements.signer_ctoken_amounts { let mint = mints[*mint_index]; @@ -443,12 +443,12 @@ impl TestContext { .get(&(*signer_index, *mint_index)) .unwrap_or(&false); - // Create CToken ATA (compressible or regular based on requirements) + // Create Light Token ATA (compressible or regular based on requirements) let (ata, bump) = light_token_sdk::token::derive_token_ata(&signer.pubkey(), &mint); let create_ata_ix = if is_compressible { println!( - "Creating compressible CToken ATA for signer {} mint {}", + "Creating compressible Light Token ATA for signer {} mint {}", signer_index, mint_index ); let compressible_params = CompressibleParams { @@ -465,7 +465,7 @@ impl TestContext { .instruction() .unwrap() } else { - // Create non-compressible CToken ATA + // Create non-compressible Light Token ATA CreateAssociatedTokenAccount { idempotent: false, bump, @@ -483,10 +483,10 @@ impl TestContext { .await .unwrap(); - // Mint tokens to the CToken ATA if amount > 0 + // Mint tokens to the Light Token ATA if amount > 0 if amount > 0 { println!( - "Minting {} tokens to CToken ATA for signer {} from mint {} ({})", + "Minting {} tokens to Light Token ATA for signer {} from mint {} ({})", amount, signer_index, mint_index, mint ); @@ -494,10 +494,7 @@ impl TestContext { // Get the compressed mint address let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address( - &mint_seed.pubkey(), - &address_tree_pubkey, - ); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); light_token_client::actions::mint_action( &mut rpc, @@ -589,11 +586,15 @@ impl TestContext { let is_spl_mint = mint_needs_spl[decompress.mint_index]; // If it's an SPL mint, we need to compress SPL tokens to create compressed accounts - // This works for both SPL decompression (to_spl: true) and CToken decompression (to_spl: false) + // This works for both SPL decompression (to_spl: true) and Light Token decompression (to_spl: false) if is_spl_mint { let key = (decompress.signer_index, decompress.mint_index); if let Some(token_account_keypair) = spl_token_accounts.get(&key) { - let target = if decompress.to_spl { "SPL" } else { "CToken" }; + let target = if decompress.to_spl { + "SPL" + } else { + "Light Token" + }; println!( "Compressing SPL tokens for signer {} mint {} to create compressed accounts for {} decompression", decompress.signer_index, decompress.mint_index, target @@ -681,7 +682,7 @@ impl TestContext { .unwrap(); } } - // Note: For compressed mints, CToken decompression uses regular compressed tokens from normal minting + // Note: For compressed mints, Light Token decompression uses regular compressed tokens from normal minting } MetaTransfer2InstructionType::Compress(compress) if compress.use_spl && compress.num_input_compressed_accounts > 0 => @@ -878,7 +879,7 @@ impl TestContext { // Need SPL token account for recipient (no initial balance needed) signer_spl_amounts.entry(recipient_key).or_insert(0); } else { - // For CToken decompression, we need regular compressed tokens + // For Light Token decompression, we need regular compressed tokens let entry = signer_mint_compressed_amounts.entry(key).or_default(); let accounts_vec = entry.entry(decompress.token_data_version).or_default(); @@ -887,7 +888,7 @@ impl TestContext { accounts_vec.push(decompress.amount); } - // Need CToken ATA for recipient (no balance needed) + // Need Light Token ATA for recipient (no balance needed) signer_ctoken_amounts.entry(recipient_key).or_insert(0); } } @@ -933,17 +934,17 @@ impl TestContext { *signer_spl_amounts.entry(key).or_insert(0) += compress.amount; } } else { - // Compress from CToken needs CToken account with balance + // Compress from Light Token needs Light Token account with balance *signer_ctoken_amounts.entry(key).or_insert(0) += compress.amount; } } MetaTransfer2InstructionType::CompressAndClose(compress_and_close) => { - // CompressAndClose needs a CToken ATA with balance + // CompressAndClose needs a Light Token ATA with balance let key = ( compress_and_close.signer_index, compress_and_close.mint_index, ); - // Use default setup amount as the balance for the CToken ATA + // Use default setup amount as the balance for the Light Token ATA *signer_ctoken_amounts.entry(key).or_insert(0) += config.default_setup_amount; // Track whether this account needs compressible extensions signer_ctoken_compressible.insert(key, compress_and_close.is_compressible); @@ -1189,13 +1190,13 @@ impl TestContext { })?; keypair.pubkey() } else { - // Get CToken ATA + // Get Light Token ATA *self .ctoken_atas .get(&(meta.signer_index, meta.mint_index)) .ok_or_else(|| { format!( - "CToken ATA not found for signer {} mint {}", + "Light Token ATA not found for signer {} mint {}", meta.signer_index, meta.mint_index ) })? @@ -1247,13 +1248,13 @@ impl TestContext { })?; keypair.pubkey() } else { - // Get CToken ATA for the recipient + // Get Light Token ATA for the recipient *self .ctoken_atas .get(&(meta.recipient_index, meta.mint_index)) .ok_or_else(|| { format!( - "CToken ATA not found for recipient {} mint {}", + "Light Token ATA not found for recipient {} mint {}", meta.recipient_index, meta.mint_index ) })? @@ -1303,13 +1304,13 @@ impl TestContext { let merkle_trees = self.rpc.get_state_merkle_trees(); let output_queue = merkle_trees[0].accounts.nullifier_queue; - // Get the CToken ATA for the signer + // Get the Light Token ATA for the signer let ctoken_ata = *self .ctoken_atas .get(&(meta.signer_index, meta.mint_index)) .ok_or_else(|| { format!( - "CToken ATA not found for signer {} mint {}", + "Light Token ATA not found for signer {} mint {}", meta.signer_index, meta.mint_index ) })?; diff --git a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs index 9778dcad48..b475a64595 100644 --- a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs +++ b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs @@ -202,7 +202,7 @@ async fn test_spl_to_ctoken_transfer() { ); } - println!("Successfully completed round-trip transfer: SPL -> CToken -> SPL"); + println!("Successfully completed round-trip transfer: SPL -> Light Token -> SPL"); } #[tokio::test] @@ -260,7 +260,7 @@ async fn test_failing_ctoken_to_spl_with_compress_and_close() { .await .unwrap(); - // Transfer SPL to CToken + // Transfer SPL to Light Token transfer2::spl_to_ctoken_transfer( &mut rpc, spl_token_account_keypair.pubkey(), @@ -283,7 +283,7 @@ async fn test_failing_ctoken_to_spl_with_compress_and_close() { let ctoken_account = spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]) .map_err(|e| { - RpcError::AssertRpcError(format!("Failed to parse CToken account: {}", e)) + RpcError::AssertRpcError(format!("Failed to parse Light Token account: {}", e)) }) .unwrap(); assert_eq!( diff --git a/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs b/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs index 59ca09d704..6468b434cf 100644 --- a/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs +++ b/program-tests/compressed-token-test/tests/transfer2/transfer_failing.rs @@ -72,7 +72,7 @@ async fn setup_transfer_test( ) .await?; - let mint = light_token_sdk::compressed_token::create_compressed_mint::find_cmint_address( + let mint = light_token_sdk::compressed_token::create_compressed_mint::find_mint_address( &mint_seed.pubkey(), ) .0; @@ -683,7 +683,7 @@ async fn setup_transfer_test_with_delegate( ) .await?; - let mint = light_token_sdk::compressed_token::create_compressed_mint::find_cmint_address( + let mint = light_token_sdk::compressed_token::create_compressed_mint::find_mint_address( &mint_seed.pubkey(), ) .0; diff --git a/program-tests/registry-test/tests/compressible.rs b/program-tests/registry-test/tests/compressible.rs index 7799d328a9..127455191d 100644 --- a/program-tests/registry-test/tests/compressible.rs +++ b/program-tests/registry-test/tests/compressible.rs @@ -35,7 +35,7 @@ use light_token_client::{ instructions::mint_action::{DecompressMintParams, NewMint}, }; use light_token_sdk::{ - compressed_token::create_compressed_mint::find_cmint_address, + compressed_token::create_compressed_mint::find_mint_address, token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount, MintTo}, }; use solana_sdk::{ @@ -1232,7 +1232,7 @@ async fn assert_not_compressible_cmint( Ok(()) } -/// Helper function to mint tokens to a CToken account using MintTo instruction +/// Helper function to mint tokens to a Light Token account using MintTo instruction async fn mint_to_token( rpc: &mut R, cmint: Pubkey, @@ -1264,10 +1264,10 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { .unwrap(); let payer = rpc.get_payer().insecure_clone(); - // Create a CMint with compressible config (will be tested alongside CToken accounts) + // Create a CMint with compressible config (will be tested alongside Light Token accounts) let mint_seed = Keypair::new(); let mint_authority = payer.insecure_clone(); - let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (cmint_pda, _) = find_mint_address(&mint_seed.pubkey()); // Create CMint with write_top_up for infinite funding mint_action_comprehensive( @@ -1296,7 +1296,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { .await .unwrap(); - // Use the CMint PDA as the mint for CToken accounts + // Use the CMint PDA as the mint for Light Token accounts let mint = cmint_pda; // Create owner for both accounts @@ -1476,7 +1476,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { } println!("Test completed successfully!"); - println!("All accounts (CToken A, CToken B, CMint) remained well-funded through 100 epochs"); + println!("All accounts (Light Token A, Light Token B, CMint) remained well-funded through 100 epochs"); // Final verification assert_not_compressible(&mut rpc, account_a, "Account A (final)").await?; @@ -1487,7 +1487,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { let final_rent_sponsor_balance = rpc.get_account(rent_sponsor).await?.unwrap().lamports; let total_rent_claimed = final_rent_sponsor_balance - initial_rent_sponsor_balance; - // Get final last_claimed_slot from all accounts (CToken A, CToken B, CMint) + // Get final last_claimed_slot from all accounts (Light Token A, Light Token B, CMint) let final_last_claimed_a = get_last_claimed_slot_token(&rpc.get_account(account_a).await?.unwrap().data)?; let final_last_claimed_b = @@ -1516,7 +1516,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { // Assert exact match assert_eq!( total_rent_claimed, expected_total_rent, - "Rent claimed should exactly match expected rent (CToken A + CToken B + CMint)" + "Rent claimed should exactly match expected rent (Light Token A + Light Token B + CMint)" ); Ok(()) @@ -1532,7 +1532,7 @@ async fn test_claim_from_cmint_account() -> Result<(), RpcError> { let mint_authority = payer.insecure_clone(); // Create compressed mint + decompress to CMint with rent prepaid - let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (cmint_pda, _) = find_mint_address(&mint_seed.pubkey()); mint_action_comprehensive( &mut rpc, &mint_seed, @@ -1590,7 +1590,7 @@ async fn test_claim_mixed_token_and_cmint() -> Result<(), RpcError> { .unwrap(); let payer = rpc.get_payer().insecure_clone(); - // Create CToken account with prepaid rent + // Create Light Token account with prepaid rent let token_owner = Keypair::new(); let mint = Pubkey::new_unique(); let token_pubkey = create_compressible_token_account( @@ -1610,7 +1610,7 @@ async fn test_claim_mixed_token_and_cmint() -> Result<(), RpcError> { // Create CMint account with prepaid rent let mint_seed = Keypair::new(); - let (cmint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (cmint_pda, _) = find_mint_address(&mint_seed.pubkey()); mint_action_comprehensive( &mut rpc, &mint_seed, diff --git a/program-tests/utils/src/assert_claim.rs b/program-tests/utils/src/assert_claim.rs index 470f3ac96d..b9330d5b51 100644 --- a/program-tests/utils/src/assert_claim.rs +++ b/program-tests/utils/src/assert_claim.rs @@ -7,7 +7,7 @@ use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyAtMut}; use solana_sdk::{clock::Clock, pubkey::Pubkey}; /// Determines account type from account data. -/// - If account is exactly 165 bytes: CToken (legacy size without extensions) +/// - If account is exactly 165 bytes: Light Token (legacy size without extensions) /// - If account is > 165 bytes: read byte 165 for discriminator /// - If account is < 165 bytes: invalid (returns None) fn determine_account_type(data: &[u8]) -> Option { @@ -44,9 +44,9 @@ fn extract_pre_compression_mut( ACCOUNT_TYPE_TOKEN_ACCOUNT => { let (mut ctoken, _) = Token::zero_copy_at_mut(data) .unwrap_or_else(|e| panic!("Failed to parse ctoken account {}: {:?}", pubkey, e)); - let compressible = ctoken - .get_compressible_extension_mut() - .unwrap_or_else(|| panic!("CToken {} should have Compressible extension", pubkey)); + let compressible = ctoken.get_compressible_extension_mut().unwrap_or_else(|| { + panic!("Light Token {} should have Compressible extension", pubkey) + }); let compression = &mut compressible.info; let last_claimed_slot = u64::from(compression.last_claimed_slot); let compression_authority = Pubkey::from(compression.compression_authority); @@ -93,9 +93,9 @@ fn extract_post_compression(data: &[u8], pubkey: &Pubkey) -> u64 { ACCOUNT_TYPE_TOKEN_ACCOUNT => { let (ctoken, _) = Token::zero_copy_at(data) .unwrap_or_else(|e| panic!("Failed to parse ctoken account {}: {:?}", pubkey, e)); - let compressible = ctoken - .get_compressible_extension() - .unwrap_or_else(|| panic!("CToken {} should have Compressible extension", pubkey)); + let compressible = ctoken.get_compressible_extension().unwrap_or_else(|| { + panic!("Light Token {} should have Compressible extension", pubkey) + }); u64::from(compressible.info.last_claimed_slot) } ACCOUNT_TYPE_MINT => { @@ -128,14 +128,14 @@ pub async fn assert_claim( // Must have > 165 bytes to include account_type discriminator assert!( pre_token_account.data.len() > 165, - "Account must have > 165 bytes for CToken/CMint" + "Account must have > 165 bytes for Light Token/CMint" ); // Get account size and lamports before parsing (to avoid borrow conflicts) let account_size = pre_token_account.data.len() as u64; let account_lamports = pre_token_account.lamports; let current_slot = rpc.pre_context.as_ref().unwrap().get_sysvar::().slot; - // Extract compression info (handles both CToken and CMint) + // Extract compression info (handles both Light Token and CMint) let pre_data = extract_pre_compression_mut( &mut pre_token_account.data, account_size, diff --git a/program-tests/utils/src/assert_ctoken_approve_revoke.rs b/program-tests/utils/src/assert_ctoken_approve_revoke.rs index dd579dba72..4e069d9f38 100644 --- a/program-tests/utils/src/assert_ctoken_approve_revoke.rs +++ b/program-tests/utils/src/assert_ctoken_approve_revoke.rs @@ -1,4 +1,4 @@ -//! Assertion helpers for CToken approve and revoke operations. +//! Assertion helpers for Light Token approve and revoke operations. //! //! These functions verify that approve/revoke operations correctly modify //! only the delegate and delegated_amount fields while preserving all other @@ -10,7 +10,7 @@ use light_program_test::LightProgramTest; use light_token_interface::state::Token; use solana_sdk::pubkey::Pubkey; -/// Assert that a CToken approve operation was successful. +/// Assert that a Light Token approve operation was successful. /// /// Pattern: Get pre-state, build expected by modifying only changed fields, /// single assert_eq against post-state. @@ -38,11 +38,11 @@ pub async fn assert_ctoken_approve( .expect("Failed to get account after transaction") .expect("Token account should exist after transaction"); - // Parse pre and post CToken states - let pre_ctoken = - Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = - Token::deserialize(&mut &post_account.data[..]).expect("Failed to deserialize post CToken"); + // Parse pre and post Light Token states + let pre_ctoken = Token::deserialize(&mut &pre_account.data[..]) + .expect("Failed to deserialize pre Light Token"); + let post_ctoken = Token::deserialize(&mut &post_account.data[..]) + .expect("Failed to deserialize post Light Token"); // Build expected by modifying only the changed fields from pre-state let expected_ctoken = Token { @@ -53,12 +53,12 @@ pub async fn assert_ctoken_approve( assert_eq!( post_ctoken, expected_ctoken, - "CToken after approve should have delegate={} and delegated_amount={}, all other fields unchanged", + "Light Token after approve should have delegate={} and delegated_amount={}, all other fields unchanged", delegate, amount ); } -/// Assert that a CToken revoke operation was successful. +/// Assert that a Light Token revoke operation was successful. /// /// Pattern: Get pre-state, build expected by modifying only changed fields, /// single assert_eq against post-state. @@ -79,11 +79,11 @@ pub async fn assert_ctoken_revoke(rpc: &mut LightProgramTest, token_account: Pub .expect("Failed to get account after transaction") .expect("Token account should exist after transaction"); - // Parse pre and post CToken states - let pre_ctoken = - Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = - Token::deserialize(&mut &post_account.data[..]).expect("Failed to deserialize post CToken"); + // Parse pre and post Light Token states + let pre_ctoken = Token::deserialize(&mut &pre_account.data[..]) + .expect("Failed to deserialize pre Light Token"); + let post_ctoken = Token::deserialize(&mut &post_account.data[..]) + .expect("Failed to deserialize post Light Token"); // Build expected by modifying only the changed fields from pre-state let expected_ctoken = Token { @@ -94,6 +94,6 @@ pub async fn assert_ctoken_revoke(rpc: &mut LightProgramTest, token_account: Pub assert_eq!( post_ctoken, expected_ctoken, - "CToken after revoke should have delegate=None and delegated_amount=0, all other fields unchanged" + "Light Token after revoke should have delegate=None and delegated_amount=0, all other fields unchanged" ); } diff --git a/program-tests/utils/src/assert_ctoken_burn.rs b/program-tests/utils/src/assert_ctoken_burn.rs index 10f3fd2b69..74b3dcab96 100644 --- a/program-tests/utils/src/assert_ctoken_burn.rs +++ b/program-tests/utils/src/assert_ctoken_burn.rs @@ -5,7 +5,7 @@ use light_program_test::LightProgramTest; use light_token_interface::state::{extensions::ExtensionStruct, CompressedMint, Token}; use solana_sdk::pubkey::Pubkey; -/// Extract CompressionInfo from CToken's Compressible extension +/// Extract CompressionInfo from Light Token's Compressible extension fn get_ctoken_compression_info(ctoken: &Token) -> Option { ctoken .extensions @@ -22,12 +22,12 @@ fn get_ctoken_compression_info(ctoken: &Token) -> Option { /// /// # Arguments /// * `rpc` - RPC client to fetch account data (must be LightProgramTest) -/// * `ctoken_account` - Source CToken account pubkey +/// * `ctoken_account` - Source Light Token account pubkey /// * `cmint_account` - CMint account pubkey /// * `burn_amount` - Amount that was burned /// /// # Assertions -/// * CToken balance decreased by burn amount +/// * Light Token balance decreased by burn amount /// * CMint supply decreased by burn amount /// * Compressible extensions preserved (if present) /// * Lamport top-ups applied correctly (if compressible) @@ -40,7 +40,7 @@ pub async fn assert_ctoken_burn( // Get pre-transaction state from cache let ctoken_before = rpc .get_pre_transaction_account(&ctoken_account) - .expect("CToken account should exist in pre-transaction context"); + .expect("Light Token account should exist in pre-transaction context"); let cmint_before = rpc .get_pre_transaction_account(&cmint_account) .expect("CMint account should exist in pre-transaction context"); @@ -49,8 +49,8 @@ pub async fn assert_ctoken_burn( let ctoken_after = rpc .get_account(ctoken_account) .await - .expect("Failed to get CToken account after transaction") - .expect("CToken account should exist after transaction"); + .expect("Failed to get Light Token account after transaction") + .expect("Light Token account should exist after transaction"); let cmint_after = rpc .get_account(cmint_account) .await @@ -60,10 +60,10 @@ pub async fn assert_ctoken_burn( // Parse accounts using Borsh let ctoken_parsed_before: Token = BorshDeserialize::deserialize(&mut ctoken_before.data.as_slice()) - .expect("Failed to deserialize CToken before"); + .expect("Failed to deserialize Light Token before"); let ctoken_parsed_after: Token = BorshDeserialize::deserialize(&mut ctoken_after.data.as_slice()) - .expect("Failed to deserialize CToken after"); + .expect("Failed to deserialize Light Token after"); let cmint_parsed_before: CompressedMint = BorshDeserialize::deserialize(&mut cmint_before.data.as_slice()) .expect("Failed to deserialize CMint before"); @@ -71,7 +71,7 @@ pub async fn assert_ctoken_burn( BorshDeserialize::deserialize(&mut cmint_after.data.as_slice()) .expect("Failed to deserialize CMint after"); - // Build expected CToken state + // Build expected Light Token state let mut expected_ctoken = ctoken_parsed_before.clone(); expected_ctoken.amount -= burn_amount; @@ -79,10 +79,10 @@ pub async fn assert_ctoken_burn( let mut expected_cmint = cmint_parsed_before.clone(); expected_cmint.base.supply -= burn_amount; - // Assert full CToken struct + // Assert full Light Token struct assert_eq!( ctoken_parsed_after, expected_ctoken, - "CToken state mismatch after burn. burn_amount: {}", + "Light Token state mismatch after burn. burn_amount: {}", burn_amount ); diff --git a/program-tests/utils/src/assert_ctoken_freeze_thaw.rs b/program-tests/utils/src/assert_ctoken_freeze_thaw.rs index c4e28896ce..18e532a097 100644 --- a/program-tests/utils/src/assert_ctoken_freeze_thaw.rs +++ b/program-tests/utils/src/assert_ctoken_freeze_thaw.rs @@ -1,4 +1,4 @@ -//! Assertion helpers for CToken freeze and thaw operations. +//! Assertion helpers for Light Token freeze and thaw operations. //! //! These functions verify that freeze/thaw operations correctly modify //! only the state field while preserving all other account state including @@ -10,7 +10,7 @@ use light_program_test::LightProgramTest; use light_token_interface::state::{AccountState, Token}; use solana_sdk::pubkey::Pubkey; -/// Assert that a CToken freeze operation was successful. +/// Assert that a Light Token freeze operation was successful. /// /// Pattern: Get pre-state, build expected by modifying only changed fields, /// single assert_eq against post-state. @@ -31,11 +31,11 @@ pub async fn assert_ctoken_freeze(rpc: &mut LightProgramTest, token_account: Pub .expect("Failed to get account after transaction") .expect("Token account should exist after transaction"); - // Parse pre and post CToken states - let pre_ctoken = - Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = - Token::deserialize(&mut &post_account.data[..]).expect("Failed to deserialize post CToken"); + // Parse pre and post Light Token states + let pre_ctoken = Token::deserialize(&mut &pre_account.data[..]) + .expect("Failed to deserialize pre Light Token"); + let post_ctoken = Token::deserialize(&mut &post_account.data[..]) + .expect("Failed to deserialize post Light Token"); // Build expected by modifying only the changed fields from pre-state let expected_ctoken = Token { @@ -45,11 +45,11 @@ pub async fn assert_ctoken_freeze(rpc: &mut LightProgramTest, token_account: Pub assert_eq!( post_ctoken, expected_ctoken, - "CToken after freeze should have state=Frozen, all other fields unchanged" + "Light Token after freeze should have state=Frozen, all other fields unchanged" ); } -/// Assert that a CToken thaw operation was successful. +/// Assert that a Light Token thaw operation was successful. /// /// Pattern: Get pre-state, build expected by modifying only changed fields, /// single assert_eq against post-state. @@ -70,11 +70,11 @@ pub async fn assert_ctoken_thaw(rpc: &mut LightProgramTest, token_account: Pubke .expect("Failed to get account after transaction") .expect("Token account should exist after transaction"); - // Parse pre and post CToken states - let pre_ctoken = - Token::deserialize(&mut &pre_account.data[..]).expect("Failed to deserialize pre CToken"); - let post_ctoken = - Token::deserialize(&mut &post_account.data[..]).expect("Failed to deserialize post CToken"); + // Parse pre and post Light Token states + let pre_ctoken = Token::deserialize(&mut &pre_account.data[..]) + .expect("Failed to deserialize pre Light Token"); + let post_ctoken = Token::deserialize(&mut &post_account.data[..]) + .expect("Failed to deserialize post Light Token"); // Build expected by modifying only the changed fields from pre-state let expected_ctoken = Token { @@ -84,6 +84,6 @@ pub async fn assert_ctoken_thaw(rpc: &mut LightProgramTest, token_account: Pubke assert_eq!( post_ctoken, expected_ctoken, - "CToken after thaw should have state=Initialized, all other fields unchanged" + "Light Token after thaw should have state=Initialized, all other fields unchanged" ); } diff --git a/program-tests/utils/src/assert_ctoken_mint_to.rs b/program-tests/utils/src/assert_ctoken_mint_to.rs index 74dd8c3387..77ce472354 100644 --- a/program-tests/utils/src/assert_ctoken_mint_to.rs +++ b/program-tests/utils/src/assert_ctoken_mint_to.rs @@ -5,7 +5,7 @@ use light_program_test::LightProgramTest; use light_token_interface::state::{extensions::ExtensionStruct, CompressedMint, Token}; use solana_sdk::pubkey::Pubkey; -/// Extract CompressionInfo from CToken's Compressible extension +/// Extract CompressionInfo from Light Token's Compressible extension fn get_ctoken_compression_info(ctoken: &Token) -> Option { ctoken .extensions @@ -22,12 +22,12 @@ fn get_ctoken_compression_info(ctoken: &Token) -> Option { /// /// # Arguments /// * `rpc` - RPC client to fetch account data (must be LightProgramTest) -/// * `ctoken_account` - Destination CToken account pubkey +/// * `ctoken_account` - Destination Light Token account pubkey /// * `cmint_account` - CMint account pubkey /// * `mint_amount` - Amount that was minted /// /// # Assertions -/// * CToken balance increased by mint amount +/// * Light Token balance increased by mint amount /// * CMint supply increased by mint amount /// * Compressible extensions preserved (if present) /// * Lamport top-ups applied correctly (if compressible) @@ -40,7 +40,7 @@ pub async fn assert_ctoken_mint_to( // Get pre-transaction state from cache let ctoken_before = rpc .get_pre_transaction_account(&ctoken_account) - .expect("CToken account should exist in pre-transaction context"); + .expect("Light Token account should exist in pre-transaction context"); let cmint_before = rpc .get_pre_transaction_account(&cmint_account) .expect("CMint account should exist in pre-transaction context"); @@ -49,8 +49,8 @@ pub async fn assert_ctoken_mint_to( let ctoken_after = rpc .get_account(ctoken_account) .await - .expect("Failed to get CToken account after transaction") - .expect("CToken account should exist after transaction"); + .expect("Failed to get Light Token account after transaction") + .expect("Light Token account should exist after transaction"); let cmint_after = rpc .get_account(cmint_account) .await @@ -60,10 +60,10 @@ pub async fn assert_ctoken_mint_to( // Parse accounts using Borsh let ctoken_parsed_before: Token = BorshDeserialize::deserialize(&mut ctoken_before.data.as_slice()) - .expect("Failed to deserialize CToken before"); + .expect("Failed to deserialize Light Token before"); let ctoken_parsed_after: Token = BorshDeserialize::deserialize(&mut ctoken_after.data.as_slice()) - .expect("Failed to deserialize CToken after"); + .expect("Failed to deserialize Light Token after"); let cmint_parsed_before: CompressedMint = BorshDeserialize::deserialize(&mut cmint_before.data.as_slice()) .expect("Failed to deserialize CMint before"); @@ -71,7 +71,7 @@ pub async fn assert_ctoken_mint_to( BorshDeserialize::deserialize(&mut cmint_after.data.as_slice()) .expect("Failed to deserialize CMint after"); - // Build expected CToken state + // Build expected Light Token state let mut expected_ctoken = ctoken_parsed_before.clone(); expected_ctoken.amount += mint_amount; @@ -79,10 +79,10 @@ pub async fn assert_ctoken_mint_to( let mut expected_cmint = cmint_parsed_before.clone(); expected_cmint.base.supply += mint_amount; - // Assert full CToken struct + // Assert full Light Token struct assert_eq!( ctoken_parsed_after, expected_ctoken, - "CToken state mismatch after mint_to. mint_amount: {}", + "Light Token state mismatch after mint_to. mint_amount: {}", mint_amount ); diff --git a/program-tests/utils/src/assert_mint_action.rs b/program-tests/utils/src/assert_mint_action.rs index 90a6e03770..24843dec28 100644 --- a/program-tests/utils/src/assert_mint_action.rs +++ b/program-tests/utils/src/assert_mint_action.rs @@ -11,7 +11,7 @@ use light_token_interface::state::{ }; use solana_sdk::pubkey::Pubkey; -/// Extract CompressionInfo from CToken's Compressible extension +/// Extract CompressionInfo from Light Token's Compressible extension fn get_ctoken_compression_info(ctoken: &Token) -> Option { ctoken .extensions @@ -33,7 +33,7 @@ fn get_ctoken_compression_info(ctoken: &Token) -> Option { /// /// # Assertions /// * Single assert_eq! comparing actual vs expected mint state -/// * Validates CToken account balances for MintToCToken actions +/// * Validates Light Token account balances for MintToCToken actions pub async fn assert_mint_action( rpc: &mut LightProgramTest, compressed_mint_address: [u8; 32], @@ -43,7 +43,7 @@ pub async fn assert_mint_action( // Build expected state by applying actions to pre-state let mut expected_mint = pre_compressed_mint.clone(); - // Track CToken mints for later validation (deduplicate and sum amounts) + // Track Light Token mints for later validation (deduplicate and sum amounts) let mut ctoken_mints: HashMap = HashMap::new(); for action in actions.iter() { @@ -231,14 +231,14 @@ pub async fn assert_mint_action( "CMint PDA account should not exist after CompressAndCloseCMint action" ); } - // Verify CToken accounts for MintToCToken actions + // Verify Light Token accounts for MintToCToken actions for (account_pubkey, total_minted_amount) in ctoken_mints { // Get pre-transaction account state let pre_account = rpc .get_pre_transaction_account(&account_pubkey) - .expect("CToken account should exist before minting"); + .expect("Light Token account should exist before minting"); - // Parse pre-transaction CToken state + // Parse pre-transaction Light Token state let mut pre_ctoken: Token = BorshDeserialize::deserialize(&mut &pre_account.data[..]).unwrap(); @@ -256,7 +256,7 @@ pub async fn assert_mint_action( // Assert token amount matches expected assert_eq!( post_ctoken.amount, pre_ctoken.amount, - "CToken account state at {} should have {} tokens after minting, got {}", + "Light Token account state at {} should have {} tokens after minting, got {}", account_pubkey, pre_ctoken.amount, post_ctoken.amount ); @@ -279,7 +279,7 @@ pub async fn assert_mint_action( assert_eq!( actual_lamport_change, expected_top_up, - "CToken account at {} should receive {} lamports top-up, got {}", + "Light Token account at {} should receive {} lamports top-up, got {}", account_pubkey, expected_top_up, actual_lamport_change ); diff --git a/program-tests/utils/src/assert_mint_to_compressed.rs b/program-tests/utils/src/assert_mint_to_compressed.rs index a432fb8d1b..9e0514b3ab 100644 --- a/program-tests/utils/src/assert_mint_to_compressed.rs +++ b/program-tests/utils/src/assert_mint_to_compressed.rs @@ -8,7 +8,7 @@ use light_compressed_token::instructions::create_token_pool::find_token_pool_pda use light_token_interface::{ instructions::mint_action::Recipient, state::CompressedMint, LIGHT_TOKEN_PROGRAM_ID, }; -use light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_from_spl_mint; +use light_token_sdk::compressed_token::create_compressed_mint::derive_mint_from_spl_mint; use solana_sdk::{program_pack::Pack, pubkey::Pubkey}; pub async fn assert_mint_to_compressed( @@ -21,7 +21,7 @@ pub async fn assert_mint_to_compressed( ) -> Vec { // Derive compressed mint address from SPL mint PDA (same as instruction) let address_tree_pubkey = rpc.get_address_tree_v2().tree; - let compressed_mint_address = derive_cmint_from_spl_mint(&spl_mint_pda, &address_tree_pubkey); + let compressed_mint_address = derive_mint_from_spl_mint(&spl_mint_pda, &address_tree_pubkey); // Verify each recipient received their tokens let mut all_token_accounts = Vec::new(); let mut total_minted = 0u64; diff --git a/program-tests/utils/src/assert_transfer2.rs b/program-tests/utils/src/assert_transfer2.rs index 82e62952a2..96c08b044a 100644 --- a/program-tests/utils/src/assert_transfer2.rs +++ b/program-tests/utils/src/assert_transfer2.rs @@ -55,7 +55,7 @@ pub async fn assert_transfer2_with_delegate( .get_pre_transaction_account(&pubkey) .expect("SPL token account should exist in pre-transaction context"); - // CToken accounts are 166 bytes, SPL token expects 165 bytes + // Light Token accounts are 166 bytes, SPL token expects 165 bytes spl_token_2022::state::Account::unpack(&pre_account_data.data[..165]) .expect("Failed to unpack SPL token account") }); diff --git a/sdk-libs/macros/src/compressible/GUIDE.md b/sdk-libs/macros/src/compressible/GUIDE.md index 02bb232932..599db88b56 100644 --- a/sdk-libs/macros/src/compressible/GUIDE.md +++ b/sdk-libs/macros/src/compressible/GUIDE.md @@ -86,8 +86,8 @@ pub mod my_program {} - Create a compressed mint: - `create_compressed_mint(CreateCompressedMintInputs { decimals, mint_authority, freeze_authority, proof, address_merkle_tree_root_index, mint_signer, payer, address_tree_pubkey, output_queue, extensions, version })` - Derive addresses with: - - `derive_cmint_compressed_address(&mint_signer, &address_tree_pubkey)` - - `find_cmint_address(&mint_signer)` + - `derive_mint_compressed_address(&mint_signer, &address_tree_pubkey)` + - `find_mint_address(&mint_signer)` - Mint tokens to compressed accounts: - `create_mint_to_compressed_instruction(MintToCompressedInputs { compressed_mint_inputs, recipients, mint_authority, payer, state_merkle_tree, input_queue, output_queue_cmint, output_queue_tokens, decompressed_mint_config, proof, token_account_version, cpi_context_pubkey, token_pool })` @@ -101,8 +101,8 @@ Keep it simple: create cMint → mint to recipients (compressed accounts or cTok - Low-level: `create_compressible_token_account_instruction(CreateCompressibleTokenAccount)` - Mints - `create_compressed_mint(CreateCompressedMintInputs)` - - `derive_cmint_compressed_address(mint_seed, address_tree)` - - `find_cmint_address(mint_seed)` + - `derive_mint_compressed_address(mint_seed, address_tree)` + - `find_mint_address(mint_seed)` - Mint to recipients - `create_mint_to_compressed_instruction(MintToCompressedInputs)` - Types: `Recipient { recipient, amount }` diff --git a/sdk-libs/macros/src/compressible/seed_providers.rs b/sdk-libs/macros/src/compressible/seed_providers.rs index 52379b9a52..0f668cfa72 100644 --- a/sdk-libs/macros/src/compressible/seed_providers.rs +++ b/sdk-libs/macros/src/compressible/seed_providers.rs @@ -1,4 +1,4 @@ -//! Seed provider generation for PDA and CToken accounts. +//! Seed provider generation for PDA and Light Token accounts. use proc_macro2::TokenStream; use quote::{format_ident, quote}; diff --git a/sdk-libs/program-test/src/forester/compress_and_close_forester.rs b/sdk-libs/program-test/src/forester/compress_and_close_forester.rs index 822066d5ce..60d17074aa 100644 --- a/sdk-libs/program-test/src/forester/compress_and_close_forester.rs +++ b/sdk-libs/program-test/src/forester/compress_and_close_forester.rs @@ -103,7 +103,7 @@ pub async fn compress_and_close_forester( })? .ok_or_else(|| { RpcError::CustomError(format!( - "CToken account {} not found", + "Light Token account {} not found", solana_ctoken_account_pubkey )) })?; @@ -123,7 +123,9 @@ pub async fn compress_and_close_forester( // Get compression info from Compressible extension let compressible_ext = ctoken_account.get_compressible_extension().ok_or_else(|| { - RpcError::CustomError("Missing Compressible extension on CToken account".to_string()) + RpcError::CustomError( + "Missing Compressible extension on Light Token account".to_string(), + ) })?; let current_authority = Pubkey::from(compressible_ext.info.compression_authority); let rent_sponsor_pubkey = Pubkey::from(compressible_ext.info.rent_sponsor); diff --git a/sdk-libs/token-client/src/actions/mint_action.rs b/sdk-libs/token-client/src/actions/mint_action.rs index 81a3f1e9e9..654dceaa0d 100644 --- a/sdk-libs/token-client/src/actions/mint_action.rs +++ b/sdk-libs/token-client/src/actions/mint_action.rs @@ -4,7 +4,7 @@ use light_client::{ }; use light_token_interface::instructions::mint_action::Recipient; use light_token_sdk::compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, + derive_mint_compressed_address, find_mint_address, }; use solana_keypair::Keypair; use solana_pubkey::Pubkey; @@ -84,7 +84,7 @@ pub async fn mint_action_comprehensive( // Derive addresses let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Build actions let mut actions = Vec::new(); @@ -107,7 +107,7 @@ pub async fn mint_action_comprehensive( if !mint_to_decompressed_recipients.is_empty() { use light_token_sdk::token::derive_token_ata; - let (spl_mint_pda, _) = find_cmint_address(&mint_seed.pubkey()); + let (spl_mint_pda, _) = find_mint_address(&mint_seed.pubkey()); for recipient in mint_to_decompressed_recipients { let recipient_pubkey = solana_pubkey::Pubkey::from(recipient.recipient.to_bytes()); @@ -136,7 +136,7 @@ pub async fn mint_action_comprehensive( // Check before moving to use later for mint_signer determination let has_decompress_mint = decompress_mint.is_some(); if let Some(decompress_params) = decompress_mint { - let (_, cmint_bump) = find_cmint_address(&mint_seed.pubkey()); + let (_, cmint_bump) = find_mint_address(&mint_seed.pubkey()); actions.push(MintActionType::DecompressMint { cmint_bump, rent_payment: decompress_params.rent_payment, diff --git a/sdk-libs/token-client/src/instructions/create_mint.rs b/sdk-libs/token-client/src/instructions/create_mint.rs index 3cffc9cdd4..e2fee436e5 100644 --- a/sdk-libs/token-client/src/instructions/create_mint.rs +++ b/sdk-libs/token-client/src/instructions/create_mint.rs @@ -6,7 +6,7 @@ use light_token_interface::instructions::extensions::{ token_metadata::TokenMetadataInstructionData, ExtensionInstructionData, }; use light_token_sdk::token::{ - derive_cmint_compressed_address, find_cmint_address, CreateCMint, CreateCMintParams, + derive_mint_compressed_address, find_mint_address, CreateMint, CreateMintParams, }; use solana_instruction::Instruction; use solana_keypair::Keypair; @@ -41,7 +41,7 @@ pub async fn create_compressed_mint_instruction( let output_queue = rpc.get_random_state_tree_info()?.queue; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Create extensions if metadata is provided let extensions = metadata.map(|meta| vec![ExtensionInstructionData::TokenMetadata(meta)]); @@ -62,19 +62,19 @@ pub async fn create_compressed_mint_instruction( let address_merkle_tree_root_index = rpc_result.addresses[0].root_index; // Build params struct manually - let params = CreateCMintParams { + let params = CreateMintParams { decimals, address_merkle_tree_root_index, mint_authority, proof: rpc_result.proof.0.unwrap(), compression_address: compressed_mint_address, - mint: find_cmint_address(&mint_seed.pubkey()).0, + mint: find_mint_address(&mint_seed.pubkey()).0, freeze_authority, extensions, }; // Create instruction builder - let builder = CreateCMint::new( + let builder = CreateMint::new( params, mint_seed.pubkey(), payer, diff --git a/sdk-libs/token-client/src/instructions/mint_action.rs b/sdk-libs/token-client/src/instructions/mint_action.rs index f2b210295f..0a325df35b 100644 --- a/sdk-libs/token-client/src/instructions/mint_action.rs +++ b/sdk-libs/token-client/src/instructions/mint_action.rs @@ -19,7 +19,7 @@ use light_token_interface::{ LIGHT_TOKEN_PROGRAM_ID, }; use light_token_sdk::compressed_token::{ - create_compressed_mint::{derive_cmint_compressed_address, find_cmint_address}, + create_compressed_mint::{derive_mint_compressed_address, find_mint_address}, mint_action::MintActionMetaConfig, }; use solana_instruction::Instruction; @@ -155,7 +155,7 @@ pub async fn create_mint_action_instruction( decimals: new_mint.decimals, metadata: light_token_interface::state::CompressedMintMetadata { version: new_mint.version, - mint: find_cmint_address(¶ms.mint_seed).0.to_bytes().into(), + mint: find_mint_address(¶ms.mint_seed).0.to_bytes().into(), // false for new mint - on-chain sets to true after DecompressMint cmint_decompressed: false, compressed_address: params.compressed_mint_address, @@ -350,7 +350,7 @@ pub async fn create_mint_action_instruction( // Add compressible CMint accounts if DecompressMint or CompressAndCloseCMint action is present if has_decompress_mint || has_compress_and_close_cmint { - let (cmint_pda, _) = find_cmint_address(¶ms.mint_seed); + let (cmint_pda, _) = find_mint_address(¶ms.mint_seed); // Get config and rent_sponsor from v1 config PDA let config_address = CompressibleConfig::light_token_v1_config_pda(); let compressible_config: CompressibleConfig = rpc @@ -362,7 +362,7 @@ pub async fn create_mint_action_instruction( config_address )) })?; - config = config.with_compressible_cmint( + config = config.with_compressible_mint( cmint_pda, config_address, compressible_config.rent_sponsor, @@ -428,7 +428,7 @@ pub async fn create_comprehensive_mint_action_instruction( // Derive addresses let address_tree_pubkey = rpc.get_address_tree_v2().tree; let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Build actions let mut actions = Vec::new(); @@ -459,7 +459,7 @@ pub async fn create_comprehensive_mint_action_instruction( // Add DecompressMint action if requested if let Some(decompress_params) = decompress_mint { - let (_, cmint_bump) = find_cmint_address(&mint_seed.pubkey()); + let (_, cmint_bump) = find_mint_address(&mint_seed.pubkey()); actions.push(MintActionType::DecompressMint { cmint_bump, rent_payment: decompress_params.rent_payment, diff --git a/sdk-libs/token-client/src/instructions/mint_to_compressed.rs b/sdk-libs/token-client/src/instructions/mint_to_compressed.rs index a319506de2..ea6bf7f507 100644 --- a/sdk-libs/token-client/src/instructions/mint_to_compressed.rs +++ b/sdk-libs/token-client/src/instructions/mint_to_compressed.rs @@ -8,7 +8,7 @@ use light_token_interface::{ state::{CompressedMint, TokenDataVersion}, }; use light_token_sdk::compressed_token::{ - create_compressed_mint::derive_cmint_from_spl_mint, + create_compressed_mint::derive_mint_from_spl_mint, mint_to_compressed::{ create_mint_to_compressed_instruction, DecompressedMintConfig, MintToCompressedInputs, }, @@ -27,7 +27,7 @@ pub async fn mint_to_compressed_instruction( ) -> Result { // Derive compressed mint address from SPL mint PDA let address_tree_pubkey = rpc.get_address_tree_v2().tree; - let compressed_mint_address = derive_cmint_from_spl_mint(&spl_mint_pda, &address_tree_pubkey); + let compressed_mint_address = derive_mint_from_spl_mint(&spl_mint_pda, &address_tree_pubkey); // Get the compressed mint account let compressed_mint_account = rpc diff --git a/sdk-libs/token-client/src/instructions/transfer2.rs b/sdk-libs/token-client/src/instructions/transfer2.rs index ebdf50eaec..54ce908a68 100644 --- a/sdk-libs/token-client/src/instructions/transfer2.rs +++ b/sdk-libs/token-client/src/instructions/transfer2.rs @@ -33,7 +33,7 @@ pub fn pack_input_token_account( in_lamports: &mut Vec, is_delegate_transfer: bool, // Explicitly specify if delegate is signing token_data_version: TokenDataVersion, - override_owner: Option, // For is_ata: use destination CToken owner instead + override_owner: Option, // For is_ata: use destination Light Token owner instead is_ata: bool, // For ATA decompress: owner (ATA pubkey) is not a signer ) -> MultiInputTokenDataWithContext { // Check if account has a delegate @@ -56,7 +56,7 @@ pub fn pack_input_token_account( in_lamports.push(account.account.lamports); } - // For is_ata, use override_owner (wallet owner from destination CToken) + // For is_ata, use override_owner (wallet owner from destination Light Token) // For regular accounts, use the compressed account's owner let effective_owner = override_owner.unwrap_or(account.token.owner); @@ -143,7 +143,7 @@ pub struct CompressAndCloseInput { pub authority: Pubkey, pub output_queue: Pubkey, pub destination: Option, - pub is_compressible: bool, // If true, account has extensions; if false, regular CToken ATA + pub is_compressible: bool, // If true, account has extensions; if false, regular Light Token ATA } #[derive(Debug, Clone, PartialEq)] @@ -188,7 +188,7 @@ pub async fn create_generic_transfer2_instruction( } } Transfer2InstructionType::CompressAndClose(_) => { - // CompressAndClose doesn't have compressed inputs, only Solana CToken account + // CompressAndClose doesn't have compressed inputs, only Solana Light Token account } Transfer2InstructionType::Decompress(input) => input .compressed_token_account @@ -346,7 +346,7 @@ pub async fn create_generic_transfer2_instruction( } // Check if any input has is_ata=true in the TLV - // If so, we need to use the destination CToken's owner as the signer + // If so, we need to use the destination Light Token's owner as the signer let is_ata = input.in_tlv.as_ref().is_some_and(|tlv| { tlv.iter().flatten().any(|ext| { matches!(ext, ExtensionInstructionData::CompressedOnly(data) if data.is_ata) @@ -365,7 +365,7 @@ pub async fn create_generic_transfer2_instruction( // For is_ata, the compressed account owner is the ATA pubkey (stored during compress_and_close) // We keep that for hash calculation. The wallet owner signs instead of ATA pubkey. - // Get the wallet owner from the destination CToken account and add as signer. + // Get the wallet owner from the destination Light Token account and add as signer. if is_ata && recipient_account_owner.to_bytes() == LIGHT_TOKEN_PROGRAM_ID { // Deserialize Token to get wallet owner use borsh::BorshDeserialize; diff --git a/sdk-libs/token-sdk/src/compressed_token/v1/approve/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v1/approve/account_metas.rs index e5969c8179..7517bd733a 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v1/approve/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v1/approve/account_metas.rs @@ -1,7 +1,7 @@ use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; -use crate::utils::CTokenDefaultAccounts; +use crate::utils::TokenDefaultAccounts; /// Account metadata configuration for approve instruction #[derive(Debug, Copy, Clone)] @@ -45,7 +45,7 @@ impl ApproveMetaConfig { /// Get the standard account metas for an approve instruction /// Uses the GenericInstruction account structure for delegation operations pub fn get_approve_instruction_account_metas(config: ApproveMetaConfig) -> Vec { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); // Calculate capacity based on whether fee_payer is provided // Base accounts: cpi_authority_pda + light_system_program + registered_program_pda + diff --git a/sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/account_metas.rs index 960019f0db..630ef823be 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v1/batch_compress/account_metas.rs @@ -1,7 +1,7 @@ use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; -use crate::utils::CTokenDefaultAccounts; +use crate::utils::TokenDefaultAccounts; /// Account metadata configuration for batch compress instruction #[derive(Debug, Copy, Clone)] @@ -72,7 +72,7 @@ impl BatchCompressMetaConfig { pub fn get_batch_compress_instruction_account_metas( config: BatchCompressMetaConfig, ) -> Vec { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); // Calculate capacity based on whether fee_payer is provided // Base accounts: cpi_authority_pda + spl_interface_pda + token_program + light_system_program + diff --git a/sdk-libs/token-sdk/src/compressed_token/v1/transfer/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v1/transfer/account_metas.rs index d599648230..74a21d14f4 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v1/transfer/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v1/transfer/account_metas.rs @@ -1,7 +1,7 @@ use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; -use crate::utils::CTokenDefaultAccounts; +use crate::utils::TokenDefaultAccounts; /// Account metadata configuration for compressed token instructions #[derive(Debug, Default, Copy, Clone)] @@ -136,7 +136,7 @@ impl TokenAccountsMetaConfig { /// Get the standard account metas for a compressed token transfer instruction pub fn get_transfer_instruction_account_metas(config: TokenAccountsMetaConfig) -> Vec { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); // Direct invoke adds fee_payer, and authority let mut metas = if let Some(fee_payer) = config.fee_payer { let authority = if let Some(authority) = config.authority { diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs b/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs index ae435450d3..d3ae613a34 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/compress_and_close.rs @@ -20,7 +20,7 @@ use super::{ }; use crate::{ error::TokenSdkError, - utils::{AccountInfoToCompress, CTokenDefaultAccounts}, + utils::{AccountInfoToCompress, TokenDefaultAccounts}, }; /// Struct to hold all the indices needed for CompressAndClose operation @@ -374,8 +374,8 @@ pub struct CompressAndCloseAccounts { impl Default for CompressAndCloseAccounts { fn default() -> Self { Self { - compressed_token_program: CTokenDefaultAccounts::default().compressed_token_program, - cpi_authority_pda: CTokenDefaultAccounts::default().cpi_authority_pda, + compressed_token_program: TokenDefaultAccounts::default().compressed_token_program, + cpi_authority_pda: TokenDefaultAccounts::default().cpi_authority_pda, cpi_context: None, self_program: None, } @@ -385,8 +385,8 @@ impl Default for CompressAndCloseAccounts { impl CompressAndCloseAccounts { pub fn new_with_cpi_context(cpi_context: Option, self_program: Option) -> Self { Self { - compressed_token_program: CTokenDefaultAccounts::default().compressed_token_program, - cpi_authority_pda: CTokenDefaultAccounts::default().cpi_authority_pda, + compressed_token_program: TokenDefaultAccounts::default().compressed_token_program, + cpi_authority_pda: TokenDefaultAccounts::default().cpi_authority_pda, cpi_context, self_program, } diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/account_metas.rs index 28d2402d13..e03600533d 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/account_metas.rs @@ -1,7 +1,7 @@ use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; -use crate::utils::CTokenDefaultAccounts; +use crate::utils::TokenDefaultAccounts; /// Account metadata configuration for create cMint instruction #[derive(Debug, Copy, Clone)] @@ -47,7 +47,7 @@ impl CreateCompressedMintMetaConfig { pub fn get_create_compressed_mint_instruction_account_metas( config: CreateCompressedMintMetaConfig, ) -> Vec { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); // Calculate capacity based on configuration // Static accounts: mint_signer + light_system_program (2) @@ -130,7 +130,7 @@ pub struct CreateCompressedMintMetaConfigCpiWrite { pub fn get_create_compressed_mint_instruction_account_metas_cpi_write( config: CreateCompressedMintMetaConfigCpiWrite, ) -> [AccountMeta; 5] { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); [ AccountMeta::new_readonly(config.mint_signer, true), AccountMeta::new_readonly(default_pubkeys.light_system_program, false), diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs index 86a667be8a..70b627bd33 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/instruction.rs @@ -50,7 +50,7 @@ pub fn create_compressed_mint_cpi( decimals: input.decimals, metadata: light_token_interface::state::CompressedMintMetadata { version: input.version, - mint: find_cmint_address(&input.mint_signer).0.to_bytes().into(), + mint: find_mint_address(&input.mint_signer).0.to_bytes().into(), cmint_decompressed: false, compressed_address: mint_address, }, @@ -132,7 +132,7 @@ pub fn create_compressed_mint_cpi_write( decimals: input.decimals, metadata: light_token_interface::state::CompressedMintMetadata { version: input.version, - mint: find_cmint_address(&input.mint_signer).0.to_bytes().into(), + mint: find_mint_address(&input.mint_signer).0.to_bytes().into(), cmint_decompressed: false, compressed_address: input.mint_address, }, @@ -172,23 +172,23 @@ pub fn create_compressed_mint_cpi_write( /// Creates a compressed mint instruction with automatic mint address derivation pub fn create_compressed_mint(input: CreateCompressedMintInputs) -> Result { let mint_address = - derive_cmint_compressed_address(&input.mint_signer, &input.address_tree_pubkey); + derive_mint_compressed_address(&input.mint_signer, &input.address_tree_pubkey); create_compressed_mint_cpi(input, mint_address, None, None) } /// Derives the compressed mint address from the mint seed and address tree -pub fn derive_cmint_compressed_address( +pub fn derive_mint_compressed_address( mint_seed: &Pubkey, address_tree_pubkey: &Pubkey, ) -> [u8; 32] { light_compressed_account::address::derive_address( - &find_cmint_address(mint_seed).0.to_bytes(), + &find_mint_address(mint_seed).0.to_bytes(), &address_tree_pubkey.to_bytes(), &light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ) } -pub fn derive_cmint_from_spl_mint(mint: &Pubkey, address_tree_pubkey: &Pubkey) -> [u8; 32] { +pub fn derive_mint_from_spl_mint(mint: &Pubkey, address_tree_pubkey: &Pubkey) -> [u8; 32] { light_compressed_account::address::derive_address( &mint.to_bytes(), &address_tree_pubkey.to_bytes(), @@ -196,7 +196,7 @@ pub fn derive_cmint_from_spl_mint(mint: &Pubkey, address_tree_pubkey: &Pubkey) - ) } -pub fn find_cmint_address(mint_seed: &Pubkey) -> (Pubkey, u8) { +pub fn find_mint_address(mint_seed: &Pubkey) -> (Pubkey, u8) { Pubkey::find_program_address( &[COMPRESSED_MINT_SEED, mint_seed.as_ref()], &Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/mod.rs b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/mod.rs index 443374742e..63fa502fe7 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/mod.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/create_compressed_mint/mod.rs @@ -6,6 +6,6 @@ pub use account_metas::{ }; pub use instruction::{ create_compressed_mint, create_compressed_mint_cpi, create_compressed_mint_cpi_write, - derive_cmint_compressed_address, derive_cmint_from_spl_mint, find_cmint_address, + derive_mint_compressed_address, derive_mint_from_spl_mint, find_mint_address, CreateCompressedMintInputs, }; diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs b/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs index faedd9e69c..2e217b8f97 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/decompress_full.rs @@ -20,7 +20,7 @@ use super::{ }, }; use crate::{ - compat::TokenData, error::TokenSdkError, utils::CTokenDefaultAccounts, AnchorDeserialize, + compat::TokenData, error::TokenSdkError, utils::TokenDefaultAccounts, AnchorDeserialize, AnchorSerialize, ValidityProof, }; @@ -248,16 +248,16 @@ pub struct DecompressFullAccounts { impl DecompressFullAccounts { pub fn new(cpi_context: Option) -> Self { Self { - compressed_token_program: CTokenDefaultAccounts::default().compressed_token_program, - cpi_authority_pda: CTokenDefaultAccounts::default().cpi_authority_pda, + compressed_token_program: TokenDefaultAccounts::default().compressed_token_program, + cpi_authority_pda: TokenDefaultAccounts::default().cpi_authority_pda, cpi_context, self_program: None, } } pub fn new_with_cpi_context(cpi_context: Option, self_program: Option) -> Self { Self { - compressed_token_program: CTokenDefaultAccounts::default().compressed_token_program, - cpi_authority_pda: CTokenDefaultAccounts::default().cpi_authority_pda, + compressed_token_program: TokenDefaultAccounts::default().compressed_token_program, + cpi_authority_pda: TokenDefaultAccounts::default().cpi_authority_pda, cpi_context, self_program, } diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs index a67d188ff2..c1e06ac351 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/mint_action/account_metas.rs @@ -2,7 +2,7 @@ use light_program_profiler::profile; use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; -use crate::utils::CTokenDefaultAccounts; +use crate::utils::TokenDefaultAccounts; #[derive(Debug, Clone)] pub struct MintActionMetaConfig { @@ -14,11 +14,11 @@ pub struct MintActionMetaConfig { pub input_queue: Option, // Input queue for existing compressed mint operations pub tokens_out_queue: Option, // Output queue for new token accounts pub cpi_context: Option, - pub ctoken_accounts: Vec, // For mint_to_ctoken actions - pub cmint: Option, // CMint PDA account for DecompressMint action + pub token_accounts: Vec, // For mint_to_ctoken actions + pub cmint: Option, // CMint PDA account for DecompressMint action pub compressible_config: Option, // CompressibleConfig account (when creating CMint) pub rent_sponsor: Option, // Rent sponsor PDA (when creating CMint) - pub mint_signer_must_sign: bool, // true for create_mint, false for decompress_mint + pub mint_signer_must_sign: bool, // true for create_mint, false for decompress_mint } impl MintActionMetaConfig { @@ -39,7 +39,7 @@ impl MintActionMetaConfig { input_queue: None, tokens_out_queue: None, cpi_context: None, - ctoken_accounts: Vec::new(), + token_accounts: Vec::new(), cmint: None, compressible_config: None, rent_sponsor: None, @@ -64,7 +64,7 @@ impl MintActionMetaConfig { input_queue: Some(input_queue), tokens_out_queue: None, cpi_context: None, - ctoken_accounts: Vec::new(), + token_accounts: Vec::new(), cmint: None, compressible_config: None, rent_sponsor: None, @@ -92,7 +92,7 @@ impl MintActionMetaConfig { input_queue: None, tokens_out_queue: None, cpi_context: Some(cpi_context_pubkey), - ctoken_accounts: Vec::new(), + token_accounts: Vec::new(), cmint: None, compressible_config: None, rent_sponsor: None, @@ -106,11 +106,11 @@ impl MintActionMetaConfig { } pub fn with_token_accounts(mut self, accounts: Vec) -> Self { - self.ctoken_accounts = accounts; + self.token_accounts = accounts; self } - pub fn with_cmint(mut self, cmint: Pubkey) -> Self { + pub fn with_mint(mut self, cmint: Pubkey) -> Self { self.cmint = Some(cmint); self } @@ -133,7 +133,7 @@ impl MintActionMetaConfig { /// Configure compressible CMint with config and rent sponsor. /// CMint is always compressible - this sets all required accounts. - pub fn with_compressible_cmint( + pub fn with_compressible_mint( mut self, cmint: Pubkey, compressible_config: Pubkey, @@ -148,7 +148,7 @@ impl MintActionMetaConfig { /// Get the account metas for a mint action instruction #[profile] pub fn to_account_metas(self) -> Vec { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); let mut metas = Vec::new(); metas.push(AccountMeta::new_readonly( @@ -228,7 +228,7 @@ impl MintActionMetaConfig { metas.push(AccountMeta::new(tokens_out_queue, false)); } - for token_account in &self.ctoken_accounts { + for token_account in &self.token_accounts { metas.push(AccountMeta::new(*token_account, false)); } @@ -249,7 +249,7 @@ pub struct MintActionMetaConfigCpiWrite { pub fn get_mint_action_instruction_account_metas_cpi_write( config: MintActionMetaConfigCpiWrite, ) -> Vec { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); let mut metas = Vec::new(); metas.push(AccountMeta::new_readonly( diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/account_metas.rs index 965b598fbb..948c45a1c8 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/mint_to_compressed/account_metas.rs @@ -1,7 +1,7 @@ use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; -use crate::utils::CTokenDefaultAccounts; +use crate::utils::TokenDefaultAccounts; /// Account metadata configuration for mint_to_compressed instruction #[derive(Debug, Copy, Clone)] @@ -116,7 +116,7 @@ pub struct MintToCompressedMetaConfigCpiWrite { pub fn get_mint_to_compressed_instruction_account_metas_cpi_write( config: MintToCompressedMetaConfigCpiWrite, ) -> [AccountMeta; 5] { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); [ AccountMeta::new_readonly(default_pubkeys.light_system_program, false), AccountMeta::new_readonly(config.mint_authority, true), @@ -130,7 +130,7 @@ pub fn get_mint_to_compressed_instruction_account_metas_cpi_write( pub fn get_mint_to_compressed_instruction_account_metas( config: MintToCompressedMetaConfig, ) -> Vec { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); // Calculate capacity based on configuration // Optional accounts: authority + payer + optional decompressed accounts (3) + light_system_program + diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/account_metas.rs index ee5978550a..1f5b4c8599 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/transfer2/account_metas.rs @@ -3,7 +3,7 @@ use light_token_types::CPI_AUTHORITY_PDA; use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; -use crate::utils::CTokenDefaultAccounts; +use crate::utils::TokenDefaultAccounts; /// Account metadata configuration for compressed token multi-transfer instructions #[derive(Debug, Default, Clone, PartialEq)] @@ -50,7 +50,7 @@ impl Transfer2AccountsMetaConfig { pub fn get_transfer2_instruction_account_metas( config: Transfer2AccountsMetaConfig, ) -> Vec { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); let packed_accounts_len = if let Some(packed_accounts) = config.packed_accounts.as_ref() { packed_accounts.len() } else { diff --git a/sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/account_metas.rs b/sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/account_metas.rs index a6a41b70dc..9ccab44773 100644 --- a/sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/account_metas.rs +++ b/sdk-libs/token-sdk/src/compressed_token/v2/update_compressed_mint/account_metas.rs @@ -1,7 +1,7 @@ use solana_instruction::AccountMeta; use solana_pubkey::Pubkey; -use crate::utils::CTokenDefaultAccounts; +use crate::utils::TokenDefaultAccounts; /// Configuration for generating account metas for update compressed mint instruction #[derive(Debug, Clone)] @@ -18,7 +18,7 @@ pub struct UpdateCompressedMintMetaConfig { pub fn get_update_compressed_mint_instruction_account_metas( config: UpdateCompressedMintMetaConfig, ) -> Vec { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); let mut metas = Vec::new(); diff --git a/sdk-libs/token-sdk/src/error.rs b/sdk-libs/token-sdk/src/error.rs index 48c749f044..e099fc81b7 100644 --- a/sdk-libs/token-sdk/src/error.rs +++ b/sdk-libs/token-sdk/src/error.rs @@ -71,7 +71,7 @@ pub enum TokenSdkError { InvalidCpiContext, #[error("No input accounts provided")] NoInputAccounts, - #[error("Missing Compressible extension on CToken account")] + #[error("Missing Compressible extension on Light Token account")] MissingCompressibleExtension, #[error("Invalid Token account data")] InvalidTokenAccount, diff --git a/sdk-libs/token-sdk/src/lib.rs b/sdk-libs/token-sdk/src/lib.rs index 1a66b5e9b6..4826a69365 100644 --- a/sdk-libs/token-sdk/src/lib.rs +++ b/sdk-libs/token-sdk/src/lib.rs @@ -53,7 +53,7 @@ //! | Transfer (auto-detect) | - | [`TransferInterfaceCpi`](token::TransferInterfaceCpi) | //! | Decompress to cToken account | [`DecompressToCtoken`](token::DecompressToCtoken) | - | //! | Close cToken account | [`CloseCTokenAccount`](token::CloseCTokenAccount) | [`CloseCTokenAccountCpi`](token::CloseCTokenAccountCpi) | -//! | Create cMint | [`CreateCMint`](token::CreateCMint) | [`CreateCMintCpi`](token::CreateCMintCpi) | +//! | Create cMint | [`CreateMint`](token::CreateMint) | [`CreateCMintCpi`](token::CreateCMintCpi) | //! | MintTo cToken account from cMint | [`MintToCToken`](token::MintToCToken) | [`MintToCTokenCpi`](token::MintToCTokenCpi) | //! //! diff --git a/sdk-libs/token-sdk/src/token/approve.rs b/sdk-libs/token-sdk/src/token/approve.rs index c7b907e9d9..8f3ed9cce1 100644 --- a/sdk-libs/token-sdk/src/token/approve.rs +++ b/sdk-libs/token-sdk/src/token/approve.rs @@ -5,7 +5,7 @@ use solana_instruction::{AccountMeta, Instruction}; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -/// # Approve a delegate for a CToken account: +/// # Approve a delegate for a Light Token account: /// ```rust /// # use solana_pubkey::Pubkey; /// # use light_token_sdk::token::Approve; @@ -21,17 +21,17 @@ use solana_pubkey::Pubkey; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` pub struct Approve { - /// CToken account to approve delegation for + /// Light Token account to approve delegation for pub token_account: Pubkey, /// Delegate to approve pub delegate: Pubkey, - /// Owner of the CToken account (signer, payer for top-up) + /// Owner of the Light Token account (signer, payer for top-up) pub owner: Pubkey, /// Amount of tokens to delegate pub amount: u64, } -/// # Approve CToken via CPI: +/// # Approve Light Token via CPI: /// ```rust,no_run /// # use light_token_sdk::token::ApproveCpi; /// # use solana_account_info::AccountInfo; diff --git a/sdk-libs/token-sdk/src/token/approve_checked.rs b/sdk-libs/token-sdk/src/token/approve_checked.rs index 68473ebdd4..87c467a41d 100644 --- a/sdk-libs/token-sdk/src/token/approve_checked.rs +++ b/sdk-libs/token-sdk/src/token/approve_checked.rs @@ -5,7 +5,7 @@ use solana_instruction::{AccountMeta, Instruction}; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -/// # Approve a delegate for a CToken account with decimals validation: +/// # Approve a delegate for a Light Token account with decimals validation: /// ```rust /// # use solana_pubkey::Pubkey; /// # use light_token_sdk::token::ApproveChecked; @@ -25,13 +25,13 @@ use solana_pubkey::Pubkey; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` pub struct ApproveChecked { - /// CToken account to approve delegation for + /// Light Token account to approve delegation for pub token_account: Pubkey, - /// Mint account (for decimals validation - may be skipped if CToken has cached decimals) + /// Mint account (for decimals validation - may be skipped if Light Token has cached decimals) pub mint: Pubkey, /// Delegate to approve pub delegate: Pubkey, - /// Owner of the CToken account (signer, payer for top-up) + /// Owner of the Light Token account (signer, payer for top-up) pub owner: Pubkey, /// Amount of tokens to delegate pub amount: u64, @@ -41,7 +41,7 @@ pub struct ApproveChecked { pub max_top_up: Option, } -/// # Approve CToken via CPI with decimals validation: +/// # Approve Light Token via CPI with decimals validation: /// ```rust,no_run /// # use light_token_sdk::token::ApproveCheckedCpi; /// # use solana_account_info::AccountInfo; diff --git a/sdk-libs/token-sdk/src/token/burn.rs b/sdk-libs/token-sdk/src/token/burn.rs index c6ab2aa9ba..29621d4b4e 100644 --- a/sdk-libs/token-sdk/src/token/burn.rs +++ b/sdk-libs/token-sdk/src/token/burn.rs @@ -22,13 +22,13 @@ use solana_pubkey::Pubkey; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` pub struct Burn { - /// CToken account to burn from + /// Light Token account to burn from pub source: Pubkey, /// CMint account (supply tracking) pub cmint: Pubkey, /// Amount of tokens to burn pub amount: u64, - /// Owner of the CToken account + /// Owner of the Light Token account pub authority: Pubkey, /// Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (0 = no limit) /// When set to a non-zero value, includes max_top_up in instruction data diff --git a/sdk-libs/token-sdk/src/token/burn_checked.rs b/sdk-libs/token-sdk/src/token/burn_checked.rs index ef86be5bdf..41d7c0da60 100644 --- a/sdk-libs/token-sdk/src/token/burn_checked.rs +++ b/sdk-libs/token-sdk/src/token/burn_checked.rs @@ -23,7 +23,7 @@ use solana_pubkey::Pubkey; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` pub struct BurnChecked { - /// CToken account to burn from + /// Light Token account to burn from pub source: Pubkey, /// CMint account (supply tracking) pub cmint: Pubkey, @@ -31,7 +31,7 @@ pub struct BurnChecked { pub amount: u64, /// Expected token decimals pub decimals: u8, - /// Owner of the CToken account + /// Owner of the Light Token account pub authority: Pubkey, /// Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (0 = no limit) /// When set to a non-zero value, includes max_top_up in instruction data diff --git a/sdk-libs/token-sdk/src/token/create_cmint.rs b/sdk-libs/token-sdk/src/token/create_mint.rs similarity index 91% rename from sdk-libs/token-sdk/src/token/create_cmint.rs rename to sdk-libs/token-sdk/src/token/create_mint.rs index 3ae21ee2cb..4e8c685c58 100644 --- a/sdk-libs/token-sdk/src/token/create_cmint.rs +++ b/sdk-libs/token-sdk/src/token/create_mint.rs @@ -24,7 +24,7 @@ use crate::{ // TODO: modify so that it creates a decompressed mint, if you want a compressed mint use light_token_sdk::compressed_token::create_cmint /// Parameters for creating a compressed mint. #[derive(Debug, Clone)] -pub struct CreateCMintParams { +pub struct CreateMintParams { pub decimals: u8, pub address_merkle_tree_root_index: u16, pub mint_authority: Pubkey, @@ -39,7 +39,7 @@ pub struct CreateCMintParams { /// ```rust,no_run /// # use solana_pubkey::Pubkey; /// use light_token_sdk::token::{ -/// CreateCMint, CreateCMintParams, derive_cmint_compressed_address, find_cmint_address, +/// CreateMint, CreateMintParams, derive_mint_compressed_address, find_mint_address, /// }; /// # use light_token_sdk::CompressedProof; /// # let mint_seed_pubkey = Pubkey::new_unique(); @@ -51,10 +51,10 @@ pub struct CreateCMintParams { /// # let proof: CompressedProof = todo!(); /// /// // Derive addresses -/// let compression_address = derive_cmint_compressed_address(&mint_seed_pubkey, &address_tree); -/// let mint = find_cmint_address(&mint_seed_pubkey).0; +/// let compression_address = derive_mint_compressed_address(&mint_seed_pubkey, &address_tree); +/// let mint = find_mint_address(&mint_seed_pubkey).0; /// -/// let params = CreateCMintParams { +/// let params = CreateMintParams { /// decimals: 9, /// address_merkle_tree_root_index, // from rpc.get_validity_proof /// mint_authority, @@ -64,7 +64,7 @@ pub struct CreateCMintParams { /// freeze_authority: None, /// extensions: None, /// }; -/// let instruction = CreateCMint::new( +/// let instruction = CreateMint::new( /// params, /// mint_seed_pubkey, /// payer, @@ -74,7 +74,7 @@ pub struct CreateCMintParams { /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` #[derive(Debug, Clone)] -pub struct CreateCMint { +pub struct CreateMint { /// Used as seed for the mint address. /// The mint seed account must be a signer. pub mint_seed_pubkey: Pubkey, @@ -83,12 +83,12 @@ pub struct CreateCMint { pub output_queue: Pubkey, pub cpi_context: Option, pub cpi_context_pubkey: Option, - pub params: CreateCMintParams, + pub params: CreateMintParams, } -impl CreateCMint { +impl CreateMint { pub fn new( - params: CreateCMintParams, + params: CreateMintParams, mint_seed_pubkey: Pubkey, payer: Pubkey, address_tree_pubkey: Pubkey, @@ -168,11 +168,11 @@ impl CreateCMint { } // ============================================================================ -// Params Struct: CreateCMintCpiWriteParams +// Params Struct: CreateMintCpiWriteParams // ============================================================================ #[derive(Debug, Clone)] -pub struct CreateCMintCpiWriteParams { +pub struct CreateMintCpiWriteParams { pub decimals: u8, pub mint_authority: Pubkey, pub freeze_authority: Option, @@ -184,7 +184,7 @@ pub struct CreateCMintCpiWriteParams { pub version: u8, } -impl CreateCMintCpiWriteParams { +impl CreateMintCpiWriteParams { pub fn new( decimals: u8, address_merkle_tree_root_index: u16, @@ -226,7 +226,7 @@ pub struct CreateCompressedMintCpiWrite { pub mint_signer: Pubkey, pub payer: Pubkey, pub cpi_context_pubkey: Pubkey, - pub params: CreateCMintCpiWriteParams, + pub params: CreateMintCpiWriteParams, } impl CreateCompressedMintCpiWrite { @@ -234,7 +234,7 @@ impl CreateCompressedMintCpiWrite { mint_signer: Pubkey, payer: Pubkey, cpi_context_pubkey: Pubkey, - params: CreateCMintCpiWriteParams, + params: CreateMintCpiWriteParams, ) -> Self { Self { mint_signer, @@ -306,7 +306,7 @@ impl CreateCompressedMintCpiWrite { /// # Create a compressed mint via CPI: /// ```rust,no_run -/// # use light_token_sdk::token::{CreateCMintCpi, CreateCMintParams, SystemAccountInfos}; +/// # use light_token_sdk::token::{CreateMintCpi, CreateMintParams, SystemAccountInfos}; /// # use solana_account_info::AccountInfo; /// # let mint_seed: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); @@ -314,8 +314,8 @@ impl CreateCompressedMintCpiWrite { /// # let address_tree: AccountInfo = todo!(); /// # let output_queue: AccountInfo = todo!(); /// # let system_accounts: SystemAccountInfos = todo!(); -/// # let params: CreateCMintParams = todo!(); -/// CreateCMintCpi { +/// # let params: CreateMintParams = todo!(); +/// CreateMintCpi { /// mint_seed, /// authority, /// payer, @@ -329,7 +329,7 @@ impl CreateCompressedMintCpiWrite { /// .invoke()?; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` -pub struct CreateCMintCpi<'info> { +pub struct CreateMintCpi<'info> { pub mint_seed: AccountInfo<'info>, /// The authority for the mint (will be stored as mint_authority). pub authority: AccountInfo<'info>, @@ -340,10 +340,10 @@ pub struct CreateCMintCpi<'info> { pub system_accounts: SystemAccountInfos<'info>, pub cpi_context: Option, pub cpi_context_account: Option>, - pub params: CreateCMintParams, + pub params: CreateMintParams, } -impl<'info> CreateCMintCpi<'info> { +impl<'info> CreateMintCpi<'info> { pub fn new( mint_seed: AccountInfo<'info>, authority: AccountInfo<'info>, @@ -351,7 +351,7 @@ impl<'info> CreateCMintCpi<'info> { address_tree: AccountInfo<'info>, output_queue: AccountInfo<'info>, system_accounts: SystemAccountInfos<'info>, - params: CreateCMintParams, + params: CreateMintParams, ) -> Self { Self { mint_seed, @@ -367,7 +367,7 @@ impl<'info> CreateCMintCpi<'info> { } pub fn instruction(&self) -> Result { - CreateCMint::try_from(self)?.instruction() + CreateMint::try_from(self)?.instruction() } pub fn invoke(self) -> Result<(), ProgramError> { @@ -421,13 +421,13 @@ impl<'info> CreateCMintCpi<'info> { } } -impl<'info> TryFrom<&CreateCMintCpi<'info>> for CreateCMint { +impl<'info> TryFrom<&CreateMintCpi<'info>> for CreateMint { type Error = ProgramError; - fn try_from(account_infos: &CreateCMintCpi<'info>) -> Result { + fn try_from(account_infos: &CreateMintCpi<'info>) -> Result { if account_infos.params.mint_authority != *account_infos.authority.key { solana_msg::msg!( - "CreateCMintCpi: params.mint_authority ({}) does not match authority account ({})", + "CreateMintCpi: params.mint_authority ({}) does not match authority account ({})", account_infos.params.mint_authority, account_infos.authority.key ); @@ -458,7 +458,7 @@ pub struct CreateCompressedMintCpiWriteCpi<'info> { pub payer: AccountInfo<'info>, pub cpi_context_account: AccountInfo<'info>, pub system_accounts: SystemAccountInfos<'info>, - pub params: CreateCMintCpiWriteParams, + pub params: CreateMintCpiWriteParams, } impl<'info> CreateCompressedMintCpiWriteCpi<'info> { @@ -511,19 +511,19 @@ impl<'info> TryFrom<&CreateCompressedMintCpiWriteCpi<'info>> for CreateCompresse // ============================================================================ /// Derives the compressed mint address from the mint seed and address tree -pub fn derive_cmint_compressed_address( +pub fn derive_mint_compressed_address( mint_seed: &Pubkey, address_tree_pubkey: &Pubkey, ) -> [u8; 32] { light_compressed_account::address::derive_address( - &find_cmint_address(mint_seed).0.to_bytes(), + &find_mint_address(mint_seed).0.to_bytes(), &address_tree_pubkey.to_bytes(), &light_token_interface::LIGHT_TOKEN_PROGRAM_ID, ) } /// Derives the compressed mint address from an SPL mint address -pub fn derive_cmint_from_spl_mint(mint: &Pubkey, address_tree_pubkey: &Pubkey) -> [u8; 32] { +pub fn derive_mint_from_spl_mint(mint: &Pubkey, address_tree_pubkey: &Pubkey) -> [u8; 32] { light_compressed_account::address::derive_address( &mint.to_bytes(), &address_tree_pubkey.to_bytes(), @@ -531,8 +531,8 @@ pub fn derive_cmint_from_spl_mint(mint: &Pubkey, address_tree_pubkey: &Pubkey) - ) } -/// Finds the compressed mint (c-mint) address from a mint seed. -pub fn find_cmint_address(mint_seed: &Pubkey) -> (Pubkey, u8) { +/// Finds the compressed mint address from a mint seed. +pub fn find_mint_address(mint_seed: &Pubkey) -> (Pubkey, u8) { Pubkey::find_program_address( &[COMPRESSED_MINT_SEED, mint_seed.as_ref()], &Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID), diff --git a/sdk-libs/token-sdk/src/token/decompress_cmint.rs b/sdk-libs/token-sdk/src/token/decompress_mint.rs similarity index 92% rename from sdk-libs/token-sdk/src/token/decompress_cmint.rs rename to sdk-libs/token-sdk/src/token/decompress_mint.rs index 9d2f6c09ed..ec10a7e523 100644 --- a/sdk-libs/token-sdk/src/token/decompress_cmint.rs +++ b/sdk-libs/token-sdk/src/token/decompress_mint.rs @@ -10,7 +10,7 @@ use solana_instruction::Instruction; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -pub use super::find_cmint_address; +pub use super::find_mint_address; use super::{config_pda, rent_sponsor_pda, SystemAccountInfos}; use crate::compressed_token::mint_action::MintActionMetaConfig; @@ -21,7 +21,7 @@ use crate::compressed_token::mint_action::MintActionMetaConfig; /// /// # Example /// ```rust,ignore -/// let instruction = DecompressCMint { +/// let instruction = DecompressMint { /// mint_seed_pubkey, /// payer, /// authority, @@ -35,7 +35,7 @@ use crate::compressed_token::mint_action::MintActionMetaConfig; /// }.instruction()?; /// ``` #[derive(Debug, Clone)] -pub struct DecompressCMint { +pub struct DecompressMint { /// Mint seed pubkey (used to derive CMint PDA) pub mint_seed_pubkey: Pubkey, /// Fee payer @@ -58,10 +58,10 @@ pub struct DecompressCMint { pub write_top_up: u32, } -impl DecompressCMint { +impl DecompressMint { pub fn instruction(self) -> Result { // Derive CMint PDA - let (cmint_pda, cmint_bump) = find_cmint_address(&self.mint_seed_pubkey); + let (cmint_pda, cmint_bump) = find_mint_address(&self.mint_seed_pubkey); // Build DecompressMintAction let action = DecompressMintAction { @@ -85,7 +85,7 @@ impl DecompressCMint { self.input_queue, self.output_queue, ) - .with_compressible_cmint(cmint_pda, config_pda(), rent_sponsor_pda()) + .with_compressible_mint(cmint_pda, config_pda(), rent_sponsor_pda()) .with_mint_signer_no_sign(self.mint_seed_pubkey); let account_metas = meta_config.to_account_metas(); @@ -103,7 +103,7 @@ impl DecompressCMint { } // ============================================================================ -// CPI Struct: DecompressCMintCpi +// CPI Struct: DecompressMintCpi // ============================================================================ /// Decompress a compressed mint to a CMint Solana account via CPI. @@ -113,7 +113,7 @@ impl DecompressCMint { /// /// # Example /// ```rust,ignore -/// DecompressCMintCpi { +/// DecompressMintCpi { /// mint_seed: mint_seed_account, /// authority: authority_account, /// payer: payer_account, @@ -131,7 +131,7 @@ impl DecompressCMint { /// } /// .invoke()?; /// ``` -pub struct DecompressCMintCpi<'info> { +pub struct DecompressMintCpi<'info> { /// Mint seed account (used to derive CMint PDA, does not sign) pub mint_seed: AccountInfo<'info>, /// Mint authority (must sign) @@ -162,9 +162,9 @@ pub struct DecompressCMintCpi<'info> { pub write_top_up: u32, } -impl<'info> DecompressCMintCpi<'info> { +impl<'info> DecompressMintCpi<'info> { pub fn instruction(&self) -> Result { - DecompressCMint::try_from(self)?.instruction() + DecompressMint::try_from(self)?.instruction() } pub fn invoke(self) -> Result<(), ProgramError> { @@ -217,10 +217,10 @@ impl<'info> DecompressCMintCpi<'info> { } } -impl<'info> TryFrom<&DecompressCMintCpi<'info>> for DecompressCMint { +impl<'info> TryFrom<&DecompressMintCpi<'info>> for DecompressMint { type Error = ProgramError; - fn try_from(cpi: &DecompressCMintCpi<'info>) -> Result { + fn try_from(cpi: &DecompressMintCpi<'info>) -> Result { Ok(Self { mint_seed_pubkey: *cpi.mint_seed.key, payer: *cpi.payer.key, diff --git a/sdk-libs/token-sdk/src/token/freeze.rs b/sdk-libs/token-sdk/src/token/freeze.rs index 86e8f5720e..eb729127bb 100644 --- a/sdk-libs/token-sdk/src/token/freeze.rs +++ b/sdk-libs/token-sdk/src/token/freeze.rs @@ -5,7 +5,7 @@ use solana_instruction::{AccountMeta, Instruction}; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -/// # Freeze a CToken account: +/// # Freeze a Light Token account: /// ```rust /// # use solana_pubkey::Pubkey; /// # use light_token_sdk::token::Freeze; @@ -20,7 +20,7 @@ use solana_pubkey::Pubkey; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` pub struct Freeze { - /// CToken account to freeze + /// Light Token account to freeze pub token_account: Pubkey, /// Mint of the token account pub mint: Pubkey, @@ -28,7 +28,7 @@ pub struct Freeze { pub freeze_authority: Pubkey, } -/// # Freeze CToken via CPI: +/// # Freeze Light Token via CPI: /// ```rust,no_run /// # use light_token_sdk::token::FreezeCpi; /// # use solana_account_info::AccountInfo; diff --git a/sdk-libs/token-sdk/src/token/mint_to.rs b/sdk-libs/token-sdk/src/token/mint_to.rs index 781c3c2461..9359c3c07b 100644 --- a/sdk-libs/token-sdk/src/token/mint_to.rs +++ b/sdk-libs/token-sdk/src/token/mint_to.rs @@ -24,7 +24,7 @@ use solana_pubkey::Pubkey; pub struct MintTo { /// CMint account (supply tracking) pub cmint: Pubkey, - /// Destination CToken account to mint to + /// Destination Light Token account to mint to pub destination: Pubkey, /// Amount of tokens to mint pub amount: u64, diff --git a/sdk-libs/token-sdk/src/token/mint_to_checked.rs b/sdk-libs/token-sdk/src/token/mint_to_checked.rs index 4bf3ea0fe6..44d2664ff9 100644 --- a/sdk-libs/token-sdk/src/token/mint_to_checked.rs +++ b/sdk-libs/token-sdk/src/token/mint_to_checked.rs @@ -25,7 +25,7 @@ use solana_pubkey::Pubkey; pub struct MintToChecked { /// CMint account (supply tracking) pub cmint: Pubkey, - /// Destination CToken account to mint to + /// Destination Light Token account to mint to pub destination: Pubkey, /// Amount of tokens to mint pub amount: u64, diff --git a/sdk-libs/token-sdk/src/token/mod.rs b/sdk-libs/token-sdk/src/token/mod.rs index 66630f418b..4e27c203f5 100644 --- a/sdk-libs/token-sdk/src/token/mod.rs +++ b/sdk-libs/token-sdk/src/token/mod.rs @@ -24,7 +24,7 @@ //! //! ## Mint //! -//! - [`CreateCMint`] - Create cMint +//! - [`CreateMint`] - Create cMint //! - [`MintTo`] - Mint tokens to ctoken accounts //! //! ## Revoke and Thaw @@ -80,9 +80,9 @@ mod close; mod compressible; mod create; mod create_ata; -mod create_cmint; +mod create_mint; mod decompress; -mod decompress_cmint; +mod decompress_mint; mod freeze; mod mint_to; mod mint_to_checked; @@ -102,9 +102,9 @@ pub use close::{CloseAccount, CloseAccountCpi}; pub use compressible::{CompressibleParams, CompressibleParamsCpi}; pub use create::*; pub use create_ata::{derive_token_ata, CreateAssociatedAccountCpi, CreateAssociatedTokenAccount}; -pub use create_cmint::*; +pub use create_mint::*; pub use decompress::Decompress; -pub use decompress_cmint::*; +pub use decompress_mint::*; pub use freeze::*; use light_compressible::config::CompressibleConfig; pub use light_token_interface::{ @@ -172,8 +172,8 @@ pub struct SystemAccounts { impl Default for SystemAccounts { fn default() -> Self { - use crate::utils::CTokenDefaultAccounts; - let defaults = CTokenDefaultAccounts::default(); + use crate::utils::TokenDefaultAccounts; + let defaults = TokenDefaultAccounts::default(); Self { light_system_program: defaults.light_system_program, cpi_authority_pda: defaults.cpi_authority_pda, diff --git a/sdk-libs/token-sdk/src/token/revoke.rs b/sdk-libs/token-sdk/src/token/revoke.rs index 5720d1d625..16e5c12f1a 100644 --- a/sdk-libs/token-sdk/src/token/revoke.rs +++ b/sdk-libs/token-sdk/src/token/revoke.rs @@ -5,7 +5,7 @@ use solana_instruction::{AccountMeta, Instruction}; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -/// # Revoke delegation for a CToken account: +/// # Revoke delegation for a Light Token account: /// ```rust /// # use solana_pubkey::Pubkey; /// # use light_token_sdk::token::Revoke; @@ -18,13 +18,13 @@ use solana_pubkey::Pubkey; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` pub struct Revoke { - /// CToken account to revoke delegation for + /// Light Token account to revoke delegation for pub token_account: Pubkey, - /// Owner of the CToken account (signer, payer for top-up) + /// Owner of the Light Token account (signer, payer for top-up) pub owner: Pubkey, } -/// # Revoke CToken via CPI: +/// # Revoke Light Token via CPI: /// ```rust,no_run /// # use light_token_sdk::token::RevokeCpi; /// # use solana_account_info::AccountInfo; diff --git a/sdk-libs/token-sdk/src/token/thaw.rs b/sdk-libs/token-sdk/src/token/thaw.rs index 54e239cf96..b0b4f5e974 100644 --- a/sdk-libs/token-sdk/src/token/thaw.rs +++ b/sdk-libs/token-sdk/src/token/thaw.rs @@ -5,7 +5,7 @@ use solana_instruction::{AccountMeta, Instruction}; use solana_program_error::ProgramError; use solana_pubkey::Pubkey; -/// # Thaw a frozen CToken account: +/// # Thaw a frozen Light Token account: /// ```rust /// # use solana_pubkey::Pubkey; /// # use light_token_sdk::token::Thaw; @@ -20,7 +20,7 @@ use solana_pubkey::Pubkey; /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` pub struct Thaw { - /// CToken account to thaw + /// Light Token account to thaw pub token_account: Pubkey, /// Mint of the token account pub mint: Pubkey, @@ -28,7 +28,7 @@ pub struct Thaw { pub freeze_authority: Pubkey, } -/// # Thaw CToken via CPI: +/// # Thaw Light Token via CPI: /// ```rust,no_run /// # use light_token_sdk::token::ThawCpi; /// # use solana_account_info::AccountInfo; diff --git a/sdk-libs/token-sdk/src/utils.rs b/sdk-libs/token-sdk/src/utils.rs index 2010a8a6e9..a43095f711 100644 --- a/sdk-libs/token-sdk/src/utils.rs +++ b/sdk-libs/token-sdk/src/utils.rs @@ -64,7 +64,7 @@ use light_token_types::{ /// Standard pubkeys for compressed token instructions #[derive(Debug, Copy, Clone)] -pub struct CTokenDefaultAccounts { +pub struct TokenDefaultAccounts { pub light_system_program: Pubkey, pub registered_program_pda: Pubkey, pub noop_program: Pubkey, @@ -76,7 +76,7 @@ pub struct CTokenDefaultAccounts { pub compressed_token_program: Pubkey, } -impl Default for CTokenDefaultAccounts { +impl Default for TokenDefaultAccounts { fn default() -> Self { Self { light_system_program: Pubkey::from(LIGHT_SYSTEM_PROGRAM_ID), diff --git a/sdk-libs/token-sdk/tests/account_metas_test.rs b/sdk-libs/token-sdk/tests/account_metas_test.rs index 9fbb54b33e..dd1c96f05b 100644 --- a/sdk-libs/token-sdk/tests/account_metas_test.rs +++ b/sdk-libs/token-sdk/tests/account_metas_test.rs @@ -8,7 +8,7 @@ use light_token_sdk::{ get_transfer_instruction_account_metas, TokenAccountsMetaConfig, }, }, - utils::CTokenDefaultAccounts, + utils::TokenDefaultAccounts, }; use light_token_types::constants::{ ACCOUNT_COMPRESSION_PROGRAM_ID, CPI_AUTHORITY_PDA, LIGHT_SYSTEM_PROGRAM_ID, NOOP_PROGRAM_ID, @@ -23,7 +23,7 @@ fn test_to_compressed_token_account_metas_compress() { let fee_payer = Pubkey::new_unique(); let authority = Pubkey::new_unique(); - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); let reference = light_compressed_token::accounts::TransferInstruction { fee_payer, authority, @@ -59,7 +59,7 @@ fn test_to_compressed_token_account_metas_with_optional_accounts() { let compress_or_decompress_token_account = Pubkey::new_unique(); let spl_token_program = Pubkey::new_unique(); - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); let reference = light_compressed_token::accounts::TransferInstruction { fee_payer, authority, @@ -107,7 +107,7 @@ fn test_get_batch_compress_instruction_account_metas() { merkle_tree, false, ); - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); let account_metas = get_batch_compress_instruction_account_metas(config); diff --git a/sdk-tests/csdk-anchor-derived-test/src/lib.rs b/sdk-tests/csdk-anchor-derived-test/src/lib.rs index 8268f1cdbc..b267dc487e 100644 --- a/sdk-tests/csdk-anchor-derived-test/src/lib.rs +++ b/sdk-tests/csdk-anchor-derived-test/src/lib.rs @@ -41,7 +41,7 @@ pub mod csdk_anchor_derived_test { MintActionCompressedInstructionData, MintToCompressedAction, Recipient, }; use light_token_sdk::compressed_token::{ - create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, + create_compressed_mint::find_mint_address, mint_action::MintActionMetaConfig, }; use super::*; @@ -136,7 +136,7 @@ pub mod csdk_anchor_derived_test { .write_to_cpi_context_first() .invoke_write_to_cpi_context_first(cpi_context_accounts)?; - let mint = find_cmint_address(&ctx.accounts.mint_signer.key()).0; + let mint = find_mint_address(&ctx.accounts.mint_signer.key()).0; let (_, token_account_address) = get_ctoken_signer_seeds(&ctx.accounts.user.key(), &mint); let output_queue = *cpi_accounts.tree_accounts().unwrap()[0].key; diff --git a/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs b/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs index cb6d9931ed..7a466209ca 100644 --- a/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs +++ b/sdk-tests/csdk-anchor-derived-test/tests/basic_test.rs @@ -18,7 +18,7 @@ use light_token_interface::{ state::CompressedMintMetadata, }; use light_token_sdk::compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, + derive_mint_compressed_address, find_mint_address, }; use light_token_types::CPI_AUTHORITY_PDA; use solana_instruction::Instruction; @@ -129,7 +129,7 @@ async fn test_create_decompress_compress() { assert_eq!(game_session.score, 0); assert!(game_session.compression_info.is_none()); - let spl_mint = find_cmint_address(&mint_signer_pubkey).0; + let spl_mint = find_mint_address(&mint_signer_pubkey).0; let (_, token_account_address) = csdk_anchor_derived_test::seeds::get_ctoken_signer_seeds(&payer.pubkey(), &spl_mint); @@ -145,7 +145,7 @@ async fn test_create_decompress_compress() { ); // Test decompress PDAs (UserRecord + GameSession) - // Note: CToken decompression works but requires manual instruction building + // Note: Light Token decompression works but requires manual instruction building // because the client helper doesn't handle mixed PDA+token packing correctly rpc.warp_to_slot(100).unwrap(); @@ -574,9 +574,9 @@ pub async fn create_user_record_and_game_session( let freeze_authority = mint_authority; let mint_signer = Keypair::new(); let compressed_mint_address = - derive_cmint_compressed_address(&mint_signer.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_signer.pubkey(), &address_tree_pubkey); - let (spl_mint, mint_bump) = find_cmint_address(&mint_signer.pubkey()); + let (spl_mint, mint_bump) = find_mint_address(&mint_signer.pubkey()); let accounts = csdk_anchor_derived_test::accounts::CreateUserRecordAndGameSession { user: user.pubkey(), user_record: *user_record_pda, diff --git a/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs b/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs index 6dbb478bb2..08563dc6b1 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/src/lib.rs @@ -48,7 +48,7 @@ pub fn program_rent_sponsor() -> Pubkey { GameSession = ("game_session", max_key(&ctx.user.key(), &ctx.authority.key()), data.session_id.to_le_bytes()), // PlaceholderRecord: mixes ctx accounts and data for seeds PlaceholderRecord = ("placeholder_record", ctx.authority, ctx.some_account, data.placeholder_id.to_le_bytes(), data.counter.to_le_bytes()), - // Token variant (CToken account) with authority for compression signing + // Token variant (Light Token account) with authority for compression signing CTokenSigner = (is_token, "ctoken_signer", ctx.fee_payer, ctx.mint, authority = LIGHT_CPI_SIGNER), // Instruction data fields used in seed expressions above owner = Pubkey, @@ -78,7 +78,7 @@ pub mod csdk_anchor_full_derived_test { MintActionCompressedInstructionData, MintToCompressedAction, Recipient, }; use light_token_sdk::compressed_token::{ - create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, + create_compressed_mint::find_mint_address, mint_action::MintActionMetaConfig, }; use super::*; @@ -175,9 +175,9 @@ pub mod csdk_anchor_full_derived_test { .write_to_cpi_context_first() .invoke_write_to_cpi_context_first(cpi_context_accounts)?; - let mint = find_cmint_address(&ctx.accounts.mint_signer.key()).0; + let mint = find_mint_address(&ctx.accounts.mint_signer.key()).0; - // Use the generated client seed function for CToken signer (generated by add_compressible_instructions macro) + // Use the generated client seed function for Light Token signer (generated by add_compressible_instructions macro) let (_, token_account_address) = get_ctokensigner_seeds(&ctx.accounts.user.key(), &mint); let output_queue = *cpi_accounts.tree_accounts().unwrap()[0].key; diff --git a/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs b/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs index 0f1fb3623c..55504f129f 100644 --- a/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs +++ b/sdk-tests/csdk-anchor-full-derived-test/tests/basic_test.rs @@ -18,7 +18,7 @@ use light_token_interface::{ state::CompressedMintMetadata, }; use light_token_sdk::compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, + derive_mint_compressed_address, find_mint_address, }; use light_token_types::CPI_AUTHORITY_PDA; use solana_instruction::Instruction; @@ -179,8 +179,8 @@ async fn test_create_with_complex_seeds() { assert_eq!(game_session.score, 0); assert!(game_session.compression_info.is_none()); - // Verify CToken account - let spl_mint = find_cmint_address(&mint_signer_pubkey).0; + // Verify Light Token account + let spl_mint = find_mint_address(&mint_signer_pubkey).0; let (_, token_account_address) = csdk_anchor_full_derived_test::get_ctokensigner_seeds(&payer.pubkey(), &spl_mint); @@ -226,9 +226,9 @@ pub async fn create_user_record_and_game_session( let freeze_authority = mint_authority; let mint_signer = Keypair::new(); let compressed_mint_address = - derive_cmint_compressed_address(&mint_signer.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_signer.pubkey(), &address_tree_pubkey); - let (spl_mint, mint_bump) = find_cmint_address(&mint_signer.pubkey()); + let (spl_mint, mint_bump) = find_mint_address(&mint_signer.pubkey()); let accounts = csdk_anchor_full_derived_test::accounts::CreateUserRecordAndGameSession { user: user.pubkey(), mint_signer: mint_signer.pubkey(), diff --git a/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs b/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs index 846103eab3..c5079a9612 100644 --- a/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs +++ b/sdk-tests/sdk-compressible-test/src/instructions/create_user_record_and_game_session.rs @@ -17,7 +17,7 @@ use light_sdk_types::{ }; use light_token_interface::instructions::mint_action::{MintToCompressedAction, Recipient}; use light_token_sdk::compressed_token::{ - create_compressed_mint::find_cmint_address, mint_action::MintActionMetaConfig, + create_compressed_mint::find_mint_address, mint_action::MintActionMetaConfig, }; use crate::{errors::ErrorCode, instruction_accounts::*, seeds::*, state::*, LIGHT_CPI_SIGNER}; @@ -115,7 +115,7 @@ pub fn create_user_record_and_game_session<'info>( // these are custom seeds of the caller program that are used to derive the program owned onchain tokenb account PDA. // dual use: as owner of the compressed token account. - let mint = find_cmint_address(&ctx.accounts.mint_signer.key()).0; + let mint = find_mint_address(&ctx.accounts.mint_signer.key()).0; let (_, token_account_address) = get_ctoken_signer_seeds(&ctx.accounts.user.key(), &mint); let output_queue = *cpi_accounts.tree_accounts().unwrap()[0].key; // Same tree as PDA diff --git a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs index 966c5411f9..7b41ff0e22 100644 --- a/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs +++ b/sdk-tests/sdk-compressible-test/tests/multi_account_tests.rs @@ -20,9 +20,7 @@ use light_token_interface::{ state::CompressedMintMetadata, }; use light_token_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, + compressed_token::create_compressed_mint::{derive_mint_compressed_address, find_mint_address}, pack::compat::CTokenDataWithVariant, token, }; @@ -238,9 +236,9 @@ pub async fn create_user_record_and_game_session( let freeze_authority = mint_authority; let mint_signer = Keypair::new(); let compressed_mint_address = - derive_cmint_compressed_address(&mint_signer.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_signer.pubkey(), &address_tree_pubkey); - let (spl_mint, mint_bump) = find_cmint_address(&mint_signer.pubkey()); + let (spl_mint, mint_bump) = find_mint_address(&mint_signer.pubkey()); let accounts = sdk_compressible_test::accounts::CreateUserRecordAndGameSession { user: user.pubkey(), user_record: *user_record_pda, @@ -417,9 +415,9 @@ pub async fn create_user_record_and_game_session( assert_eq!(game_session.score, 0); let token_account_address = - get_ctoken_signer_seeds(&user.pubkey(), &find_cmint_address(&mint_signer.pubkey()).0).1; + get_ctoken_signer_seeds(&user.pubkey(), &find_mint_address(&mint_signer.pubkey()).0).1; - let mint = find_cmint_address(&mint_signer.pubkey()).0; + let mint = find_mint_address(&mint_signer.pubkey()).0; let token_account_address_2 = get_ctoken_signer2_seeds(&user.pubkey()).1; let token_account_address_3 = get_ctoken_signer3_seeds(&user.pubkey()).1; let token_account_address_4 = get_ctoken_signer4_seeds(&user.pubkey(), &user.pubkey()).1; diff --git a/sdk-tests/sdk-light-token-test/src/approve.rs b/sdk-tests/sdk-light-token-test/src/approve.rs index 7ce80c8191..d8be99d6b0 100644 --- a/sdk-tests/sdk-light-token-test/src/approve.rs +++ b/sdk-tests/sdk-light-token-test/src/approve.rs @@ -10,7 +10,7 @@ pub struct ApproveData { pub amount: u64, } -/// Handler for approving a delegate for a CToken account (invoke) +/// Handler for approving a delegate for a Light Token account (invoke) /// /// Account order: /// - accounts[0]: token_account (writable) @@ -38,7 +38,7 @@ pub fn process_approve_invoke( Ok(()) } -/// Handler for approving a delegate for a PDA-owned CToken account (invoke_signed) +/// Handler for approving a delegate for a PDA-owned Light Token account (invoke_signed) /// /// Account order: /// - accounts[0]: token_account (writable) diff --git a/sdk-tests/sdk-light-token-test/src/burn.rs b/sdk-tests/sdk-light-token-test/src/burn.rs index f06f4c3025..8e0c46767a 100644 --- a/sdk-tests/sdk-light-token-test/src/burn.rs +++ b/sdk-tests/sdk-light-token-test/src/burn.rs @@ -13,7 +13,7 @@ pub struct BurnData { /// Handler for burning CTokens (invoke) /// /// Account order: -/// - accounts[0]: source (CToken account, writable) +/// - accounts[0]: source (Light Token account, writable) /// - accounts[1]: cmint (writable) /// - accounts[2]: authority (owner, signer) /// - accounts[3]: ctoken_program @@ -37,7 +37,7 @@ pub fn process_burn_invoke(accounts: &[AccountInfo], amount: u64) -> Result<(), /// Handler for burning CTokens with PDA authority (invoke_signed) /// /// Account order: -/// - accounts[0]: source (CToken account, writable) +/// - accounts[0]: source (Light Token account, writable) /// - accounts[1]: cmint (writable) /// - accounts[2]: PDA authority (owner, program signs) /// - accounts[3]: ctoken_program diff --git a/sdk-tests/sdk-light-token-test/src/create_cmint.rs b/sdk-tests/sdk-light-token-test/src/create_cmint.rs index 9d56e7a284..294d81e322 100644 --- a/sdk-tests/sdk-light-token-test/src/create_cmint.rs +++ b/sdk-tests/sdk-light-token-test/src/create_cmint.rs @@ -1,6 +1,6 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_token_sdk::{ - token::{CreateCMintCpi, CreateCMintParams, ExtensionInstructionData, SystemAccountInfos}, + token::{CreateMintCpi, CreateMintParams, ExtensionInstructionData, SystemAccountInfos}, CompressedProof, }; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; @@ -26,7 +26,7 @@ pub struct CreateCmintData { /// Handler for creating a compressed mint (invoke) /// /// Uses the CreateCMintCpi builder pattern. This demonstrates how to: -/// 1. Build the CreateCMintParams struct from instruction data +/// 1. Build the CreateMintParams struct from instruction data /// 2. Build the CreateCMintCpi with accounts /// 3. Call invoke() which handles instruction building and CPI /// @@ -53,7 +53,7 @@ pub fn process_create_cmint( } // Build the params - let params = CreateCMintParams { + let params = CreateMintParams { decimals: data.decimals, address_merkle_tree_root_index: data.address_merkle_tree_root_index, mint_authority: data.mint_authority, @@ -76,7 +76,7 @@ pub fn process_create_cmint( // Build the account infos struct // In this case, payer == authority (accounts[3]) - CreateCMintCpi { + CreateMintCpi { mint_seed: accounts[2].clone(), authority: accounts[3].clone(), payer: accounts[3].clone(), @@ -128,7 +128,7 @@ pub fn process_create_cmint_invoke_signed( } // Build the params - let params = CreateCMintParams { + let params = CreateMintParams { decimals: data.decimals, address_merkle_tree_root_index: data.address_merkle_tree_root_index, mint_authority: data.mint_authority, @@ -151,7 +151,7 @@ pub fn process_create_cmint_invoke_signed( // Build the account infos struct // In this case, payer == authority (accounts[3]) - let account_infos = CreateCMintCpi { + let account_infos = CreateMintCpi { mint_seed: accounts[2].clone(), authority: accounts[3].clone(), payer: accounts[3].clone(), @@ -217,7 +217,7 @@ pub fn process_create_cmint_with_pda_authority( } // Build the params - authority is the PDA - let params = CreateCMintParams { + let params = CreateMintParams { decimals: data.decimals, address_merkle_tree_root_index: data.address_merkle_tree_root_index, mint_authority: authority_pda, // Use the derived PDA as authority @@ -239,7 +239,7 @@ pub fn process_create_cmint_with_pda_authority( }; // Build the account infos struct using SDK - let account_infos = CreateCMintCpi { + let account_infos = CreateMintCpi { mint_seed: accounts[2].clone(), authority: accounts[3].clone(), payer: accounts[4].clone(), diff --git a/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs b/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs index 7387418b3f..66bd3264f7 100644 --- a/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs +++ b/sdk-tests/sdk-light-token-test/src/ctoken_mint_to.rs @@ -1,32 +1,75 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use solana_program::{account_info::AccountInfo, program_error::ProgramError}; +use light_token_sdk::token::MintToCpi; +use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; -/// Instruction data for CTokenMintTo operations +use crate::{ID, MINT_AUTHORITY_SEED}; + +/// Instruction data for MintTo operations #[derive(BorshSerialize, BorshDeserialize)] pub struct MintToData { pub amount: u64, } -/// Handler for minting to CToken (invoke) +/// Handler for minting to Token (invoke) /// -/// Note: This operation (minting to a regular token account) is no longer part of the public SDK API. -/// Use the compressed token minting API instead. -pub fn process_ctoken_mint_to_invoke( - _accounts: &[AccountInfo], - _amount: u64, -) -> Result<(), ProgramError> { - // This operation is deprecated - simple token minting is no longer supported - Err(ProgramError::Custom(999)) +/// Account order: +/// - accounts[0]: mint (writable) +/// - accounts[1]: destination (Token account, writable) +/// - accounts[2]: authority (mint authority, signer) +/// - accounts[3]: system_program +/// - accounts[4]: light_token_program +pub fn process_mint_to_invoke(accounts: &[AccountInfo], amount: u64) -> Result<(), ProgramError> { + if accounts.len() < 5 { + return Err(ProgramError::NotEnoughAccountKeys); + } + + MintToCpi { + cmint: accounts[0].clone(), + destination: accounts[1].clone(), + amount, + authority: accounts[2].clone(), + system_program: accounts[3].clone(), + max_top_up: None, + } + .invoke()?; + + Ok(()) } -/// Handler for minting to CToken with PDA authority (invoke_signed) +/// Handler for minting to Token with PDA authority (invoke_signed) /// -/// Note: This operation (minting to a regular token account) is no longer part of the public SDK API. -/// Use the compressed token minting API instead. -pub fn process_ctoken_mint_to_invoke_signed( - _accounts: &[AccountInfo], - _amount: u64, +/// Account order: +/// - accounts[0]: mint (writable) +/// - accounts[1]: destination (Token account, writable) +/// - accounts[2]: PDA authority (mint authority, program signs) +/// - accounts[3]: system_program +/// - accounts[4]: light_token_program +pub fn process_mint_to_invoke_signed( + accounts: &[AccountInfo], + amount: u64, ) -> Result<(), ProgramError> { - // This operation is deprecated - simple token minting is no longer supported - Err(ProgramError::Custom(999)) + if accounts.len() < 5 { + return Err(ProgramError::NotEnoughAccountKeys); + } + + // Derive the PDA for the mint authority + let (pda, bump) = Pubkey::find_program_address(&[MINT_AUTHORITY_SEED], &ID); + + // Verify the authority account is the PDA we expect + if &pda != accounts[2].key { + return Err(ProgramError::InvalidSeeds); + } + + let signer_seeds: &[&[u8]] = &[MINT_AUTHORITY_SEED, &[bump]]; + MintToCpi { + cmint: accounts[0].clone(), + destination: accounts[1].clone(), + amount, + authority: accounts[2].clone(), + system_program: accounts[3].clone(), + max_top_up: None, + } + .invoke_signed(&[signer_seeds])?; + + Ok(()) } diff --git a/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs b/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs index 93d97a07e5..7f9301eca5 100644 --- a/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs +++ b/sdk-tests/sdk-light-token-test/src/decompress_cmint.rs @@ -1,6 +1,6 @@ use borsh::{BorshDeserialize, BorshSerialize}; use light_token_sdk::{ - token::{CompressedMintWithContext, DecompressCMintCpi, SystemAccountInfos}, + token::{CompressedMintWithContext, DecompressMintCpi, SystemAccountInfos}, ValidityProof, }; use solana_program::{account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey}; @@ -60,7 +60,7 @@ pub fn process_decompress_cmint_invoke_signed( }; let signer_seeds: &[&[u8]] = &[MINT_AUTHORITY_SEED, &[bump]]; - DecompressCMintCpi { + DecompressMintCpi { mint_seed: accounts[0].clone(), authority: accounts[1].clone(), payer: accounts[2].clone(), diff --git a/sdk-tests/sdk-light-token-test/src/freeze.rs b/sdk-tests/sdk-light-token-test/src/freeze.rs index e3a8910dc5..16183125e8 100644 --- a/sdk-tests/sdk-light-token-test/src/freeze.rs +++ b/sdk-tests/sdk-light-token-test/src/freeze.rs @@ -3,7 +3,7 @@ use solana_program::{account_info::AccountInfo, program_error::ProgramError, pub use crate::{FREEZE_AUTHORITY_SEED, ID}; -/// Handler for freezing a CToken account (invoke) +/// Handler for freezing a Light Token account (invoke) /// /// Account order: /// - accounts[0]: token_account (writable) @@ -25,7 +25,7 @@ pub fn process_freeze_invoke(accounts: &[AccountInfo]) -> Result<(), ProgramErro Ok(()) } -/// Handler for freezing a CToken account with PDA freeze authority (invoke_signed) +/// Handler for freezing a Light Token account with PDA freeze authority (invoke_signed) /// /// Account order: /// - accounts[0]: token_account (writable) diff --git a/sdk-tests/sdk-light-token-test/src/lib.rs b/sdk-tests/sdk-light-token-test/src/lib.rs index 366b589843..414bdfec8e 100644 --- a/sdk-tests/sdk-light-token-test/src/lib.rs +++ b/sdk-tests/sdk-light-token-test/src/lib.rs @@ -30,7 +30,7 @@ pub use create_token_account::{ CreateTokenAccountData, }; pub use ctoken_mint_to::{ - process_ctoken_mint_to_invoke, process_ctoken_mint_to_invoke_signed, MintToData, + process_mint_to_invoke, process_mint_to_invoke_signed, MintToData, }; pub use decompress_cmint::{process_decompress_cmint_invoke_signed, DecompressCmintData}; pub use freeze::{process_freeze_invoke, process_freeze_invoke_signed}; @@ -78,9 +78,9 @@ pub enum InstructionType { CreateAtaInvoke = 4, /// Create compressible associated token account with PDA ownership (invoke_signed) CreateAtaInvokeSigned = 5, - /// Transfer compressed tokens CToken->CToken (invoke) + /// Transfer compressed tokens Light Token->Light Token (invoke) CTokenTransferInvoke = 6, - /// Transfer compressed tokens CToken->CToken from PDA-owned account (invoke_signed) + /// Transfer compressed tokens Light Token->Light Token from PDA-owned account (invoke_signed) CTokenTransferInvokeSigned = 7, /// Close compressed token account (invoke) CloseAccountInvoke = 8, @@ -94,41 +94,41 @@ pub enum InstructionType { CreateCmintInvokeSigned = 12, /// Create a compressed mint with PDA mint signer AND PDA authority (invoke_signed) CreateCmintWithPdaAuthority = 14, - /// Transfer SPL tokens to CToken account (invoke) + /// Transfer SPL tokens to Light Token account (invoke) SplToCtokenInvoke = 15, - /// Transfer SPL tokens to CToken account with PDA authority (invoke_signed) + /// Transfer SPL tokens to Light Token account with PDA authority (invoke_signed) SplToCtokenInvokeSigned = 16, - /// Transfer CToken to SPL token account (invoke) + /// Transfer Light Token to SPL token account (invoke) CtokenToSplInvoke = 17, - /// Transfer CToken to SPL token account with PDA authority (invoke_signed) + /// Transfer Light Token to SPL token account with PDA authority (invoke_signed) CtokenToSplInvokeSigned = 18, /// Unified transfer interface - auto-detects account types (invoke) TransferInterfaceInvoke = 19, /// Unified transfer interface with PDA authority (invoke_signed) TransferInterfaceInvokeSigned = 20, - /// Approve delegate for CToken account (invoke) + /// Approve delegate for Light Token account (invoke) ApproveInvoke = 21, - /// Approve delegate for PDA-owned CToken account (invoke_signed) + /// Approve delegate for PDA-owned Light Token account (invoke_signed) ApproveInvokeSigned = 22, - /// Revoke delegation for CToken account (invoke) + /// Revoke delegation for Light Token account (invoke) RevokeInvoke = 23, - /// Revoke delegation for PDA-owned CToken account (invoke_signed) + /// Revoke delegation for PDA-owned Light Token account (invoke_signed) RevokeInvokeSigned = 24, - /// Freeze CToken account (invoke) + /// Freeze Light Token account (invoke) FreezeInvoke = 25, - /// Freeze CToken account with PDA freeze authority (invoke_signed) + /// Freeze Light Token account with PDA freeze authority (invoke_signed) FreezeInvokeSigned = 26, - /// Thaw frozen CToken account (invoke) + /// Thaw frozen Light Token account (invoke) ThawInvoke = 27, - /// Thaw frozen CToken account with PDA freeze authority (invoke_signed) + /// Thaw frozen Light Token account with PDA freeze authority (invoke_signed) ThawInvokeSigned = 28, /// Burn CTokens (invoke) BurnInvoke = 29, /// Burn CTokens with PDA authority (invoke_signed) BurnInvokeSigned = 30, - /// Mint to CToken from decompressed CMint (invoke) + /// Mint to Light Token from decompressed CMint (invoke) CTokenMintToInvoke = 31, - /// Mint to CToken from decompressed CMint with PDA authority (invoke_signed) + /// Mint to Light Token from decompressed CMint with PDA authority (invoke_signed) CTokenMintToInvokeSigned = 32, /// Decompress CMint with PDA authority (invoke_signed) DecompressCmintInvokeSigned = 33, @@ -307,12 +307,12 @@ pub fn process_instruction( InstructionType::CTokenMintToInvoke => { let data = MintToData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; - process_ctoken_mint_to_invoke(accounts, data.amount) + process_mint_to_invoke(accounts, data.amount) } InstructionType::CTokenMintToInvokeSigned => { let data = MintToData::try_from_slice(&instruction_data[1..]) .map_err(|_| ProgramError::InvalidInstructionData)?; - process_ctoken_mint_to_invoke_signed(accounts, data.amount) + process_mint_to_invoke_signed(accounts, data.amount) } InstructionType::DecompressCmintInvokeSigned => { let data = DecompressCmintData::try_from_slice(&instruction_data[1..]) diff --git a/sdk-tests/sdk-light-token-test/src/revoke.rs b/sdk-tests/sdk-light-token-test/src/revoke.rs index ac9038f590..cdd84fb7ca 100644 --- a/sdk-tests/sdk-light-token-test/src/revoke.rs +++ b/sdk-tests/sdk-light-token-test/src/revoke.rs @@ -3,7 +3,7 @@ use solana_program::{account_info::AccountInfo, program_error::ProgramError, pub use crate::{ID, TOKEN_ACCOUNT_SEED}; -/// Handler for revoking delegation on a CToken account (invoke) +/// Handler for revoking delegation on a Light Token account (invoke) /// /// Account order: /// - accounts[0]: token_account (writable) @@ -25,7 +25,7 @@ pub fn process_revoke_invoke(accounts: &[AccountInfo]) -> Result<(), ProgramErro Ok(()) } -/// Handler for revoking delegation on a PDA-owned CToken account (invoke_signed) +/// Handler for revoking delegation on a PDA-owned Light Token account (invoke_signed) /// /// Account order: /// - accounts[0]: token_account (writable) diff --git a/sdk-tests/sdk-light-token-test/src/thaw.rs b/sdk-tests/sdk-light-token-test/src/thaw.rs index 5454d54d8b..5cfeffbc33 100644 --- a/sdk-tests/sdk-light-token-test/src/thaw.rs +++ b/sdk-tests/sdk-light-token-test/src/thaw.rs @@ -3,7 +3,7 @@ use solana_program::{account_info::AccountInfo, program_error::ProgramError, pub use crate::{FREEZE_AUTHORITY_SEED, ID}; -/// Handler for thawing a frozen CToken account (invoke) +/// Handler for thawing a frozen Light Token account (invoke) /// /// Account order: /// - accounts[0]: token_account (writable) @@ -25,7 +25,7 @@ pub fn process_thaw_invoke(accounts: &[AccountInfo]) -> Result<(), ProgramError> Ok(()) } -/// Handler for thawing a frozen CToken account with PDA freeze authority (invoke_signed) +/// Handler for thawing a frozen Light Token account with PDA freeze authority (invoke_signed) /// /// Account order: /// - accounts[0]: token_account (writable) diff --git a/sdk-tests/sdk-light-token-test/src/transfer_interface.rs b/sdk-tests/sdk-light-token-test/src/transfer_interface.rs index a1bb37e0bc..5758563f41 100644 --- a/sdk-tests/sdk-light-token-test/src/transfer_interface.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer_interface.rs @@ -12,26 +12,26 @@ pub const TRANSFER_INTERFACE_AUTHORITY_SEED: &[u8] = b"transfer_interface_author pub struct TransferInterfaceData { pub amount: u64, pub decimals: u8, - /// Required for SPL<->CToken transfers, None for CToken->CToken + /// Required for SPL<->Light Token transfers, None for Light Token->Light Token pub spl_interface_pda_bump: Option, } /// Handler for TransferInterface (invoke) /// /// This unified interface automatically detects account types and routes to: -/// - CToken -> CToken transfer -/// - CToken -> SPL transfer -/// - SPL -> CToken transfer +/// - Light Token -> Light Token transfer +/// - Light Token -> SPL transfer +/// - SPL -> Light Token transfer /// /// Account order: /// - accounts[0]: compressed_token_program (for CPI) -/// - accounts[1]: source_account (SPL or CToken) -/// - accounts[2]: destination_account (SPL or CToken) +/// - accounts[1]: source_account (SPL or Light Token) +/// - accounts[2]: destination_account (SPL or Light Token) /// - accounts[3]: authority (signer) /// - accounts[4]: payer (signer) /// - accounts[5]: compressed_token_program_authority /// - accounts[6]: system_program -/// For SPL bridge (optional, required for SPL<->CToken): +/// For SPL bridge (optional, required for SPL<->Light Token): /// - accounts[7]: mint /// - accounts[8]: spl_interface_pda /// - accounts[9]: spl_token_program @@ -75,13 +75,13 @@ pub fn process_transfer_interface_invoke( /// /// Account order: /// - accounts[0]: compressed_token_program (for CPI) -/// - accounts[1]: source_account (SPL or CToken) -/// - accounts[2]: destination_account (SPL or CToken) +/// - accounts[1]: source_account (SPL or Light Token) +/// - accounts[2]: destination_account (SPL or Light Token) /// - accounts[3]: authority (PDA, not signer - program signs) /// - accounts[4]: payer (signer) /// - accounts[5]: compressed_token_program_authority /// - accounts[6]: system_program -/// For SPL bridge (optional, required for SPL<->CToken): +/// For SPL bridge (optional, required for SPL<->Light Token): /// - accounts[7]: mint /// - accounts[8]: spl_interface_pda /// - accounts[9]: spl_token_program diff --git a/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs b/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs index 95d971eb99..70db33ab7e 100644 --- a/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs @@ -7,7 +7,7 @@ use crate::ID; /// PDA seed for authority in invoke_signed variants pub const TRANSFER_AUTHORITY_SEED: &[u8] = b"transfer_authority"; -/// Instruction data for SPL to CToken transfer +/// Instruction data for SPL to Light Token transfer #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct TransferFromSplData { pub amount: u64, @@ -15,7 +15,7 @@ pub struct TransferFromSplData { pub decimals: u8, } -/// Instruction data for CToken to SPL transfer +/// Instruction data for Light Token to SPL transfer #[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct TransferTokenToSplData { pub amount: u64, @@ -23,7 +23,7 @@ pub struct TransferTokenToSplData { pub decimals: u8, } -/// Handler for transferring SPL tokens to CToken (invoke) +/// Handler for transferring SPL tokens to Light Token (invoke) /// /// Account order: /// - accounts[0]: compressed_token_program (for CPI) @@ -63,7 +63,7 @@ pub fn process_spl_to_ctoken_invoke( Ok(()) } -/// Handler for transferring SPL tokens to CToken with PDA authority (invoke_signed) +/// Handler for transferring SPL tokens to Light Token with PDA authority (invoke_signed) /// /// The authority is a PDA derived from TRANSFER_AUTHORITY_SEED. /// @@ -117,7 +117,7 @@ pub fn process_spl_to_ctoken_invoke_signed( Ok(()) } -/// Handler for transferring CToken to SPL tokens (invoke) +/// Handler for transferring Light Token to SPL tokens (invoke) /// /// Account order: /// - accounts[0]: compressed_token_program (for CPI) @@ -155,7 +155,7 @@ pub fn process_ctoken_to_spl_invoke( Ok(()) } -/// Handler for transferring CToken to SPL tokens with PDA authority (invoke_signed) +/// Handler for transferring Light Token to SPL tokens with PDA authority (invoke_signed) /// /// The authority is a PDA derived from TRANSFER_AUTHORITY_SEED. /// diff --git a/sdk-tests/sdk-light-token-test/tests/shared.rs b/sdk-tests/sdk-light-token-test/tests/shared.rs index 4567f09363..e685f24afd 100644 --- a/sdk-tests/sdk-light-token-test/tests/shared.rs +++ b/sdk-tests/sdk-light-token-test/tests/shared.rs @@ -17,7 +17,7 @@ pub async fn setup_create_compressed_mint( recipients: Vec<(u64, Pubkey)>, ) -> (Pubkey, [u8; 32], Vec, Keypair) { use light_token_sdk::token::{ - CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, + CreateAssociatedTokenAccount, CreateMint, CreateMintParams, MintTo, }; let mint_seed = Keypair::new(); @@ -25,12 +25,12 @@ pub async fn setup_create_compressed_mint( let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_mint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); - let mint = light_token_sdk::token::find_cmint_address(&mint_seed.pubkey()).0; + let mint = light_token_sdk::token::find_mint_address(&mint_seed.pubkey()).0; // Get validity proof for the address let rpc_result = rpc @@ -47,7 +47,7 @@ pub async fn setup_create_compressed_mint( .value; // Build params for the SDK - let params = CreateCMintParams { + let params = CreateMintParams { decimals, address_merkle_tree_root_index: rpc_result.addresses[0].root_index, mint_authority, @@ -59,7 +59,7 @@ pub async fn setup_create_compressed_mint( }; // Create instruction directly using SDK - let create_cmint_builder = CreateCMint::new( + let create_cmint_builder = CreateMint::new( params, mint_seed.pubkey(), payer.pubkey(), @@ -120,7 +120,7 @@ pub async fn setup_create_compressed_mint( use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; - use light_token_sdk::token::DecompressCMint; + use light_token_sdk::token::DecompressMint; let compressed_mint_account = rpc .get_compressed_account(compression_address, None) @@ -157,7 +157,7 @@ pub async fn setup_create_compressed_mint( mint: Some(compressed_mint.try_into().unwrap()), }; - let decompress_ix = DecompressCMint { + let decompress_ix = DecompressMint { mint_seed_pubkey: mint_seed.pubkey(), payer: payer.pubkey(), authority: mint_authority, @@ -209,7 +209,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( recipients: Vec<(u64, Pubkey)>, ) -> (Pubkey, [u8; 32], Vec) { use light_token_sdk::token::{ - CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, + CreateAssociatedTokenAccount, CreateMint, CreateMintParams, MintTo, }; let mint_seed = Keypair::new(); @@ -217,12 +217,12 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_mint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); - let mint = light_token_sdk::token::find_cmint_address(&mint_seed.pubkey()).0; + let mint = light_token_sdk::token::find_mint_address(&mint_seed.pubkey()).0; // Get validity proof for the address let rpc_result = rpc @@ -239,7 +239,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( .value; // Build params for the SDK - let params = CreateCMintParams { + let params = CreateMintParams { decimals, address_merkle_tree_root_index: rpc_result.addresses[0].root_index, mint_authority, @@ -251,7 +251,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( }; // Create instruction directly using SDK - let create_cmint_builder = CreateCMint::new( + let create_cmint_builder = CreateMint::new( params, mint_seed.pubkey(), payer.pubkey(), @@ -279,7 +279,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; - use light_token_sdk::token::DecompressCMint; + use light_token_sdk::token::DecompressMint; let compressed_mint = CompressedMint::deserialize( &mut compressed_mint_account @@ -309,7 +309,7 @@ pub async fn setup_create_compressed_mint_with_freeze_authority( mint: Some(compressed_mint.try_into().unwrap()), }; - let decompress_ix = DecompressCMint { + let decompress_ix = DecompressMint { mint_seed_pubkey: mint_seed.pubkey(), payer: payer.pubkey(), authority: mint_authority, @@ -390,7 +390,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( compression_only: bool, ) -> (Pubkey, [u8; 32], Vec) { use light_token_sdk::token::{ - CompressibleParams, CreateAssociatedTokenAccount, CreateCMint, CreateCMintParams, MintTo, + CompressibleParams, CreateAssociatedTokenAccount, CreateMint, CreateMintParams, MintTo, }; let mint_seed = Keypair::new(); @@ -398,12 +398,12 @@ pub async fn setup_create_compressed_mint_with_compression_only( let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_mint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); - let mint = light_token_sdk::token::find_cmint_address(&mint_seed.pubkey()).0; + let mint = light_token_sdk::token::find_mint_address(&mint_seed.pubkey()).0; // Get validity proof for the address let rpc_result = rpc @@ -420,7 +420,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( .value; // Build params for the SDK - let params = CreateCMintParams { + let params = CreateMintParams { decimals, address_merkle_tree_root_index: rpc_result.addresses[0].root_index, mint_authority, @@ -432,7 +432,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( }; // Create instruction directly using SDK - let create_cmint_builder = CreateCMint::new( + let create_cmint_builder = CreateMint::new( params, mint_seed.pubkey(), payer.pubkey(), @@ -500,7 +500,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; - use light_token_sdk::token::DecompressCMint; + use light_token_sdk::token::DecompressMint; let compressed_mint_account = rpc .get_compressed_account(compression_address, None) @@ -537,7 +537,7 @@ pub async fn setup_create_compressed_mint_with_compression_only( mint: Some(compressed_mint.try_into().unwrap()), }; - let decompress_ix = DecompressCMint { + let decompress_ix = DecompressMint { mint_seed_pubkey: mint_seed.pubkey(), payer: payer.pubkey(), authority: mint_authority, diff --git a/sdk-tests/sdk-light-token-test/tests/test_burn.rs b/sdk-tests/sdk-light-token-test/tests/test_burn.rs index 8308e87827..052f2ce2ab 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_burn.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_burn.rs @@ -74,7 +74,7 @@ async fn test_burn_invoke() { assert_eq!( ctoken_after, expected_ctoken, - "CToken should match expected state after burn" + "Light Token should match expected state after burn" ); } @@ -140,6 +140,6 @@ async fn test_burn_invoke_signed() { assert_eq!( ctoken_after, expected_ctoken, - "CToken should match expected state after burn" + "Light Token should match expected state after burn" ); } diff --git a/sdk-tests/sdk-light-token-test/tests/test_create_cmint.rs b/sdk-tests/sdk-light-token-test/tests/test_create_cmint.rs index 8a2cc05c9e..205eb581ee 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_create_cmint.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_create_cmint.rs @@ -42,12 +42,12 @@ async fn test_create_compressed_mint() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); // Use SDK helper to derive the compression address correctly - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_mint_compressed_address( &mint_signer.pubkey(), &address_tree.tree, ); - let mint_pda = light_token_sdk::token::find_cmint_address(&mint_signer.pubkey()).0; + let mint_pda = light_token_sdk::token::find_mint_address(&mint_signer.pubkey()).0; let rpc_result = rpc .get_validity_proof( @@ -150,12 +150,12 @@ async fn test_create_compressed_mint_invoke_signed() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); // Use SDK helper to derive the compression address correctly - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_mint_compressed_address( &mint_signer_pda, &address_tree.tree, ); - let mint_pda = light_token_sdk::token::find_cmint_address(&mint_signer_pda).0; + let mint_pda = light_token_sdk::token::find_mint_address(&mint_signer_pda).0; let rpc_result = rpc .get_validity_proof( diff --git a/sdk-tests/sdk-light-token-test/tests/test_ctoken_mint_to.rs b/sdk-tests/sdk-light-token-test/tests/test_ctoken_mint_to.rs index 98aa7bc3c7..43a9ae1cce 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_ctoken_mint_to.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_ctoken_mint_to.rs @@ -15,7 +15,7 @@ use solana_sdk::{ signer::Signer, }; -/// Test minting to CToken using CTokenMintToCpi::invoke() +/// Test minting to Light Token using CTokenMintToCpi::invoke() #[tokio::test] async fn test_ctoken_mint_to_invoke() { let config = ProgramTestConfig::new_v2(true, Some(vec![("native_ctoken_examples", ID)])); @@ -76,11 +76,11 @@ async fn test_ctoken_mint_to_invoke() { assert_eq!( ctoken_after, expected_ctoken, - "CToken should match expected state after mint" + "Light Token should match expected state after mint" ); } -/// Test minting to CToken with PDA authority using CTokenMintToCpi::invoke_signed() +/// Test minting to Light Token with PDA authority using CTokenMintToCpi::invoke_signed() /// /// This test: /// 1. Creates a compressed mint with PDA authority via wrapper program (discriminator 14) @@ -112,12 +112,12 @@ async fn test_ctoken_mint_to_invoke_signed() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using the PDA mint_signer - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_mint_compressed_address( &mint_signer_pda, &address_tree.tree, ); - let mint_pda = light_token_sdk::token::find_cmint_address(&mint_signer_pda).0; + let mint_pda = light_token_sdk::token::find_mint_address(&mint_signer_pda).0; // Step 1: Create compressed mint with PDA authority using wrapper program (discriminator 14) { @@ -136,7 +136,7 @@ async fn test_ctoken_mint_to_invoke_signed() { let compressed_token_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); - let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); + let default_pubkeys = light_token_sdk::utils::TokenDefaultAccounts::default(); let create_cmint_data = CreateCmintData { decimals, @@ -214,7 +214,7 @@ async fn test_ctoken_mint_to_invoke_signed() { mint: Some(compressed_mint.try_into().unwrap()), }; - let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); + let default_pubkeys = light_token_sdk::utils::TokenDefaultAccounts::default(); let compressible_config = light_token_sdk::token::config_pda(); let rent_sponsor = light_token_sdk::token::rent_sponsor_pda(); @@ -335,6 +335,6 @@ async fn test_ctoken_mint_to_invoke_signed() { assert_eq!( ctoken_after, expected_ctoken, - "CToken should match expected state after mint" + "Light Token should match expected state after mint" ); } diff --git a/sdk-tests/sdk-light-token-test/tests/test_decompress_cmint.rs b/sdk-tests/sdk-light-token-test/tests/test_decompress_cmint.rs index b073fd3ca8..7b0129b43c 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_decompress_cmint.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_decompress_cmint.rs @@ -1,4 +1,4 @@ -// Tests for DecompressCMint SDK instruction +// Tests for DecompressMint SDK instruction mod shared; @@ -9,7 +9,7 @@ use light_program_test::{LightProgramTest, ProgramTestConfig}; use light_token_interface::{ instructions::mint_action::CompressedMintWithContext, state::CompressedMint, }; -use light_token_sdk::token::{find_cmint_address, DecompressCMint}; +use light_token_sdk::token::{find_mint_address, DecompressMint}; use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}; /// Test decompressing a compressed mint to CMint account @@ -67,8 +67,8 @@ async fn test_decompress_cmint() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; - // Build and execute DecompressCMint instruction - let decompress_ix = DecompressCMint { + // Build and execute DecompressMint instruction + let decompress_ix = DecompressMint { mint_seed_pubkey: mint_seed.pubkey(), payer: payer.pubkey(), authority: mint_authority, @@ -175,8 +175,8 @@ async fn test_decompress_cmint_with_freeze_authority() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; - // Build and execute DecompressCMint instruction - let decompress_ix = DecompressCMint { + // Build and execute DecompressMint instruction + let decompress_ix = DecompressMint { mint_seed_pubkey: mint_seed.pubkey(), payer: payer.pubkey(), authority: mint_authority, @@ -228,19 +228,19 @@ async fn setup_create_compressed_mint_with_freeze_authority_only( freeze_authority: Option, decimals: u8, ) -> (Pubkey, [u8; 32], Keypair) { - use light_token_sdk::token::{CreateCMint, CreateCMintParams}; + use light_token_sdk::token::{CreateMint, CreateMintParams}; let mint_seed = Keypair::new(); let address_tree = rpc.get_address_tree_v2(); let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_mint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); - let mint = find_cmint_address(&mint_seed.pubkey()).0; + let mint = find_mint_address(&mint_seed.pubkey()).0; // Get validity proof for the address let rpc_result = rpc @@ -257,7 +257,7 @@ async fn setup_create_compressed_mint_with_freeze_authority_only( .value; // Build params for the SDK - let params = CreateCMintParams { + let params = CreateMintParams { decimals, address_merkle_tree_root_index: rpc_result.addresses[0].root_index, mint_authority, @@ -269,7 +269,7 @@ async fn setup_create_compressed_mint_with_freeze_authority_only( }; // Create instruction directly using SDK - let create_cmint_builder = CreateCMint::new( + let create_cmint_builder = CreateMint::new( params, mint_seed.pubkey(), payer.pubkey(), @@ -374,8 +374,8 @@ async fn test_decompress_cmint_with_token_metadata() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; - // Build and execute DecompressCMint instruction - let decompress_ix = DecompressCMint { + // Build and execute DecompressMint instruction + let decompress_ix = DecompressMint { mint_seed_pubkey: mint_seed.pubkey(), payer: payer.pubkey(), authority: mint_authority, @@ -435,19 +435,19 @@ async fn setup_create_compressed_mint_with_extensions( decimals: u8, extensions: Vec, ) -> (Pubkey, [u8; 32], Keypair) { - use light_token_sdk::token::{CreateCMint, CreateCMintParams}; + use light_token_sdk::token::{CreateMint, CreateMintParams}; let mint_seed = Keypair::new(); let address_tree = rpc.get_address_tree_v2(); let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using SDK helpers - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_mint_compressed_address( &mint_seed.pubkey(), &address_tree.tree, ); - let mint = find_cmint_address(&mint_seed.pubkey()).0; + let mint = find_mint_address(&mint_seed.pubkey()).0; // Get validity proof for the address let rpc_result = rpc @@ -464,7 +464,7 @@ async fn setup_create_compressed_mint_with_extensions( .value; // Build params for the SDK - let params = CreateCMintParams { + let params = CreateMintParams { decimals, address_merkle_tree_root_index: rpc_result.addresses[0].root_index, mint_authority, @@ -476,7 +476,7 @@ async fn setup_create_compressed_mint_with_extensions( }; // Create instruction directly using SDK - let create_cmint_builder = CreateCMint::new( + let create_cmint_builder = CreateMint::new( params, mint_seed.pubkey(), payer.pubkey(), @@ -528,12 +528,12 @@ async fn test_decompress_cmint_cpi_invoke_signed() { let output_queue = rpc.get_random_state_tree_info().unwrap().queue; // Derive compression address using the PDA mint_signer - let compression_address = light_token_sdk::token::derive_cmint_compressed_address( + let compression_address = light_token_sdk::token::derive_mint_compressed_address( &mint_signer_pda, &address_tree.tree, ); - let mint_pda = find_cmint_address(&mint_signer_pda).0; + let mint_pda = find_mint_address(&mint_signer_pda).0; // Step 1: Create compressed mint with PDA authority using wrapper program (discriminator 14) { @@ -552,7 +552,7 @@ async fn test_decompress_cmint_cpi_invoke_signed() { let compressed_token_program_id = Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); - let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); + let default_pubkeys = light_token_sdk::utils::TokenDefaultAccounts::default(); let create_cmint_data = CreateCmintData { decimals, @@ -637,7 +637,7 @@ async fn test_decompress_cmint_cpi_invoke_signed() { mint: Some(compressed_mint.clone().try_into().unwrap()), }; - let default_pubkeys = light_token_sdk::utils::CTokenDefaultAccounts::default(); + let default_pubkeys = light_token_sdk::utils::TokenDefaultAccounts::default(); let compressible_config = light_token_sdk::token::config_pda(); let rent_sponsor = light_token_sdk::token::rent_sponsor_pda(); diff --git a/sdk-tests/sdk-light-token-test/tests/test_freeze_thaw.rs b/sdk-tests/sdk-light-token-test/tests/test_freeze_thaw.rs index 00dcee19cf..f7284e4a38 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_freeze_thaw.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_freeze_thaw.rs @@ -16,7 +16,7 @@ use solana_sdk::{ signer::Signer, }; -/// Test freezing a CToken account using FreezeCTokenCpi::invoke() +/// Test freezing a Light Token account using FreezeCTokenCpi::invoke() #[tokio::test] async fn test_freeze_invoke() { let config = ProgramTestConfig::new_v2(true, Some(vec![("native_ctoken_examples", ID)])); @@ -83,7 +83,7 @@ async fn test_freeze_invoke() { ); } -/// Test freezing a CToken account with PDA freeze authority using FreezeCTokenCpi::invoke_signed() +/// Test freezing a Light Token account with PDA freeze authority using FreezeCTokenCpi::invoke_signed() #[tokio::test] async fn test_freeze_invoke_signed() { let config = ProgramTestConfig::new_v2(true, Some(vec![("native_ctoken_examples", ID)])); @@ -138,7 +138,7 @@ async fn test_freeze_invoke_signed() { ); } -/// Test thawing a frozen CToken account using ThawCTokenCpi::invoke() +/// Test thawing a frozen Light Token account using ThawCTokenCpi::invoke() #[tokio::test] async fn test_thaw_invoke() { let config = ProgramTestConfig::new_v2(true, Some(vec![("native_ctoken_examples", ID)])); @@ -224,7 +224,7 @@ async fn test_thaw_invoke() { ); } -/// Test thawing a frozen CToken account with PDA freeze authority using ThawCTokenCpi::invoke_signed() +/// Test thawing a frozen Light Token account with PDA freeze authority using ThawCTokenCpi::invoke_signed() #[tokio::test] async fn test_thaw_invoke_signed() { let config = ProgramTestConfig::new_v2(true, Some(vec![("native_ctoken_examples", ID)])); diff --git a/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs index d8393b2789..78da61c252 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_interface.rs @@ -25,7 +25,7 @@ use solana_sdk::{ // INVOKE TESTS (regular signer authority) // ============================================================================= -/// Test TransferInterfaceCpi: SPL -> CToken (invoke) +/// Test TransferInterfaceCpi: SPL -> Light Token (invoke) #[tokio::test] async fn test_transfer_interface_spl_to_ctoken_invoke() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -62,7 +62,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke() { .await .unwrap(); - // Create CToken ATA for recipient + // Create Light Token ATA for recipient let recipient = Keypair::new(); light_test_utils::airdrop_lamports(&mut rpc, &recipient.pubkey(), 1_000_000_000) .await @@ -95,7 +95,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke() { let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), AccountMeta::new(spl_token_account_keypair.pubkey(), false), // source (SPL) - AccountMeta::new(ctoken_account, false), // destination (CToken) + AccountMeta::new(ctoken_account, false), // destination (Light Token) AccountMeta::new_readonly(sender.pubkey(), true), // authority (signer) AccountMeta::new(payer.pubkey(), true), // payer AccountMeta::new_readonly(cpi_authority_pda, false), // compressed_token_program_authority @@ -131,10 +131,10 @@ async fn test_transfer_interface_spl_to_ctoken_invoke() { spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!(u64::from(ctoken_state.amount), transfer_amount); - println!("TransferInterface SPL->CToken invoke test passed"); + println!("TransferInterface SPL->Light Token invoke test passed"); } -/// Test TransferInterface: CToken -> SPL (invoke) +/// Test TransferInterface: Light Token -> SPL (invoke) #[tokio::test] async fn test_transfer_interface_ctoken_to_spl_invoke() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -160,7 +160,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke() { .await .unwrap(); - // Create and fund CToken ATA + // Create and fund Light Token ATA let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), owner.pubkey(), mint) .instruction() .unwrap(); @@ -169,7 +169,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke() { .unwrap(); let ctoken_account = derive_token_ata(&owner.pubkey(), &mint).0; - // Fund CToken via temporary SPL account + // Fund Light Token via temporary SPL account let temp_spl_keypair = Keypair::new(); create_token_2022_account(&mut rpc, &mint, &temp_spl_keypair, &owner, false) .await @@ -192,7 +192,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); - // Transfer SPL to CToken to fund it + // Transfer SPL to Light Token to fund it { let data = TransferInterfaceData { amount, @@ -222,7 +222,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke() { .unwrap(); } - // Now test CToken -> SPL transfer + // Now test Light Token -> SPL transfer let data = TransferInterfaceData { amount: transfer_amount, spl_interface_pda_bump: Some(spl_interface_pda_bump), @@ -232,7 +232,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke() { let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), - AccountMeta::new(ctoken_account, false), // source (CToken) + AccountMeta::new(ctoken_account, false), // source (Light Token) AccountMeta::new(spl_token_account_keypair.pubkey(), false), // destination (SPL) AccountMeta::new_readonly(owner.pubkey(), true), // authority AccountMeta::new(payer.pubkey(), true), // payer @@ -269,10 +269,10 @@ async fn test_transfer_interface_ctoken_to_spl_invoke() { spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!(u64::from(ctoken_state.amount), amount - transfer_amount); - println!("TransferInterface CToken->SPL invoke test passed"); + println!("TransferInterface Light Token->SPL invoke test passed"); } -/// Test TransferInterface: CToken -> CToken (invoke) +/// Test TransferInterface: Light Token -> Light Token (invoke) #[tokio::test] async fn test_transfer_interface_ctoken_to_ctoken_invoke() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -296,7 +296,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { let amount = 10000u64; let transfer_amount = 5000u64; - // Create sender CToken ATA + // Create sender Light Token ATA let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), sender.pubkey(), mint) .instruction() .unwrap(); @@ -305,7 +305,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { .unwrap(); let sender_ctoken = derive_token_ata(&sender.pubkey(), &mint).0; - // Create recipient CToken ATA + // Create recipient Light Token ATA let instruction = CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), mint) .instruction() .unwrap(); @@ -314,7 +314,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { .unwrap(); let recipient_ctoken = derive_token_ata(&recipient.pubkey(), &mint).0; - // Fund sender CToken via SPL + // Fund sender Light Token via SPL let temp_spl_keypair = Keypair::new(); create_token_2022_account(&mut rpc, &mint, &temp_spl_keypair, &sender, false) .await @@ -337,7 +337,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); - // Fund sender CToken + // Fund sender Light Token { let data = TransferInterfaceData { amount, @@ -367,19 +367,19 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { .unwrap(); } - // Now test CToken -> CToken transfer (no SPL bridge needed) + // Now test Light Token -> Light Token transfer (no SPL bridge needed) let data = TransferInterfaceData { amount: transfer_amount, - spl_interface_pda_bump: None, // Not needed for CToken->CToken + spl_interface_pda_bump: None, // Not needed for Light Token->Light Token decimals: CREATE_MINT_HELPER_DECIMALS, }; let wrapper_instruction_data = [vec![19u8], data.try_to_vec().unwrap()].concat(); - // For CToken->CToken, we need 7 accounts (no SPL bridge, but system_program is required) + // For Light Token->Light Token, we need 7 accounts (no SPL bridge, but system_program is required) let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), - AccountMeta::new(sender_ctoken, false), // source (CToken) - AccountMeta::new(recipient_ctoken, false), // destination (CToken) + AccountMeta::new(sender_ctoken, false), // source (Light Token) + AccountMeta::new(recipient_ctoken, false), // destination (Light Token) AccountMeta::new_readonly(sender.pubkey(), true), // authority AccountMeta::new(payer.pubkey(), true), // payer AccountMeta::new_readonly(cpi_authority_pda, false), @@ -409,14 +409,14 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke() { .unwrap(); assert_eq!(u64::from(recipient_state.amount), transfer_amount); - println!("TransferInterface CToken->CToken invoke test passed"); + println!("TransferInterface Light Token->Light Token invoke test passed"); } // ============================================================================= // INVOKE_SIGNED TESTS (PDA authority) // ============================================================================= -/// Test TransferInterface: SPL -> CToken with PDA authority (invoke_signed) +/// Test TransferInterface: SPL -> Light Token with PDA authority (invoke_signed) #[tokio::test] async fn test_transfer_interface_spl_to_ctoken_invoke_signed() { use anchor_spl::associated_token::{ @@ -465,7 +465,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke_signed() { .await .unwrap(); - // Create destination CToken ATA + // Create destination Light Token ATA let recipient = Keypair::new(); light_test_utils::airdrop_lamports(&mut rpc, &recipient.pubkey(), 1_000_000_000) .await @@ -496,7 +496,7 @@ async fn test_transfer_interface_spl_to_ctoken_invoke_signed() { let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), AccountMeta::new(spl_ata, false), // source (SPL owned by PDA) - AccountMeta::new(ctoken_account, false), // destination (CToken) + AccountMeta::new(ctoken_account, false), // destination (Light Token) AccountMeta::new_readonly(authority_pda, false), // authority (PDA, not signer) AccountMeta::new(payer.pubkey(), true), // payer AccountMeta::new_readonly(cpi_authority_pda, false), // compressed_token_program_authority @@ -528,10 +528,10 @@ async fn test_transfer_interface_spl_to_ctoken_invoke_signed() { spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!(u64::from(ctoken_state.amount), transfer_amount); - println!("TransferInterface SPL->CToken invoke_signed test passed"); + println!("TransferInterface SPL->Light Token invoke_signed test passed"); } -/// Test TransferInterface: CToken -> SPL with PDA authority (invoke_signed) +/// Test TransferInterface: Light Token -> SPL with PDA authority (invoke_signed) #[tokio::test] async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -567,7 +567,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { .await .unwrap(); - // Create CToken ATA owned by PDA + // Create Light Token ATA owned by PDA let (ctoken_account, bump) = derive_token_ata(&authority_pda, &mint); let instruction = CreateAssociatedTokenAccount { idempotent: false, @@ -584,7 +584,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { .await .unwrap(); - // Fund PDA's CToken via temporary SPL account + // Fund PDA's Light Token via temporary SPL account let temp_spl_keypair = Keypair::new(); let temp_owner = Keypair::new(); light_test_utils::airdrop_lamports(&mut rpc, &temp_owner.pubkey(), 1_000_000_000) @@ -611,7 +611,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); - // Fund PDA's CToken + // Fund PDA's Light Token { let data = TransferInterfaceData { amount, @@ -641,7 +641,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { .unwrap(); } - // Now test CToken -> SPL with PDA authority + // Now test Light Token -> SPL with PDA authority let data = TransferInterfaceData { amount: transfer_amount, spl_interface_pda_bump: Some(spl_interface_pda_bump), @@ -652,7 +652,7 @@ async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), - AccountMeta::new(ctoken_account, false), // source (CToken owned by PDA) + AccountMeta::new(ctoken_account, false), // source (Light Token owned by PDA) AccountMeta::new(spl_token_account_keypair.pubkey(), false), // destination (SPL) AccountMeta::new_readonly(authority_pda, false), // authority (PDA) AccountMeta::new(payer.pubkey(), true), // payer @@ -689,10 +689,10 @@ async fn test_transfer_interface_ctoken_to_spl_invoke_signed() { spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!(u64::from(ctoken_state.amount), amount - transfer_amount); - println!("TransferInterface CToken->SPL invoke_signed test passed"); + println!("TransferInterface Light Token->SPL invoke_signed test passed"); } -/// Test TransferInterface: CToken -> CToken with PDA authority (invoke_signed) +/// Test TransferInterface: Light Token -> Light Token with PDA authority (invoke_signed) #[tokio::test] async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -712,7 +712,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { let amount = 10000u64; let transfer_amount = 5000u64; - // Create source CToken ATA owned by PDA + // Create source Light Token ATA owned by PDA let (source_ctoken, bump) = derive_token_ata(&authority_pda, &mint); let instruction = CreateAssociatedTokenAccount { idempotent: false, @@ -729,7 +729,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { .await .unwrap(); - // Create destination CToken ATA + // Create destination Light Token ATA let recipient = Keypair::new(); light_test_utils::airdrop_lamports(&mut rpc, &recipient.pubkey(), 1_000_000_000) .await @@ -742,7 +742,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { .unwrap(); let dest_ctoken = derive_token_ata(&recipient.pubkey(), &mint).0; - // Fund source CToken via temporary SPL account + // Fund source Light Token via temporary SPL account let temp_spl_keypair = Keypair::new(); let temp_owner = Keypair::new(); light_test_utils::airdrop_lamports(&mut rpc, &temp_owner.pubkey(), 1_000_000_000) @@ -769,7 +769,7 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); - // Fund source CToken + // Fund source Light Token { let data = TransferInterfaceData { amount, @@ -799,20 +799,20 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { .unwrap(); } - // Now test CToken -> CToken with PDA authority + // Now test Light Token -> Light Token with PDA authority let data = TransferInterfaceData { amount: transfer_amount, - spl_interface_pda_bump: None, // Not needed for CToken->CToken + spl_interface_pda_bump: None, // Not needed for Light Token->Light Token decimals: CREATE_MINT_HELPER_DECIMALS, }; // Discriminator 20 = TransferInterfaceInvokeSigned let wrapper_instruction_data = [vec![20u8], data.try_to_vec().unwrap()].concat(); - // For CToken->CToken, we only need 6 accounts (no SPL bridge) + // For Light Token->Light Token, we only need 6 accounts (no SPL bridge) let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), - AccountMeta::new(source_ctoken, false), // source (CToken owned by PDA) - AccountMeta::new(dest_ctoken, false), // destination (CToken) + AccountMeta::new(source_ctoken, false), // source (Light Token owned by PDA) + AccountMeta::new(dest_ctoken, false), // destination (Light Token) AccountMeta::new_readonly(authority_pda, false), // authority (PDA) AccountMeta::new(payer.pubkey(), true), // payer AccountMeta::new_readonly(cpi_authority_pda, false), @@ -841,5 +841,5 @@ async fn test_transfer_interface_ctoken_to_ctoken_invoke_signed() { spl_pod::bytemuck::pod_from_bytes::(&dest_ctoken_data.data[..165]).unwrap(); assert_eq!(u64::from(dest_state.amount), transfer_amount); - println!("TransferInterface CToken->CToken invoke_signed test passed"); + println!("TransferInterface Light Token->Light Token invoke_signed test passed"); } diff --git a/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs index 314eadd6fb..7fb9a84499 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs @@ -23,7 +23,7 @@ use solana_sdk::{ signer::Signer, }; -/// Test transferring SPL tokens to CToken using TransferFromSplCpi::invoke() +/// Test transferring SPL tokens to Light Token using TransferFromSplCpi::invoke() #[tokio::test] async fn test_spl_to_ctoken_invoke() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -94,7 +94,7 @@ async fn test_spl_to_ctoken_invoke() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); - // Build wrapper instruction for SPL to CToken transfer + // Build wrapper instruction for SPL to Light Token transfer let data = TransferFromSplData { amount: transfer_amount, spl_interface_pda_bump, @@ -148,20 +148,20 @@ async fn test_spl_to_ctoken_invoke() { let final_spl_balance: u64 = spl_account.amount.into(); assert_eq!(final_spl_balance, amount - transfer_amount); - // Verify CToken balance increased + // Verify Light Token balance increased let ctoken_account_data = rpc.get_account(ctoken_account).await.unwrap().unwrap(); let ctoken_account_state = spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!( u64::from(ctoken_account_state.amount), transfer_amount, - "CToken account should have received tokens" + "Light Token account should have received tokens" ); - println!("SPL to CToken invoke test passed"); + println!("SPL to Light Token invoke test passed"); } -/// Test transferring CToken to SPL tokens using TransferTokenToSplCpi::invoke() +/// Test transferring Light Token to SPL tokens using TransferTokenToSplCpi::invoke() #[tokio::test] async fn test_ctoken_to_spl_invoke() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -259,7 +259,7 @@ async fn test_ctoken_to_spl_invoke() { spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!(u64::from(ctoken_state.amount), amount); - // Now test CToken to SPL transfer + // Now test Light Token to SPL transfer let data = TransferTokenToSplData { amount: transfer_amount, spl_interface_pda_bump, @@ -311,20 +311,20 @@ async fn test_ctoken_to_spl_invoke() { let final_spl_balance: u64 = spl_account.amount.into(); assert_eq!(final_spl_balance, transfer_amount); - // Verify CToken balance decreased + // Verify Light Token balance decreased let ctoken_account_data = rpc.get_account(ctoken_account).await.unwrap().unwrap(); let ctoken_state = spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!( u64::from(ctoken_state.amount), amount - transfer_amount, - "CToken account balance should have decreased" + "Light Token account balance should have decreased" ); - println!("CToken to SPL invoke test passed"); + println!("Light Token to SPL invoke test passed"); } -/// Test transferring SPL tokens to CToken with PDA authority using invoke_signed +/// Test transferring SPL tokens to Light Token with PDA authority using invoke_signed #[tokio::test] async fn test_spl_to_ctoken_invoke_signed() { use anchor_spl::associated_token::{ @@ -394,7 +394,7 @@ async fn test_spl_to_ctoken_invoke_signed() { Pubkey::new_from_array(light_token_interface::LIGHT_TOKEN_PROGRAM_ID); let cpi_authority_pda = Pubkey::new_from_array(CPI_AUTHORITY_PDA); - // Build wrapper instruction for SPL to CToken transfer with PDA authority + // Build wrapper instruction for SPL to Light Token transfer with PDA authority let data = TransferFromSplData { amount: transfer_amount, spl_interface_pda_bump, @@ -434,20 +434,20 @@ async fn test_spl_to_ctoken_invoke_signed() { let final_spl_balance: u64 = spl_account.amount.into(); assert_eq!(final_spl_balance, amount - transfer_amount); - // Verify CToken balance increased + // Verify Light Token balance increased let ctoken_account_data = rpc.get_account(ctoken_account).await.unwrap().unwrap(); let ctoken_account_state = spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!( u64::from(ctoken_account_state.amount), transfer_amount, - "CToken account should have received tokens" + "Light Token account should have received tokens" ); - println!("SPL to CToken invoke_signed test passed"); + println!("SPL to Light Token invoke_signed test passed"); } -/// Test transferring CToken to SPL with PDA authority using invoke_signed +/// Test transferring Light Token to SPL with PDA authority using invoke_signed #[tokio::test] async fn test_ctoken_to_spl_invoke_signed() { let mut rpc = LightProgramTest::new(ProgramTestConfig::new_v2( @@ -572,7 +572,7 @@ async fn test_ctoken_to_spl_invoke_signed() { spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!(u64::from(ctoken_state.amount), amount); - // Now test CToken to SPL transfer with PDA authority + // Now test Light Token to SPL transfer with PDA authority let data = TransferTokenToSplData { amount: transfer_amount, spl_interface_pda_bump, @@ -614,15 +614,15 @@ async fn test_ctoken_to_spl_invoke_signed() { let final_spl_balance: u64 = spl_account.amount.into(); assert_eq!(final_spl_balance, transfer_amount); - // Verify CToken balance decreased + // Verify Light Token balance decreased let ctoken_account_data = rpc.get_account(ctoken_account).await.unwrap().unwrap(); let ctoken_state = spl_pod::bytemuck::pod_from_bytes::(&ctoken_account_data.data[..165]).unwrap(); assert_eq!( u64::from(ctoken_state.amount), amount - transfer_amount, - "CToken account balance should have decreased" + "Light Token account balance should have decreased" ); - println!("CToken to SPL invoke_signed test passed"); + println!("Light Token to SPL invoke_signed test passed"); } diff --git a/sdk-tests/sdk-token-test/tests/ctoken_pda.rs b/sdk-tests/sdk-token-test/tests/ctoken_pda.rs index 8a97c000be..24af72d9bf 100644 --- a/sdk-tests/sdk-token-test/tests/ctoken_pda.rs +++ b/sdk-tests/sdk-token-test/tests/ctoken_pda.rs @@ -12,7 +12,7 @@ use light_token_interface::{ LIGHT_TOKEN_PROGRAM_ID, }; use light_token_sdk::compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, + derive_mint_compressed_address, find_mint_address, }; use light_token_types::CPI_AUTHORITY_PDA; use sdk_token_test::{ChainedCtokenInstructionData, PdaCreationData, ID}; @@ -146,10 +146,10 @@ pub async fn create_mint( // Derive compressed mint address using utility function let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Find mint bump for the instruction - let (mint, _) = find_cmint_address(&mint_seed.pubkey()); + let (mint, _) = find_mint_address(&mint_seed.pubkey()); let pda_address_seed = hash_to_bn254_field_size_be( [b"escrow", payer.pubkey().to_bytes().as_ref()] diff --git a/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs b/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs index 2b9d7898f2..57dcea0617 100644 --- a/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs +++ b/sdk-tests/sdk-token-test/tests/decompress_full_cpi.rs @@ -10,7 +10,7 @@ use light_test_utils::airdrop_lamports; use light_token_client::{actions::mint_action_comprehensive, instructions::mint_action::NewMint}; use light_token_interface::instructions::mint_action::{CompressedMintWithContext, Recipient}; use light_token_sdk::compressed_token::{ - create_compressed_mint::find_cmint_address, decompress_full::DecompressFullAccounts, + create_compressed_mint::find_mint_address, decompress_full::DecompressFullAccounts, }; use sdk_token_test::mint_compressed_tokens_cpi_write::MintCompressedTokensCpiWriteParams; use solana_sdk::{ @@ -45,7 +45,7 @@ async fn setup_decompress_full_test(num_inputs: usize) -> (LightProgramTest, Tes let payer = rpc.get_payer().insecure_clone(); let mint_seed = Keypair::new(); - let mint_pubkey = find_cmint_address(&mint_seed.pubkey()).0; + let mint_pubkey = find_mint_address(&mint_seed.pubkey()).0; let mint_authority = payer.pubkey(); let decimals = 9u8; @@ -350,7 +350,7 @@ async fn test_decompress_full_cpi_with_context() { let address_tree_info = rpc.get_address_tree_v2(); let compressed_mint_address = - light_token_sdk::compressed_token::create_compressed_mint::derive_cmint_compressed_address( + light_token_sdk::compressed_token::create_compressed_mint::derive_mint_compressed_address( &ctx.mint_seed.pubkey(), &address_tree_info.tree, ); diff --git a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs index 97cf65c8e3..9772ebd75e 100644 --- a/sdk-tests/sdk-token-test/tests/pda_ctoken.rs +++ b/sdk-tests/sdk-token-test/tests/pda_ctoken.rs @@ -15,9 +15,7 @@ use light_token_interface::{ LIGHT_TOKEN_PROGRAM_ID, }; use light_token_sdk::{ - compressed_token::create_compressed_mint::{ - derive_cmint_compressed_address, find_cmint_address, - }, + compressed_token::create_compressed_mint::{derive_mint_compressed_address, find_mint_address}, token::{derive_token_ata, CompressibleParams, CreateAssociatedTokenAccount}, }; use light_token_types::CPI_AUTHORITY_PDA; @@ -194,10 +192,10 @@ pub async fn create_mint( // Derive compressed mint address using utility function let compressed_mint_address = - derive_cmint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); + derive_mint_compressed_address(&mint_seed.pubkey(), &address_tree_pubkey); // Find mint bump for the instruction - let (mint, _) = find_cmint_address(&mint_seed.pubkey()); + let (mint, _) = find_mint_address(&mint_seed.pubkey()); // Create compressed token associated token account for the mint authority let (token_account, _) = derive_token_ata(&mint_authority.pubkey(), &mint); diff --git a/sdk-tests/sdk-token-test/tests/test_4_invocations.rs b/sdk-tests/sdk-token-test/tests/test_4_invocations.rs index 15385135c9..a8c2508101 100644 --- a/sdk-tests/sdk-token-test/tests/test_4_invocations.rs +++ b/sdk-tests/sdk-token-test/tests/test_4_invocations.rs @@ -16,7 +16,7 @@ use light_token_sdk::{ TokenAccountMeta, }, spl_interface::get_spl_interface_pda, - utils::CTokenDefaultAccounts, + utils::TokenDefaultAccounts, }; use light_token_types::SPL_TOKEN_PROGRAM_ID; use solana_sdk::{ @@ -428,7 +428,7 @@ async fn test_four_invokes_instruction( initial_escrow_amount: u64, compression_token_account: Pubkey, ) -> Result<(), RpcError> { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); let mut remaining_accounts = PackedAccounts::default(); let spl_interface_pda1 = get_spl_interface_pda(&mint1, false); // Remaining accounts 0 diff --git a/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs b/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs index bfd8f57ecb..aad7110f3e 100644 --- a/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs +++ b/sdk-tests/sdk-token-test/tests/test_4_transfer2.rs @@ -19,7 +19,7 @@ use light_token_sdk::{ mint_to_compressed::{create_mint_to_compressed_instruction, MintToCompressedInputs}, }, token::CreateAssociatedTokenAccount, - utils::CTokenDefaultAccounts, + utils::TokenDefaultAccounts, }; use solana_sdk::{ instruction::Instruction, @@ -357,7 +357,7 @@ async fn test_four_transfer2_instruction( initial_escrow_amount: u64, token_account_1: Pubkey, ) -> Result<(), RpcError> { - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); let mut remaining_accounts = PackedAccounts::default(); // We don't need SPL token accounts for this test since we're using compressed tokens // Just add the compressed token program and CPI authority PDA diff --git a/sdk-tests/sdk-token-test/tests/test_deposit.rs b/sdk-tests/sdk-token-test/tests/test_deposit.rs index b6662f3f12..396d2cfecc 100644 --- a/sdk-tests/sdk-token-test/tests/test_deposit.rs +++ b/sdk-tests/sdk-token-test/tests/test_deposit.rs @@ -14,7 +14,7 @@ use light_token_sdk::{ get_batch_compress_instruction_account_metas, BatchCompressMetaConfig, Recipient, }, spl_interface::find_spl_interface_pda_with_index, - utils::CTokenDefaultAccounts, + utils::TokenDefaultAccounts, }; use light_token_types::{TokenAccountMeta, SPL_TOKEN_PROGRAM_ID}; use solana_sdk::{ @@ -165,7 +165,7 @@ async fn create_deposit_compressed_account( // let metas = get_transfer_instruction_account_metas(config); // remaining_accounts.add_pre_accounts_metas(metas); // Alternative even though we pass fewer account infos this is minimally more efficient. - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); remaining_accounts.add_pre_accounts_meta(AccountMeta::new( default_pubkeys.compressed_token_program, false, @@ -278,7 +278,7 @@ async fn update_deposit_compressed_account( .value; let mut remaining_accounts = PackedAccounts::default(); - let default_pubkeys = CTokenDefaultAccounts::default(); + let default_pubkeys = TokenDefaultAccounts::default(); remaining_accounts.add_pre_accounts_meta(AccountMeta::new( default_pubkeys.compressed_token_program, false, From 1e612723bf2ceca0edcaf5682f4ff280d00d6415 Mon Sep 17 00:00:00 2001 From: ananas Date: Tue, 13 Jan 2026 03:40:31 +0000 Subject: [PATCH 9/9] chore: rename ctoken fields to simpler names in token-sdk - Rename source_ctoken_account -> source in TransferToSpl - Rename destination_ctoken_account -> destination in TransferFromSpl, Decompress - Rename ctoken_ prefixed params in decompress_runtime.rs to token_ - Rename local vars: source_is_ctoken -> source_is_light_token - Update lib.rs doc table with correct type names - Fix CI workflow to use --test light_token instead of --test ctoken --- .github/workflows/programs.yml | 2 +- program-tests/CLAUDE.md | 2 +- .../tests/compress_only/all.rs | 2 +- .../tests/compress_only/ata_decompress.rs | 8 ++-- .../compress_only/decompress_restrictions.rs | 2 +- .../compress_only/invalid_destination.rs | 2 +- .../compress_only/invalid_extension_state.rs | 4 +- .../tests/compress_only/mod.rs | 2 +- .../tests/compress_only/withheld_fee.rs | 2 +- .../tests/freeze/compress_only.rs | 2 +- .../tests/light_token/extensions.rs | 6 +-- .../tests/light_token/extensions_failing.rs | 6 +-- .../tests/light_token/transfer_checked.rs | 2 +- .../tests/mint/functional.rs | 4 +- .../tests/transfer2/spl_ctoken.rs | 14 +++--- .../registry-test/tests/compressible.rs | 4 +- sdk-libs/token-client/src/actions/transfer.rs | 2 +- .../src/actions/transfer2/ctoken_to_spl.rs | 6 +-- .../src/actions/transfer2/spl_to_ctoken.rs | 6 +-- .../src/compressible/decompress_runtime.rs | 43 +++++++++---------- sdk-libs/token-sdk/src/lib.rs | 18 ++++---- sdk-libs/token-sdk/src/token/decompress.rs | 8 ++-- sdk-libs/token-sdk/src/token/mod.rs | 16 +++---- .../token/{transfer_token.rs => transfer.rs} | 0 ...r_token_checked.rs => transfer_checked.rs} | 0 ...r_spl_to_token.rs => transfer_from_spl.rs} | 26 +++++------ .../token-sdk/src/token/transfer_interface.rs | 23 +++++----- ...fer_token_to_spl.rs => transfer_to_spl.rs} | 20 ++++----- sdk-tests/sdk-light-token-test/src/lib.rs | 4 +- .../src/transfer_spl_ctoken.rs | 16 +++---- .../tests/scenario_cmint.rs | 2 +- .../tests/scenario_cmint_compression_only.rs | 2 +- .../tests/scenario_spl.rs | 4 +- .../tests/scenario_spl_restricted_ext.rs | 4 +- .../tests/test_transfer_checked.rs | 4 +- .../tests/test_transfer_spl_ctoken.rs | 12 +++--- 36 files changed, 138 insertions(+), 142 deletions(-) rename sdk-libs/token-sdk/src/token/{transfer_token.rs => transfer.rs} (100%) rename sdk-libs/token-sdk/src/token/{transfer_token_checked.rs => transfer_checked.rs} (100%) rename sdk-libs/token-sdk/src/token/{transfer_spl_to_token.rs => transfer_from_spl.rs} (91%) rename sdk-libs/token-sdk/src/token/{transfer_token_to_spl.rs => transfer_to_spl.rs} (94%) diff --git a/.github/workflows/programs.yml b/.github/workflows/programs.yml index 015641b2c5..5a9fe54d5b 100644 --- a/.github/workflows/programs.yml +++ b/.github/workflows/programs.yml @@ -56,7 +56,7 @@ jobs: - program: account-compression-and-registry sub-tests: '["cargo-test-sbf -p account-compression-test", "cargo-test-sbf -p registry-test"]' - program: light-system-program-address - sub-tests: '["cargo-test-sbf -p system-test -- test_with_address", "cargo-test-sbf -p e2e-test", "cargo-test-sbf -p compressed-token-test --test ctoken"]' + sub-tests: '["cargo-test-sbf -p system-test -- test_with_address", "cargo-test-sbf -p e2e-test", "cargo-test-sbf -p compressed-token-test --test light_token"]' - program: light-system-program-compression sub-tests: '["cargo-test-sbf -p system-test -- test_with_compression", "cargo-test-sbf -p system-test --test test_re_init_cpi_account"]' - program: compressed-token-and-e2e diff --git a/program-tests/CLAUDE.md b/program-tests/CLAUDE.md index cbacfb4b41..4293fb561c 100644 --- a/program-tests/CLAUDE.md +++ b/program-tests/CLAUDE.md @@ -78,7 +78,7 @@ Tests for Cross-Program Invocation (CPI) with Light system program V2. #### Core Token Tests ```bash -cargo test-sbf -p compressed-token-test --test ctoken +cargo test-sbf -p compressed-token-test --test light_token cargo test-sbf -p compressed-token-test --test v1 cargo test-sbf -p compressed-token-test --test mint cargo test-sbf -p compressed-token-test --test transfer2 diff --git a/program-tests/compressed-token-test/tests/compress_only/all.rs b/program-tests/compressed-token-test/tests/compress_only/all.rs index 250a3827fe..50b6861e11 100644 --- a/program-tests/compressed-token-test/tests/compress_only/all.rs +++ b/program-tests/compressed-token-test/tests/compress_only/all.rs @@ -93,7 +93,7 @@ async fn test_compress_and_close_ctoken_with_extensions() { spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs index cd020b2b32..f8f934114f 100644 --- a/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs +++ b/program-tests/compressed-token-test/tests/compress_only/ata_decompress.rs @@ -112,7 +112,7 @@ async fn setup_ata_compressed_token( spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ata_pubkey, + destination: ata_pubkey, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), @@ -1054,7 +1054,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ata_pubkey, + destination: ata_pubkey, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), @@ -1109,7 +1109,7 @@ async fn test_ata_multiple_compress_decompress_cycles() { spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ata_pubkey, + destination: ata_pubkey, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), @@ -1382,7 +1382,7 @@ async fn test_non_ata_compress_only_decompress() { spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs index 4ad3a5f970..698ac6ed3b 100644 --- a/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs +++ b/program-tests/compressed-token-test/tests/compress_only/decompress_restrictions.rs @@ -99,7 +99,7 @@ async fn setup_compressed_token_for_decompress( spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs index c9088e6c38..53ab26b0eb 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_destination.rs @@ -135,7 +135,7 @@ async fn setup_compressed_token_for_decompress( spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs index 64124ae36a..30e8f7223a 100644 --- a/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs +++ b/program-tests/compressed-token-test/tests/compress_only/invalid_extension_state.rs @@ -300,7 +300,7 @@ async fn setup_ctoken_for_bypass_test( spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), @@ -349,7 +349,7 @@ async fn test_ctoken_to_spl_bypasses_non_zero_fee() { sdk_find_spl_interface_pda(&mint_pubkey, 0, true); let transfer_ix = TransferToSpl { - source_ctoken_account: ctoken_account, + source: ctoken_account, destination_spl_token_account: spl_dest, amount: 100_000_000, authority: owner.pubkey(), diff --git a/program-tests/compressed-token-test/tests/compress_only/mod.rs b/program-tests/compressed-token-test/tests/compress_only/mod.rs index 4068e66e10..091b7a988b 100644 --- a/program-tests/compressed-token-test/tests/compress_only/mod.rs +++ b/program-tests/compressed-token-test/tests/compress_only/mod.rs @@ -234,7 +234,7 @@ pub async fn run_compress_and_close_extension_test( spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs index 6938de0521..be76972c2c 100644 --- a/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs +++ b/program-tests/compressed-token-test/tests/compress_only/withheld_fee.rs @@ -84,7 +84,7 @@ async fn test_roundtrip_withheld_transfer_fee_preserved() -> Result<(), RpcError spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/freeze/compress_only.rs b/program-tests/compressed-token-test/tests/freeze/compress_only.rs index f290705afc..e101f51867 100644 --- a/program-tests/compressed-token-test/tests/freeze/compress_only.rs +++ b/program-tests/compressed-token-test/tests/freeze/compress_only.rs @@ -222,7 +222,7 @@ async fn run_freeze_thaw_compressed_only_test( spl_interface_pda_bump, decimals: 9, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/light_token/extensions.rs b/program-tests/compressed-token-test/tests/light_token/extensions.rs index 8283bd394c..bfe240c52e 100644 --- a/program-tests/compressed-token-test/tests/light_token/extensions.rs +++ b/program-tests/compressed-token-test/tests/light_token/extensions.rs @@ -153,7 +153,7 @@ async fn test_mint_and_compress_with_extensions() { amount: transfer_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, - destination_ctoken_account: account_keypair.pubkey(), + destination: account_keypair.pubkey(), authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), @@ -398,7 +398,7 @@ async fn test_transfer_with_permanent_delegate() { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, - destination_ctoken_account: account_a_pubkey, + destination: account_a_pubkey, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), @@ -626,7 +626,7 @@ async fn test_transfer_with_owner_authority() { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, - destination_ctoken_account: account_a_pubkey, + destination: account_a_pubkey, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/light_token/extensions_failing.rs b/program-tests/compressed-token-test/tests/light_token/extensions_failing.rs index 49c0082675..567e8bbc7b 100644 --- a/program-tests/compressed-token-test/tests/light_token/extensions_failing.rs +++ b/program-tests/compressed-token-test/tests/light_token/extensions_failing.rs @@ -146,7 +146,7 @@ async fn setup_ctoken_accounts_for_transfer( amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, - destination_ctoken_account: account_a_pubkey, + destination: account_a_pubkey, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), @@ -394,7 +394,7 @@ async fn test_spl_to_ctoken_fails_when_mint_paused() { amount: 100_000_000, spl_interface_pda_bump, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), @@ -436,7 +436,7 @@ async fn test_spl_to_ctoken_fails_with_non_zero_transfer_fee() { amount: 100_000_000, spl_interface_pda_bump, source_spl_token_account: spl_account, - destination_ctoken_account: ctoken_account, + destination: ctoken_account, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/light_token/transfer_checked.rs b/program-tests/compressed-token-test/tests/light_token/transfer_checked.rs index 19f61e1dbd..1ed2287c37 100644 --- a/program-tests/compressed-token-test/tests/light_token/transfer_checked.rs +++ b/program-tests/compressed-token-test/tests/light_token/transfer_checked.rs @@ -137,7 +137,7 @@ async fn test_transfer_requires_checked_for_restricted_extensions() { amount: mint_amount, spl_interface_pda_bump, source_spl_token_account: spl_account, - destination_ctoken_account: account_a_pubkey, + destination: account_a_pubkey, authority: payer.pubkey(), mint: mint_pubkey, payer: payer.pubkey(), diff --git a/program-tests/compressed-token-test/tests/mint/functional.rs b/program-tests/compressed-token-test/tests/mint/functional.rs index 0e0fa9f654..18352d8927 100644 --- a/program-tests/compressed-token-test/tests/mint/functional.rs +++ b/program-tests/compressed-token-test/tests/mint/functional.rs @@ -14,7 +14,7 @@ use light_test_utils::{ Rpc, }; use light_token_client::{ - actions::{create_mint, mint_to_compressed, transfer2, transfer_token}, + actions::{create_mint, mint_to_compressed, transfer, transfer2}, instructions::{ mint_action::{DecompressMintParams, MintActionType}, transfer2::{ @@ -832,7 +832,7 @@ async fn test_ctoken_transfer() { second_recipient_ata_balance ); // Execute the decompressed transfer - let transfer_result = transfer_token( + let transfer_result = transfer( &mut rpc, recipient_ata, // Source account (has 1000 tokens) second_recipient_ata, // Destination account diff --git a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs index b475a64595..002fadadb7 100644 --- a/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs +++ b/program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs @@ -92,9 +92,9 @@ async fn test_spl_to_ctoken_transfer() { let initial_spl_balance: u64 = spl_account.amount.into(); assert_eq!(initial_spl_balance, amount); - // Use the new spl_to_ctoken_transfer action from light-token-client + // Use the new spl_to_light_token_transfer action from light-token-client // Note: create_mint_helper creates mints with 2 decimals - transfer2::spl_to_ctoken_transfer( + transfer2::spl_to_light_token_transfer( &mut rpc, spl_token_account_keypair.pubkey(), associated_token_account, @@ -146,7 +146,7 @@ async fn test_spl_to_ctoken_transfer() { println!("Testing reverse transfer: ctoken to SPL"); // Transfer from recipient's compressed token account back to sender's SPL token account - transfer2::transfer_ctoken_to_spl( + transfer2::transfer_light_token_to_spl( &mut rpc, associated_token_account, spl_token_account_keypair.pubkey(), @@ -261,7 +261,7 @@ async fn test_failing_ctoken_to_spl_with_compress_and_close() { .unwrap(); // Transfer SPL to Light Token - transfer2::spl_to_ctoken_transfer( + transfer2::spl_to_light_token_transfer( &mut rpc, spl_token_account_keypair.pubkey(), associated_token_account, @@ -301,7 +301,7 @@ async fn test_failing_ctoken_to_spl_with_compress_and_close() { find_spl_interface_pda_with_index(&mint, 0, false); let transfer_ix = CtokenToSplTransferAndClose { - source_ctoken_account: associated_token_account, + source: associated_token_account, destination_spl_token_account: spl_token_account_keypair.pubkey(), amount: transfer_amount, authority: recipient.pubkey(), @@ -323,7 +323,7 @@ async fn test_failing_ctoken_to_spl_with_compress_and_close() { } pub struct CtokenToSplTransferAndClose { - pub source_ctoken_account: Pubkey, + pub source: Pubkey, pub destination_spl_token_account: Pubkey, pub amount: u64, pub authority: Pubkey, @@ -341,7 +341,7 @@ impl CtokenToSplTransferAndClose { // Mint (index 0) AccountMeta::new_readonly(self.mint, false), // Source ctoken account (index 1) - writable - AccountMeta::new(self.source_ctoken_account, false), + AccountMeta::new(self.source, false), // Destination SPL token account (index 2) - writable AccountMeta::new(self.destination_spl_token_account, false), // Authority (index 3) - signer diff --git a/program-tests/registry-test/tests/compressible.rs b/program-tests/registry-test/tests/compressible.rs index 127455191d..0ef988013c 100644 --- a/program-tests/registry-test/tests/compressible.rs +++ b/program-tests/registry-test/tests/compressible.rs @@ -29,7 +29,7 @@ use light_test_utils::{ }; use light_token_client::{ actions::{ - create_compressible_token_account, mint_action_comprehensive, transfer_token, + create_compressible_token_account, mint_action_comprehensive, transfer, CreateCompressibleTokenAccountInputs, }, instructions::mint_action::{DecompressMintParams, NewMint}, @@ -1439,7 +1439,7 @@ async fn test_compressible_account_infinite_funding() -> Result<(), RpcError> { }; // Transfer all tokens from source to dest - transfer_token( + transfer( &mut rpc, source, dest, diff --git a/sdk-libs/token-client/src/actions/transfer.rs b/sdk-libs/token-client/src/actions/transfer.rs index 56220a266a..2d32024fb0 100644 --- a/sdk-libs/token-client/src/actions/transfer.rs +++ b/sdk-libs/token-client/src/actions/transfer.rs @@ -19,7 +19,7 @@ const SYSTEM_PROGRAM_ID: [u8; 32] = [0u8; 32]; /// /// # Returns /// `Result` - The transaction signature -pub async fn transfer_token( +pub async fn transfer( rpc: &mut R, source: Pubkey, destination: Pubkey, diff --git a/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs b/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs index 138298ae6d..90ca61ee88 100644 --- a/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs +++ b/sdk-libs/token-client/src/actions/transfer2/ctoken_to_spl.rs @@ -12,9 +12,9 @@ use solana_signer::Signer; /// Transfer tokens from a compressed token account to an SPL token account #[allow(clippy::too_many_arguments)] -pub async fn transfer_ctoken_to_spl( +pub async fn transfer_light_token_to_spl( rpc: &mut R, - source_ctoken_account: Pubkey, + source: Pubkey, destination_spl_token_account: Pubkey, amount: u64, authority: &Keypair, @@ -25,7 +25,7 @@ pub async fn transfer_ctoken_to_spl( let (spl_interface_pda, spl_interface_pda_bump) = find_spl_interface_pda(&mint, false); let transfer_ix = TransferToSpl { - source_ctoken_account, + source, destination_spl_token_account, amount, authority: authority.pubkey(), diff --git a/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs b/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs index 458ce13c9f..a50b64ed36 100644 --- a/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs +++ b/sdk-libs/token-client/src/actions/transfer2/spl_to_ctoken.rs @@ -13,10 +13,10 @@ use spl_pod::bytemuck::pod_from_bytes; use spl_token_2022::pod::PodAccount; /// Transfer SPL tokens to compressed tokens -pub async fn spl_to_ctoken_transfer( +pub async fn spl_to_light_token_transfer( rpc: &mut R, source_spl_token_account: Pubkey, - destination_ctoken_account: Pubkey, + destination: Pubkey, amount: u64, authority: &Keypair, payer: &Keypair, @@ -38,7 +38,7 @@ pub async fn spl_to_ctoken_transfer( amount, spl_interface_pda_bump, source_spl_token_account, - destination_ctoken_account, + destination, authority: authority.pubkey(), mint, payer: payer.pubkey(), diff --git a/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs b/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs index 1256bc68dd..e87be187c2 100644 --- a/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs +++ b/sdk-libs/token-sdk/src/compressible/decompress_runtime.rs @@ -40,12 +40,12 @@ pub fn process_decompress_tokens_runtime<'info, 'a, 'b, V, A>( accounts_for_seeds: &A, remaining_accounts: &[AccountInfo<'info>], fee_payer: &AccountInfo<'info>, - ctoken_program: &AccountInfo<'info>, - ctoken_rent_sponsor: &AccountInfo<'info>, - ctoken_cpi_authority: &AccountInfo<'info>, - ctoken_config: &AccountInfo<'info>, + token_program: &AccountInfo<'info>, + token_rent_sponsor: &AccountInfo<'info>, + token_cpi_authority: &AccountInfo<'info>, + token_config: &AccountInfo<'info>, config: &AccountInfo<'info>, - ctoken_accounts: Vec<( + token_accounts: Vec<( PackedCTokenData, CompressedAccountMetaNoLamportsNoAddress, )>, @@ -61,9 +61,8 @@ where { let mut token_decompress_indices: Vec< crate::compressed_token::decompress_full::DecompressFullIndices, - > = Vec::with_capacity(ctoken_accounts.len()); - let mut token_signers_seed_groups: Vec>> = - Vec::with_capacity(ctoken_accounts.len()); + > = Vec::with_capacity(token_accounts.len()); + let mut token_signers_seed_groups: Vec>> = Vec::with_capacity(token_accounts.len()); let packed_accounts = post_system_accounts; let authority = cpi_accounts @@ -80,7 +79,7 @@ where None }; - for (token_data, meta) in ctoken_accounts.into_iter() { + for (token_data, meta) in token_accounts.into_iter() { let owner_index: u8 = token_data.token_data.owner; let mint_index: u8 = token_data.token_data.mint; @@ -107,7 +106,7 @@ where let owner_info = &packed_accounts[owner_index_usize]; // Use trait method to get seeds (program-specific) - let (ctoken_signer_seeds, derived_token_account_address) = token_data + let (token_signer_seeds, derived_token_account_address) = token_data .variant .get_seeds(accounts_for_seeds, remaining_accounts)?; @@ -120,17 +119,17 @@ where return Err(ProgramError::InvalidAccountData); } - let seed_refs: Vec<&[u8]> = ctoken_signer_seeds.iter().map(|s| s.as_slice()).collect(); + let seed_refs: Vec<&[u8]> = token_signer_seeds.iter().map(|s| s.as_slice()).collect(); let seeds_slice: &[&[u8]] = &seed_refs; // Build CompressToPubkey from the signer seeds if bump is present - let compress_to_pubkey = ctoken_signer_seeds + let compress_to_pubkey = token_signer_seeds .last() .and_then(|b| b.first().copied()) .map(|bump| { - let seeds_without_bump: Vec> = ctoken_signer_seeds + let seeds_without_bump: Vec> = token_signer_seeds .iter() - .take(ctoken_signer_seeds.len().saturating_sub(1)) + .take(token_signer_seeds.len().saturating_sub(1)) .cloned() .collect(); CompressToPubkey { @@ -146,8 +145,8 @@ where mint: (*mint_info).clone(), owner: *authority.key, compressible: crate::token::CompressibleParamsCpi { - compressible_config: ctoken_config.clone(), - rent_sponsor: ctoken_rent_sponsor.clone(), + compressible_config: token_config.clone(), + rent_sponsor: token_rent_sponsor.clone(), system_program: cpi_accounts .system_program() .map_err(|_| ProgramError::InvalidAccountData)? @@ -177,10 +176,10 @@ where tlv: None, }; token_decompress_indices.push(decompress_index); - token_signers_seed_groups.push(ctoken_signer_seeds); + token_signers_seed_groups.push(token_signer_seeds); } - let ctoken_ix = + let token_ix = crate::compressed_token::decompress_full::decompress_full_token_accounts_with_indices( *fee_payer.key, proof, @@ -193,9 +192,9 @@ where let mut all_account_infos: Vec> = Vec::with_capacity(1 + post_system_accounts.len() + 3); all_account_infos.push(fee_payer.clone()); - all_account_infos.push(ctoken_cpi_authority.clone()); - all_account_infos.push(ctoken_program.clone()); - all_account_infos.push(ctoken_rent_sponsor.clone()); + all_account_infos.push(token_cpi_authority.clone()); + all_account_infos.push(token_program.clone()); + all_account_infos.push(token_rent_sponsor.clone()); all_account_infos.push(config.clone()); all_account_infos.extend_from_slice(post_system_accounts); @@ -206,7 +205,7 @@ where let signer_seed_slices: Vec<&[&[u8]]> = signer_seed_refs.iter().map(|g| g.as_slice()).collect(); solana_cpi::invoke_signed( - &ctoken_ix, + &token_ix, all_account_infos.as_slice(), signer_seed_slices.as_slice(), )?; diff --git a/sdk-libs/token-sdk/src/lib.rs b/sdk-libs/token-sdk/src/lib.rs index 4826a69365..d80cd22760 100644 --- a/sdk-libs/token-sdk/src/lib.rs +++ b/sdk-libs/token-sdk/src/lib.rs @@ -45,16 +45,16 @@ //! //! | Operation | Instruction Builder | CPI Builder | //! |-----------|----------------|-------------| -//! | Create Associated cToken Account | [`CreateAssociatedTokenAccount`](token::CreateAssociatedTokenAccount) | [`CreateAssociatedCTokenAccountCpi`](token::CreateAssociatedCTokenAccountCpi) | -//! | Create cToken Account | [`CreateTokenAccount`](token::CreateTokenAccount) | [`CreateTokenAccountCpi`](token::CreateTokenAccountCpi) | -//! | Transfer cToken | [`Transfer`](token::Transfer) | [`TransferCTokenCpi`](token::TransferCTokenCpi) | -//! | Transfer cToken → SPL | [`TransferToSpl`](token::TransferToSpl) | [`TransferToSplCpi`](token::TransferToSplCpi) | -//! | Transfer SPL → cToken | [`TransferFromSpl`](token::TransferFromSpl) | [`TransferFromSplCpi`](token::TransferFromSplCpi) | +//! | Create Associated Token Account | [`CreateAssociatedTokenAccount`](token::CreateAssociatedTokenAccount) | [`CreateAssociatedAccountCpi`](token::CreateAssociatedAccountCpi) | +//! | Create Token Account | [`CreateTokenAccount`](token::CreateTokenAccount) | [`CreateTokenAccountCpi`](token::CreateTokenAccountCpi) | +//! | Transfer | [`Transfer`](token::Transfer) | [`TransferCpi`](token::TransferCpi) | +//! | Transfer to SPL | [`TransferToSpl`](token::TransferToSpl) | [`TransferToSplCpi`](token::TransferToSplCpi) | +//! | Transfer from SPL | [`TransferFromSpl`](token::TransferFromSpl) | [`TransferFromSplCpi`](token::TransferFromSplCpi) | //! | Transfer (auto-detect) | - | [`TransferInterfaceCpi`](token::TransferInterfaceCpi) | -//! | Decompress to cToken account | [`DecompressToCtoken`](token::DecompressToCtoken) | - | -//! | Close cToken account | [`CloseCTokenAccount`](token::CloseCTokenAccount) | [`CloseCTokenAccountCpi`](token::CloseCTokenAccountCpi) | -//! | Create cMint | [`CreateMint`](token::CreateMint) | [`CreateCMintCpi`](token::CreateCMintCpi) | -//! | MintTo cToken account from cMint | [`MintToCToken`](token::MintToCToken) | [`MintToCTokenCpi`](token::MintToCTokenCpi) | +//! | Decompress to Token account | [`Decompress`](token::Decompress) | - | +//! | Close Token account | [`CloseAccount`](token::CloseAccount) | [`CloseAccountCpi`](token::CloseAccountCpi) | +//! | Create Mint | [`CreateMint`](token::CreateMint) | [`CreateMintCpi`](token::CreateMintCpi) | +//! | MintTo | [`MintTo`](token::MintTo) | [`MintToCpi`](token::MintToCpi) | //! //! //! # Disclaimer diff --git a/sdk-libs/token-sdk/src/token/decompress.rs b/sdk-libs/token-sdk/src/token/decompress.rs index 32275f9c8f..d034ee8886 100644 --- a/sdk-libs/token-sdk/src/token/decompress.rs +++ b/sdk-libs/token-sdk/src/token/decompress.rs @@ -28,7 +28,7 @@ use crate::{ /// # use light_token_sdk::token::Decompress; /// # use light_token_sdk::compat::TokenData; /// # use light_compressed_account::instruction_data::compressed_proof::ValidityProof; -/// # let destination_ctoken_account = Pubkey::new_unique(); +/// # let destination = Pubkey::new_unique(); /// # let payer = Pubkey::new_unique(); /// # let signer = Pubkey::new_unique(); /// # let merkle_tree = Pubkey::new_unique(); @@ -42,7 +42,7 @@ use crate::{ /// queue, /// leaf_index: 0, /// root_index: 0, -/// destination_ctoken_account, +/// destination, /// payer, /// signer, /// validity_proof: ValidityProof::new(None), @@ -64,7 +64,7 @@ pub struct Decompress { /// Root index pub root_index: u16, /// Destination cToken account (must exist) - pub destination_ctoken_account: Pubkey, + pub destination: Pubkey, /// Fee payer pub payer: Pubkey, /// Signer (wallet owner, delegate, or permanent delegate) @@ -146,7 +146,7 @@ impl Decompress { let indices = pack_for_decompress_full_with_ata( &self.token_data, &tree_info, - self.destination_ctoken_account, + self.destination, &mut packed_accounts, tlv, version, diff --git a/sdk-libs/token-sdk/src/token/mod.rs b/sdk-libs/token-sdk/src/token/mod.rs index 4e27c203f5..9094faa6b0 100644 --- a/sdk-libs/token-sdk/src/token/mod.rs +++ b/sdk-libs/token-sdk/src/token/mod.rs @@ -88,11 +88,11 @@ mod mint_to; mod mint_to_checked; mod revoke; mod thaw; +mod transfer; +mod transfer_checked; +mod transfer_from_spl; mod transfer_interface; -mod transfer_spl_to_token; -mod transfer_token; -mod transfer_token_checked; -mod transfer_token_to_spl; +mod transfer_to_spl; pub use approve::*; pub use approve_checked::*; @@ -121,11 +121,11 @@ pub use revoke::{Revoke, RevokeCpi}; use solana_account_info::AccountInfo; use solana_pubkey::{pubkey, Pubkey}; pub use thaw::{Thaw, ThawCpi}; +pub use transfer::*; +pub use transfer_checked::*; +pub use transfer_from_spl::{TransferFromSpl, TransferFromSplCpi}; pub use transfer_interface::{SplInterface, TransferInterfaceCpi}; -pub use transfer_spl_to_token::{TransferFromSpl, TransferFromSplCpi}; -pub use transfer_token::*; -pub use transfer_token_checked::*; -pub use transfer_token_to_spl::{TransferToSpl, TransferToSplCpi}; +pub use transfer_to_spl::{TransferToSpl, TransferToSplCpi}; /// System accounts required for CPI operations to Light Protocol. /// diff --git a/sdk-libs/token-sdk/src/token/transfer_token.rs b/sdk-libs/token-sdk/src/token/transfer.rs similarity index 100% rename from sdk-libs/token-sdk/src/token/transfer_token.rs rename to sdk-libs/token-sdk/src/token/transfer.rs diff --git a/sdk-libs/token-sdk/src/token/transfer_token_checked.rs b/sdk-libs/token-sdk/src/token/transfer_checked.rs similarity index 100% rename from sdk-libs/token-sdk/src/token/transfer_token_checked.rs rename to sdk-libs/token-sdk/src/token/transfer_checked.rs diff --git a/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs b/sdk-libs/token-sdk/src/token/transfer_from_spl.rs similarity index 91% rename from sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs rename to sdk-libs/token-sdk/src/token/transfer_from_spl.rs index 1293af3e93..fe8454283b 100644 --- a/sdk-libs/token-sdk/src/token/transfer_spl_to_token.rs +++ b/sdk-libs/token-sdk/src/token/transfer_from_spl.rs @@ -18,7 +18,7 @@ use crate::compressed_token::{ /// # use solana_pubkey::Pubkey; /// # use light_token_sdk::token::TransferFromSpl; /// # let source_spl_token_account = Pubkey::new_unique(); -/// # let destination_ctoken_account = Pubkey::new_unique(); +/// # let destination = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); /// # let payer = Pubkey::new_unique(); @@ -29,7 +29,7 @@ use crate::compressed_token::{ /// spl_interface_pda_bump: 255, /// decimals: 9, /// source_spl_token_account, -/// destination_ctoken_account, +/// destination, /// authority, /// mint, /// payer, @@ -44,7 +44,7 @@ pub struct TransferFromSpl { pub decimals: u8, pub source_spl_token_account: Pubkey, /// Destination ctoken account (writable) - pub destination_ctoken_account: Pubkey, + pub destination: Pubkey, pub authority: Pubkey, pub mint: Pubkey, pub payer: Pubkey, @@ -57,7 +57,7 @@ pub struct TransferFromSpl { /// # use light_token_sdk::token::TransferFromSplCpi; /// # use solana_account_info::AccountInfo; /// # let source_spl_token_account: AccountInfo = todo!(); -/// # let destination_ctoken_account: AccountInfo = todo!(); +/// # let destination: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); /// # let payer: AccountInfo = todo!(); @@ -70,7 +70,7 @@ pub struct TransferFromSpl { /// spl_interface_pda_bump: 255, /// decimals: 9, /// source_spl_token_account, -/// destination_ctoken_account, +/// destination, /// authority, /// mint, /// payer, @@ -88,7 +88,7 @@ pub struct TransferFromSplCpi<'info> { pub decimals: u8, pub source_spl_token_account: AccountInfo<'info>, /// Destination ctoken account (writable) - pub destination_ctoken_account: AccountInfo<'info>, + pub destination: AccountInfo<'info>, pub authority: AccountInfo<'info>, pub mint: AccountInfo<'info>, pub payer: AccountInfo<'info>, @@ -111,7 +111,7 @@ impl<'info> TransferFromSplCpi<'info> { self.compressed_token_program_authority, // CPI authority PDA (first) self.payer, // Fee payer (second) self.mint, // Index 0: Mint - self.destination_ctoken_account, // Index 1: Destination ctoken account + self.destination, // Index 1: Destination ctoken account self.authority, // Index 2: Authority (signer) self.source_spl_token_account, // Index 3: Source SPL token account self.spl_interface_pda, // Index 4: SPL interface PDA @@ -128,7 +128,7 @@ impl<'info> TransferFromSplCpi<'info> { self.compressed_token_program_authority, // CPI authority PDA (first) self.payer, // Fee payer (second) self.mint, // Index 0: Mint - self.destination_ctoken_account, // Index 1: Destination ctoken account + self.destination, // Index 1: Destination ctoken account self.authority, // Index 2: Authority (signer) self.source_spl_token_account, // Index 3: Source SPL token account self.spl_interface_pda, // Index 4: SPL interface PDA @@ -143,7 +143,7 @@ impl<'info> From<&TransferFromSplCpi<'info>> for TransferFromSpl { fn from(account_infos: &TransferFromSplCpi<'info>) -> Self { Self { source_spl_token_account: *account_infos.source_spl_token_account.key, - destination_ctoken_account: *account_infos.destination_ctoken_account.key, + destination: *account_infos.destination.key, amount: account_infos.amount, authority: *account_infos.authority.key, mint: *account_infos.mint.key, @@ -162,7 +162,7 @@ impl TransferFromSpl { // Mint (index 0) AccountMeta::new_readonly(self.mint, false), // Destination ctoken account (index 1) - writable - AccountMeta::new(self.destination_ctoken_account, false), + AccountMeta::new(self.destination, false), // Authority for compression (index 2) - signer AccountMeta::new_readonly(self.authority, true), // Source SPL token account (index 3) - writable @@ -175,7 +175,7 @@ impl TransferFromSpl { AccountMeta::new_readonly(Pubkey::default(), false), ]; - let wrap_spl_to_ctoken_account = CTokenAccount2 { + let wrap_from_spl = CTokenAccount2 { inputs: vec![], output: MultiTokenTransferOutputData::default(), compression: Some(Compression::compress_spl( @@ -192,7 +192,7 @@ impl TransferFromSpl { method_used: true, }; - let ctoken_account = CTokenAccount2 { + let unwrap_to_destination = CTokenAccount2 { inputs: vec![], output: MultiTokenTransferOutputData::default(), compression: Some(Compression::decompress(self.amount, 0, 1)), @@ -209,7 +209,7 @@ impl TransferFromSpl { ), in_lamports: None, out_lamports: None, - token_accounts: vec![wrap_spl_to_ctoken_account, ctoken_account], + token_accounts: vec![wrap_from_spl, unwrap_to_destination], output_queue: 0, // Decompressed accounts only, no output queue needed in_tlv: None, }; diff --git a/sdk-libs/token-sdk/src/token/transfer_interface.rs b/sdk-libs/token-sdk/src/token/transfer_interface.rs index a8fd4ad5d0..22717797e0 100644 --- a/sdk-libs/token-sdk/src/token/transfer_interface.rs +++ b/sdk-libs/token-sdk/src/token/transfer_interface.rs @@ -2,8 +2,7 @@ use solana_account_info::AccountInfo; use solana_program_error::ProgramError; use super::{ - transfer_spl_to_token::TransferFromSplCpi, transfer_token::TransferCpi, - transfer_token_to_spl::TransferToSplCpi, + transfer::TransferCpi, transfer_from_spl::TransferFromSplCpi, transfer_to_spl::TransferToSplCpi, }; use crate::{error::TokenSdkError, utils::is_token_account}; @@ -101,12 +100,12 @@ impl<'info> TransferInterfaceCpi<'info> { /// * `UseRegularSplTransfer` - If both source and destination are SPL accounts /// * `CannotDetermineAccountType` - If account type cannot be determined pub fn invoke(self) -> Result<(), ProgramError> { - let source_is_ctoken = is_token_account(&self.source_account) + let source_is_light_token = is_token_account(&self.source_account) .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; - let dest_is_ctoken = is_token_account(&self.destination_account) + let dest_is_light_token = is_token_account(&self.destination_account) .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; - match (source_is_ctoken, dest_is_ctoken) { + match (source_is_light_token, dest_is_light_token) { (true, true) => TransferCpi { source: self.source_account.clone(), destination: self.destination_account.clone(), @@ -122,7 +121,7 @@ impl<'info> TransferInterfaceCpi<'info> { })?; TransferToSplCpi { - source_ctoken_account: self.source_account.clone(), + source: self.source_account.clone(), destination_spl_token_account: self.destination_account.clone(), amount: self.amount, authority: self.authority.clone(), @@ -146,7 +145,7 @@ impl<'info> TransferInterfaceCpi<'info> { TransferFromSplCpi { source_spl_token_account: self.source_account.clone(), - destination_ctoken_account: self.destination_account.clone(), + destination: self.destination_account.clone(), amount: self.amount, authority: self.authority.clone(), mint: config.mint.clone(), @@ -174,12 +173,12 @@ impl<'info> TransferInterfaceCpi<'info> { /// * `UseRegularSplTransfer` - If both source and destination are SPL accounts /// * `CannotDetermineAccountType` - If account type cannot be determined pub fn invoke_signed(self, signer_seeds: &[&[&[u8]]]) -> Result<(), ProgramError> { - let source_is_ctoken = is_token_account(&self.source_account) + let source_is_light_token = is_token_account(&self.source_account) .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; - let dest_is_ctoken = is_token_account(&self.destination_account) + let dest_is_light_token = is_token_account(&self.destination_account) .map_err(|_| ProgramError::Custom(TokenSdkError::CannotDetermineAccountType.into()))?; - match (source_is_ctoken, dest_is_ctoken) { + match (source_is_light_token, dest_is_light_token) { (true, true) => TransferCpi { source: self.source_account.clone(), destination: self.destination_account.clone(), @@ -195,7 +194,7 @@ impl<'info> TransferInterfaceCpi<'info> { })?; TransferToSplCpi { - source_ctoken_account: self.source_account.clone(), + source: self.source_account.clone(), destination_spl_token_account: self.destination_account.clone(), amount: self.amount, authority: self.authority.clone(), @@ -219,7 +218,7 @@ impl<'info> TransferInterfaceCpi<'info> { TransferFromSplCpi { source_spl_token_account: self.source_account.clone(), - destination_ctoken_account: self.destination_account.clone(), + destination: self.destination_account.clone(), amount: self.amount, authority: self.authority.clone(), mint: config.mint.clone(), diff --git a/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs b/sdk-libs/token-sdk/src/token/transfer_to_spl.rs similarity index 94% rename from sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs rename to sdk-libs/token-sdk/src/token/transfer_to_spl.rs index dbbe262fba..b9c0465052 100644 --- a/sdk-libs/token-sdk/src/token/transfer_token_to_spl.rs +++ b/sdk-libs/token-sdk/src/token/transfer_to_spl.rs @@ -18,7 +18,7 @@ use crate::compressed_token::{ /// ```rust /// # use solana_pubkey::Pubkey; /// # use light_token_sdk::token::TransferToSpl; -/// # let source_ctoken_account = Pubkey::new_unique(); +/// # let source = Pubkey::new_unique(); /// # let destination_spl_token_account = Pubkey::new_unique(); /// # let authority = Pubkey::new_unique(); /// # let mint = Pubkey::new_unique(); @@ -26,7 +26,7 @@ use crate::compressed_token::{ /// # let spl_interface_pda = Pubkey::new_unique(); /// # let spl_token_program = Pubkey::new_unique(); /// let instruction = TransferToSpl { -/// source_ctoken_account, +/// source, /// destination_spl_token_account, /// amount: 100, /// authority, @@ -40,7 +40,7 @@ use crate::compressed_token::{ /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` pub struct TransferToSpl { - pub source_ctoken_account: Pubkey, + pub source: Pubkey, pub destination_spl_token_account: Pubkey, pub amount: u64, pub authority: Pubkey, @@ -56,7 +56,7 @@ pub struct TransferToSpl { /// ```rust,no_run /// # use light_token_sdk::token::TransferToSplCpi; /// # use solana_account_info::AccountInfo; -/// # let source_ctoken_account: AccountInfo = todo!(); +/// # let source: AccountInfo = todo!(); /// # let destination_spl_token_account: AccountInfo = todo!(); /// # let authority: AccountInfo = todo!(); /// # let mint: AccountInfo = todo!(); @@ -65,7 +65,7 @@ pub struct TransferToSpl { /// # let spl_token_program: AccountInfo = todo!(); /// # let compressed_token_program_authority: AccountInfo = todo!(); /// TransferToSplCpi { -/// source_ctoken_account, +/// source, /// destination_spl_token_account, /// amount: 100, /// authority, @@ -81,7 +81,7 @@ pub struct TransferToSpl { /// # Ok::<(), solana_program_error::ProgramError>(()) /// ``` pub struct TransferToSplCpi<'info> { - pub source_ctoken_account: AccountInfo<'info>, + pub source: AccountInfo<'info>, pub destination_spl_token_account: AccountInfo<'info>, pub amount: u64, pub authority: AccountInfo<'info>, @@ -106,7 +106,7 @@ impl<'info> TransferToSplCpi<'info> { self.compressed_token_program_authority, // CPI authority PDA (first) self.payer, // Fee payer (second) self.mint, // Index 0: Mint - self.source_ctoken_account, // Index 1: Source ctoken account + self.source, // Index 1: Source ctoken account self.destination_spl_token_account, // Index 2: Destination SPL token account self.authority, // Index 3: Authority (signer) self.spl_interface_pda, // Index 4: SPL interface PDA @@ -122,7 +122,7 @@ impl<'info> TransferToSplCpi<'info> { self.compressed_token_program_authority, // CPI authority PDA (first) self.payer, // Fee payer (second) self.mint, // Index 0: Mint - self.source_ctoken_account, // Index 1: Source ctoken account + self.source, // Index 1: Source ctoken account self.destination_spl_token_account, // Index 2: Destination SPL token account self.authority, // Index 3: Authority (signer) self.spl_interface_pda, // Index 4: SPL interface PDA @@ -135,7 +135,7 @@ impl<'info> TransferToSplCpi<'info> { impl<'info> From<&TransferToSplCpi<'info>> for TransferToSpl { fn from(account_infos: &TransferToSplCpi<'info>) -> Self { Self { - source_ctoken_account: *account_infos.source_ctoken_account.key, + source: *account_infos.source.key, destination_spl_token_account: *account_infos.destination_spl_token_account.key, amount: account_infos.amount, authority: *account_infos.authority.key, @@ -156,7 +156,7 @@ impl TransferToSpl { // Mint (index 0) AccountMeta::new_readonly(self.mint, false), // Source ctoken account (index 1) - writable - AccountMeta::new(self.source_ctoken_account, false), + AccountMeta::new(self.source, false), // Destination SPL token account (index 2) - writable AccountMeta::new(self.destination_spl_token_account, false), // Authority (index 3) - signer diff --git a/sdk-tests/sdk-light-token-test/src/lib.rs b/sdk-tests/sdk-light-token-test/src/lib.rs index 414bdfec8e..840805cdba 100644 --- a/sdk-tests/sdk-light-token-test/src/lib.rs +++ b/sdk-tests/sdk-light-token-test/src/lib.rs @@ -29,9 +29,7 @@ pub use create_token_account::{ process_create_token_account_invoke, process_create_token_account_invoke_signed, CreateTokenAccountData, }; -pub use ctoken_mint_to::{ - process_mint_to_invoke, process_mint_to_invoke_signed, MintToData, -}; +pub use ctoken_mint_to::{process_mint_to_invoke, process_mint_to_invoke_signed, MintToData}; pub use decompress_cmint::{process_decompress_cmint_invoke_signed, DecompressCmintData}; pub use freeze::{process_freeze_invoke, process_freeze_invoke_signed}; pub use revoke::{process_revoke_invoke, process_revoke_invoke_signed}; diff --git a/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs b/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs index 70db33ab7e..805f04eadb 100644 --- a/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/src/transfer_spl_ctoken.rs @@ -28,7 +28,7 @@ pub struct TransferTokenToSplData { /// Account order: /// - accounts[0]: compressed_token_program (for CPI) /// - accounts[1]: source_spl_token_account -/// - accounts[2]: destination_ctoken_account (writable) +/// - accounts[2]: destination (writable) /// - accounts[3]: authority (signer) /// - accounts[4]: mint /// - accounts[5]: payer (signer) @@ -46,7 +46,7 @@ pub fn process_spl_to_ctoken_invoke( TransferFromSplCpi { source_spl_token_account: accounts[1].clone(), - destination_ctoken_account: accounts[2].clone(), + destination: accounts[2].clone(), amount: data.amount, authority: accounts[3].clone(), mint: accounts[4].clone(), @@ -70,7 +70,7 @@ pub fn process_spl_to_ctoken_invoke( /// Account order: /// - accounts[0]: compressed_token_program (for CPI) /// - accounts[1]: source_spl_token_account -/// - accounts[2]: destination_ctoken_account (writable) +/// - accounts[2]: destination (writable) /// - accounts[3]: authority (PDA, not signer - program signs) /// - accounts[4]: mint /// - accounts[5]: payer (signer) @@ -97,7 +97,7 @@ pub fn process_spl_to_ctoken_invoke_signed( let account_infos = TransferFromSplCpi { source_spl_token_account: accounts[1].clone(), - destination_ctoken_account: accounts[2].clone(), + destination: accounts[2].clone(), amount: data.amount, authority: accounts[3].clone(), mint: accounts[4].clone(), @@ -121,7 +121,7 @@ pub fn process_spl_to_ctoken_invoke_signed( /// /// Account order: /// - accounts[0]: compressed_token_program (for CPI) -/// - accounts[1]: source_ctoken_account +/// - accounts[1]: source /// - accounts[2]: destination_spl_token_account /// - accounts[3]: authority (signer) /// - accounts[4]: mint @@ -138,7 +138,7 @@ pub fn process_ctoken_to_spl_invoke( } TransferToSplCpi { - source_ctoken_account: accounts[1].clone(), + source: accounts[1].clone(), destination_spl_token_account: accounts[2].clone(), amount: data.amount, authority: accounts[3].clone(), @@ -161,7 +161,7 @@ pub fn process_ctoken_to_spl_invoke( /// /// Account order: /// - accounts[0]: compressed_token_program (for CPI) -/// - accounts[1]: source_ctoken_account +/// - accounts[1]: source /// - accounts[2]: destination_spl_token_account /// - accounts[3]: authority (PDA, not signer - program signs) /// - accounts[4]: mint @@ -187,7 +187,7 @@ pub fn process_ctoken_to_spl_invoke_signed( } let account_infos = TransferToSplCpi { - source_ctoken_account: accounts[1].clone(), + source: accounts[1].clone(), destination_spl_token_account: accounts[2].clone(), amount: data.amount, authority: accounts[3].clone(), diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs b/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs index a100a2a4a1..731754e4db 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_cmint.rs @@ -243,7 +243,7 @@ async fn test_cmint_to_ctoken_scenario() { queue: account_proof.tree_info.queue, leaf_index: account_proof.leaf_index as u32, root_index: account_proof.root_index.root_index().unwrap_or(0), - destination_ctoken_account: ctoken_ata2, + destination: ctoken_ata2, payer: payer.pubkey(), signer: owner2.pubkey(), // Wallet owner is the signer for ATA decompress validity_proof: rpc_result.proof, diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs b/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs index 2a15f648d0..c5a622eb5e 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_cmint_compression_only.rs @@ -250,7 +250,7 @@ async fn test_cmint_to_ctoken_scenario_compression_only() { queue: account_proof.tree_info.queue, leaf_index: account_proof.leaf_index as u32, root_index: account_proof.root_index.root_index().unwrap_or(0), - destination_ctoken_account: ctoken_ata2, + destination: ctoken_ata2, payer: payer.pubkey(), signer: owner2.pubkey(), validity_proof: rpc_result.proof, diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs b/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs index bc5cfafd19..5f1eab4325 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_spl.rs @@ -157,7 +157,7 @@ async fn test_spl_to_ctoken_scenario() { spl_interface_pda_bump, decimals, source_spl_token_account: spl_token_account_keypair.pubkey(), - destination_ctoken_account: ctoken_ata, + destination: ctoken_ata, authority: token_owner.pubkey(), mint, payer: payer.pubkey(), @@ -372,7 +372,7 @@ async fn test_spl_to_ctoken_scenario() { queue: account_proof.tree_info.queue, leaf_index: account_proof.leaf_index as u32, root_index: account_proof.root_index.root_index().unwrap_or(0), - destination_ctoken_account: ctoken_ata, + destination: ctoken_ata, payer: payer.pubkey(), signer: ctoken_recipient.pubkey(), validity_proof: rpc_result.proof, diff --git a/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs b/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs index 0b5ed7af22..60a3e2975a 100644 --- a/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs +++ b/sdk-tests/sdk-light-token-test/tests/scenario_spl_restricted_ext.rs @@ -106,7 +106,7 @@ async fn test_t22_restricted_to_ctoken_scenario() { spl_interface_pda_bump, decimals, source_spl_token_account: t22_token_account, - destination_ctoken_account: ctoken_ata, + destination: ctoken_ata, authority: token_owner.pubkey(), mint, payer: payer.pubkey(), @@ -272,7 +272,7 @@ async fn test_t22_restricted_to_ctoken_scenario() { queue: account_proof.tree_info.queue, leaf_index: account_proof.leaf_index as u32, root_index: account_proof.root_index.root_index().unwrap_or(0), - destination_ctoken_account: ctoken_ata, + destination: ctoken_ata, payer: payer.pubkey(), signer: ctoken_recipient.pubkey(), validity_proof: rpc_result.proof, diff --git a/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs index 90e146343b..393b5ecd6f 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_checked.rs @@ -122,7 +122,7 @@ async fn test_ctoken_transfer_checked_spl_mint() { spl_interface_pda_bump, decimals, source_spl_token_account: spl_token_account_keypair.pubkey(), - destination_ctoken_account: source_ata, + destination: source_ata, authority: payer.pubkey(), mint, payer: payer.pubkey(), @@ -227,7 +227,7 @@ async fn test_ctoken_transfer_checked_t22_mint() { spl_interface_pda_bump, decimals, source_spl_token_account: t22_token_account, - destination_ctoken_account: source_ata, + destination: source_ata, authority: payer.pubkey(), mint, payer: payer.pubkey(), diff --git a/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs b/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs index 7fb9a84499..b88a1a55c6 100644 --- a/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs +++ b/sdk-tests/sdk-light-token-test/tests/test_transfer_spl_ctoken.rs @@ -106,7 +106,7 @@ async fn test_spl_to_ctoken_invoke() { // Account order from handler: // - accounts[0]: compressed_token_program (for CPI) // - accounts[1]: source_spl_token_account - // - accounts[2]: destination_ctoken_account (writable) + // - accounts[2]: destination (writable) // - accounts[3]: authority (signer) // - accounts[4]: mint // - accounts[5]: payer (signer) @@ -117,7 +117,7 @@ async fn test_spl_to_ctoken_invoke() { let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), AccountMeta::new(spl_token_account_keypair.pubkey(), false), - AccountMeta::new(ctoken_account, false), // destination_ctoken_account (writable) + AccountMeta::new(ctoken_account, false), // destination (writable) AccountMeta::new_readonly(sender.pubkey(), true), // authority (signer) AccountMeta::new_readonly(mint, false), AccountMeta::new(payer.pubkey(), true), // payer (signer) @@ -231,7 +231,7 @@ async fn test_ctoken_to_spl_invoke() { let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), AccountMeta::new(temp_spl_account_keypair.pubkey(), false), - AccountMeta::new(ctoken_account, false), // destination_ctoken_account (writable) + AccountMeta::new(ctoken_account, false), // destination (writable) AccountMeta::new_readonly(owner.pubkey(), true), AccountMeta::new_readonly(mint, false), AccountMeta::new(payer.pubkey(), true), @@ -270,7 +270,7 @@ async fn test_ctoken_to_spl_invoke() { // Account order from handler: // - accounts[0]: compressed_token_program (for CPI) - // - accounts[1]: source_ctoken_account + // - accounts[1]: source // - accounts[2]: destination_spl_token_account // - accounts[3]: authority (signer) // - accounts[4]: mint @@ -406,7 +406,7 @@ async fn test_spl_to_ctoken_invoke_signed() { let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), AccountMeta::new(spl_ata, false), - AccountMeta::new(ctoken_account, false), // destination_ctoken_account (writable) + AccountMeta::new(ctoken_account, false), // destination (writable) AccountMeta::new_readonly(authority_pda, false), // authority is PDA, not signer AccountMeta::new_readonly(mint, false), AccountMeta::new(payer.pubkey(), true), // payer (signer) @@ -544,7 +544,7 @@ async fn test_ctoken_to_spl_invoke_signed() { let wrapper_accounts = vec![ AccountMeta::new_readonly(compressed_token_program_id, false), AccountMeta::new(temp_spl_account_keypair.pubkey(), false), - AccountMeta::new(ctoken_account, false), // destination_ctoken_account (writable) + AccountMeta::new(ctoken_account, false), // destination (writable) AccountMeta::new_readonly(temp_owner.pubkey(), true), AccountMeta::new_readonly(mint, false), AccountMeta::new(payer.pubkey(), true),