From d1a13273cb23c033bda97b4d47b9731b51ef5a2f Mon Sep 17 00:00:00 2001 From: Fernando Otero Date: Fri, 25 Aug 2023 16:28:28 +0300 Subject: [PATCH] Add rust client sdk (#41) * wip: add rust sdk generation * wip: update generated code * Update kinobi release * Update generated code * Add tests * Add readme * Tweak dependency versions * Add rust sdk workflows * Use program builds * Run sdk workflows in parallel * Rename program crate * Update generated clients * Fix program name * Fix binary name * Update description * Fix markdown * Bump kinobi version * Bump kinobi version * Update generated clients * Update examples * Add note on builders * Increase compute units * Fix print test * Rename client workflows * Refactor clients CI * Updata shank version * Tweaks * Pass all arguments to test * Update size config * Add size information * Use size constants --------- Co-authored-by: febo --- .github/file-filters.yml | 9 +- .github/workflows/build-rust-client.yml | 65 + .github/workflows/create-proposal.yml | 36 +- .../{deploy-js.yml => deploy-js-client.yml} | 0 .github/workflows/deploy-rust-client.yml | 92 + .github/workflows/main.yml | 19 +- .../{test-js.yml => test-js-client.yml} | 0 .github/workflows/test-rust-client.yml | 42 + ...{publish-crate.yml => version-program.yml} | 73 +- .vscode/settings.json | 1 + .../src/generated/accounts/editionMarkerV2.ts | 5 +- .../src/generated/accounts/masterEdition.ts | 4 - clients/js/src/generated/accounts/metadata.ts | 4 - clients/js/src/generated/types/seedsVec.ts | 3 +- clients/js/src/hooked/resolvers.ts | 10 +- clients/js/test/printV1.test.ts | 33 +- clients/rust/Cargo.lock | 5560 +++++++++++++++++ clients/rust/Cargo.toml | 29 + clients/rust/README.md | 276 + .../accounts/collection_authority_record.rs | 64 + .../rust/src/generated/accounts/edition.rs | 33 + .../src/generated/accounts/edition_marker.rs | 62 + .../generated/accounts/edition_marker_v2.rs | 59 + .../src/generated/accounts/master_edition.rs | 58 + .../rust/src/generated/accounts/metadata.rs | 75 + .../accounts/metadata_delegate_record.rs | 75 + clients/rust/src/generated/accounts/mod.rs | 28 + .../generated/accounts/token_owned_escrow.rs | 31 + .../src/generated/accounts/token_record.rs | 69 + .../accounts/use_authority_record.rs | 63 + clients/rust/src/generated/errors/mod.rs | 10 + .../generated/errors/mpl_token_metadata.rs | 598 ++ .../approve_collection_authority.rs | 413 ++ .../instructions/approve_use_authority.rs | 548 ++ .../bubblegum_set_collection_size.rs | 377 ++ .../instructions/burn_edition_nft.rs | 515 ++ .../src/generated/instructions/burn_nft.rs | 375 ++ .../src/generated/instructions/burn_v1.rs | 779 +++ .../instructions/close_escrow_account.rs | 399 ++ .../src/generated/instructions/collect.rs | 186 + .../convert_master_edition_v1_to_v2.rs | 230 + .../instructions/create_escrow_account.rs | 440 ++ .../instructions/create_master_edition_v3.rs | 476 ++ .../create_metadata_account_v3.rs | 441 ++ .../src/generated/instructions/create_v1.rs | 757 +++ .../delegate_authority_item_v1.rs | 773 +++ .../delegate_collection_item_v1.rs | 773 +++ .../instructions/delegate_collection_v1.rs | 773 +++ .../instructions/delegate_data_item_v1.rs | 773 +++ .../instructions/delegate_data_v1.rs | 769 +++ .../delegate_locked_transfer_v1.rs | 800 +++ .../delegate_programmable_config_item_v1.rs | 773 +++ .../delegate_programmable_config_v1.rs | 773 +++ .../instructions/delegate_sale_v1.rs | 772 +++ .../instructions/delegate_staking_v1.rs | 776 +++ .../instructions/delegate_standard_v1.rs | 757 +++ .../instructions/delegate_transfer_v1.rs | 776 +++ .../instructions/delegate_utility_v1.rs | 776 +++ ..._from_master_edition_via_printing_token.rs | 714 +++ .../instructions/freeze_delegated_account.rs | 293 + .../src/generated/instructions/lock_v1.rs | 716 +++ .../src/generated/instructions/migrate.rs | 696 +++ ...w_edition_from_master_edition_via_token.rs | 703 +++ ...ion_from_master_edition_via_vault_proxy.rs | 820 +++ .../src/generated/instructions/mint_v1.rs | 819 +++ .../rust/src/generated/instructions/mod.rs | 172 + .../src/generated/instructions/print_v1.rs | 896 +++ .../generated/instructions/puff_metadata.rs | 149 + .../remove_creator_verification.rs | 187 + .../instructions/revoke_authority_item_v1.rs | 735 +++ .../revoke_collection_authority.rs | 307 + .../instructions/revoke_collection_item_v1.rs | 735 +++ .../instructions/revoke_collection_v1.rs | 735 +++ .../instructions/revoke_data_item_v1.rs | 731 +++ .../generated/instructions/revoke_data_v1.rs | 731 +++ .../instructions/revoke_locked_transfer_v1.rs | 720 +++ .../instructions/revoke_migration_v1.rs | 720 +++ .../revoke_programmable_config_item_v1.rs | 735 +++ .../revoke_programmable_config_v1.rs | 735 +++ .../generated/instructions/revoke_sale_v1.rs | 716 +++ .../instructions/revoke_staking_v1.rs | 716 +++ .../instructions/revoke_standard_v1.rs | 716 +++ .../instructions/revoke_transfer_v1.rs | 716 +++ .../instructions/revoke_use_authority.rs | 442 ++ .../instructions/revoke_utility_v1.rs | 716 +++ .../instructions/set_and_verify_collection.rs | 427 ++ .../set_and_verify_sized_collection_item.rs | 427 ++ .../instructions/set_collection_size.rs | 337 + .../instructions/set_token_standard.rs | 260 + .../generated/instructions/sign_metadata.rs | 183 + .../instructions/thaw_delegated_account.rs | 293 + .../instructions/transfer_out_of_escrow.rs | 639 ++ .../src/generated/instructions/transfer_v1.rs | 887 +++ .../src/generated/instructions/unlock_v1.rs | 716 +++ .../instructions/unverify_collection.rs | 357 ++ .../instructions/unverify_collection_v1.rs | 422 ++ .../instructions/unverify_creator_v1.rs | 437 ++ .../unverify_sized_collection_item.rs | 387 ++ .../update_as_authority_item_delegate_v2.rs | 707 +++ .../update_as_collection_delegate_v2.rs | 656 ++ .../update_as_collection_item_delegate_v2.rs | 656 ++ .../update_as_data_delegate_v2.rs | 661 ++ .../update_as_data_item_delegate_v2.rs | 661 ++ ...date_as_programmable_config_delegate_v2.rs | 639 ++ ...as_programmable_config_item_delegate_v2.rs | 641 ++ .../update_as_update_authority_v2.rs | 826 +++ .../update_metadata_account_v2.rs | 286 + .../update_primary_sale_happened_via_token.rs | 213 + .../src/generated/instructions/update_v1.rs | 803 +++ .../rust/src/generated/instructions/use_v1.rs | 682 ++ .../src/generated/instructions/utilize.rs | 560 ++ .../instructions/verify_collection.rs | 383 ++ .../instructions/verify_collection_v1.rs | 477 ++ .../instructions/verify_creator_v1.rs | 488 ++ .../verify_sized_collection_item.rs | 387 ++ clients/rust/src/generated/mod.rs | 14 + clients/rust/src/generated/programs.rs | 11 + .../src/generated/types/authority_type.rs | 18 + .../src/generated/types/authorization_data.rs | 15 + clients/rust/src/generated/types/burn_args.rs | 14 + .../rust/src/generated/types/collection.rs | 16 + .../src/generated/types/collection_details.rs | 14 + .../types/collection_details_toggle.rs | 17 + .../src/generated/types/collection_toggle.rs | 17 + .../rust/src/generated/types/create_args.rs | 36 + clients/rust/src/generated/types/creator.rs | 17 + clients/rust/src/generated/types/data_v2.rs | 23 + .../rust/src/generated/types/delegate_args.rs | 60 + .../src/generated/types/escrow_authority.rs | 16 + clients/rust/src/generated/types/key.rs | 27 + clients/rust/src/generated/types/leaf_info.rs | 15 + clients/rust/src/generated/types/lock_args.rs | 17 + .../generated/types/metadata_delegate_role.rs | 21 + .../src/generated/types/migration_type.rs | 15 + clients/rust/src/generated/types/mint_args.rs | 18 + ...tion_from_master_edition_via_token_args.rs | 14 + clients/rust/src/generated/types/mod.rs | 92 + clients/rust/src/generated/types/payload.rs | 16 + .../rust/src/generated/types/payload_key.rs | 23 + .../rust/src/generated/types/payload_type.rs | 20 + .../rust/src/generated/types/print_args.rs | 14 + .../rust/src/generated/types/print_supply.rs | 16 + .../generated/types/programmable_config.rs | 15 + .../rust/src/generated/types/reservation.rs | 17 + .../src/generated/types/reservation_v1.rs | 17 + .../rust/src/generated/types/revoke_args.rs | 27 + .../src/generated/types/rule_set_toggle.rs | 17 + clients/rust/src/generated/types/seeds_vec.rs | 14 + .../types/set_collection_size_args.rs | 14 + .../generated/types/token_delegate_role.rs | 20 + .../src/generated/types/token_standard.rs | 19 + .../rust/src/generated/types/token_state.rs | 16 + .../rust/src/generated/types/transfer_args.rs | 18 + .../rust/src/generated/types/unlock_args.rs | 17 + .../rust/src/generated/types/update_args.rs | 108 + clients/rust/src/generated/types/use_args.rs | 17 + .../rust/src/generated/types/use_method.rs | 16 + clients/rust/src/generated/types/uses.rs | 17 + .../rust/src/generated/types/uses_toggle.rs | 17 + .../src/generated/types/verification_args.rs | 15 + .../src/hooked/metadata_delegate_role_seed.rs | 28 + clients/rust/src/hooked/mod.rs | 2 + clients/rust/src/lib.rs | 10 + clients/rust/tests/create.rs | 172 + clients/rust/tests/lock.rs | 97 + clients/rust/tests/setup/digital_asset.rs | 128 + clients/rust/tests/setup/dirty_clone.rs | 11 + clients/rust/tests/setup/mod.rs | 24 + configs/client-scripts/test-js-client.sh | 14 + configs/client-scripts/test-rust-client.sh | 22 + configs/kinobi.cjs | 24 +- configs/program-scripts/build.sh | 4 +- configs/program-scripts/test.sh | 6 +- configs/shank.cjs | 2 +- configs/validator.cjs | 2 +- ...oken_metadata.json => token_metadata.json} | 2140 +++++-- package.json | 6 +- pnpm-lock.yaml | 8 +- programs/token-metadata/Cargo.lock | 98 +- programs/token-metadata/program/Cargo.toml | 4 +- .../program/src/instruction/mod.rs | 36 +- .../program/tests/approve_use_authority.rs | 40 +- .../program/tests/bump_seed_migration.rs | 20 +- programs/token-metadata/program/tests/burn.rs | 24 +- .../program/tests/burn_edition_nft.rs | 8 +- .../token-metadata/program/tests/burn_nft.rs | 8 +- .../program/tests/collection_migrations.rs | 8 +- .../program/tests/collection_sizes.rs | 8 +- .../token-metadata/program/tests/create.rs | 12 +- .../program/tests/create_master_edition.rs | 2 +- .../program/tests/create_metadata_account.rs | 20 +- .../token-metadata/program/tests/delegate.rs | 12 +- .../token-metadata/program/tests/escrow.rs | 32 +- programs/token-metadata/program/tests/fees.rs | 16 +- .../program/tests/freeze_authority.rs | 2 +- .../program/tests/freeze_delegated_account.rs | 22 +- programs/token-metadata/program/tests/lock.rs | 12 +- programs/token-metadata/program/tests/mint.rs | 2 +- ...w_edition_from_master_edition_via_token.rs | 14 +- .../token-metadata/program/tests/print.rs | 18 +- .../tests/process_legacy_instruction.rs | 16 +- .../token-metadata/program/tests/revoke.rs | 14 +- .../program/tests/revoke_use_authority.rs | 18 +- .../program/tests/seralization.rs | 4 +- .../program/tests/set_collection_size.rs | 22 +- .../program/tests/set_token_standard.rs | 12 +- .../program/tests/sign_metadata.rs | 8 +- .../token-metadata/program/tests/transfer.rs | 60 +- .../token-metadata/program/tests/unlock.rs | 8 +- .../token-metadata/program/tests/unverify.rs | 12 +- .../token-metadata/program/tests/update.rs | 54 +- .../tests/update_metadata_account_v2.rs | 26 +- .../update_primary_sale_happened_via_token.rs | 16 +- programs/token-metadata/program/tests/uses.rs | 58 +- .../program/tests/utils/collection.rs | 4 +- .../program/tests/utils/digital_asset.rs | 30 +- .../program/tests/utils/edition_marker.rs | 43 +- .../program/tests/utils/master_edition_v2.rs | 16 +- .../program/tests/utils/metadata.rs | 12 +- .../token-metadata/program/tests/utils/mod.rs | 10 +- .../program/tests/utils/programmable.rs | 8 +- .../token-metadata/program/tests/verify.rs | 16 +- .../program/tests/verify_collection.rs | 66 +- .../tests/verify_sized_collection_item.rs | 50 +- 224 files changed, 59577 insertions(+), 1176 deletions(-) create mode 100644 .github/workflows/build-rust-client.yml rename .github/workflows/{deploy-js.yml => deploy-js-client.yml} (100%) create mode 100644 .github/workflows/deploy-rust-client.yml rename .github/workflows/{test-js.yml => test-js-client.yml} (100%) create mode 100644 .github/workflows/test-rust-client.yml rename .github/workflows/{publish-crate.yml => version-program.yml} (65%) create mode 100644 clients/rust/Cargo.lock create mode 100644 clients/rust/Cargo.toml create mode 100644 clients/rust/README.md create mode 100644 clients/rust/src/generated/accounts/collection_authority_record.rs create mode 100644 clients/rust/src/generated/accounts/edition.rs create mode 100644 clients/rust/src/generated/accounts/edition_marker.rs create mode 100644 clients/rust/src/generated/accounts/edition_marker_v2.rs create mode 100644 clients/rust/src/generated/accounts/master_edition.rs create mode 100644 clients/rust/src/generated/accounts/metadata.rs create mode 100644 clients/rust/src/generated/accounts/metadata_delegate_record.rs create mode 100644 clients/rust/src/generated/accounts/mod.rs create mode 100644 clients/rust/src/generated/accounts/token_owned_escrow.rs create mode 100644 clients/rust/src/generated/accounts/token_record.rs create mode 100644 clients/rust/src/generated/accounts/use_authority_record.rs create mode 100644 clients/rust/src/generated/errors/mod.rs create mode 100644 clients/rust/src/generated/errors/mpl_token_metadata.rs create mode 100644 clients/rust/src/generated/instructions/approve_collection_authority.rs create mode 100644 clients/rust/src/generated/instructions/approve_use_authority.rs create mode 100644 clients/rust/src/generated/instructions/bubblegum_set_collection_size.rs create mode 100644 clients/rust/src/generated/instructions/burn_edition_nft.rs create mode 100644 clients/rust/src/generated/instructions/burn_nft.rs create mode 100644 clients/rust/src/generated/instructions/burn_v1.rs create mode 100644 clients/rust/src/generated/instructions/close_escrow_account.rs create mode 100644 clients/rust/src/generated/instructions/collect.rs create mode 100644 clients/rust/src/generated/instructions/convert_master_edition_v1_to_v2.rs create mode 100644 clients/rust/src/generated/instructions/create_escrow_account.rs create mode 100644 clients/rust/src/generated/instructions/create_master_edition_v3.rs create mode 100644 clients/rust/src/generated/instructions/create_metadata_account_v3.rs create mode 100644 clients/rust/src/generated/instructions/create_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_authority_item_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_collection_item_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_collection_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_data_item_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_data_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_locked_transfer_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_programmable_config_item_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_programmable_config_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_sale_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_staking_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_standard_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_transfer_v1.rs create mode 100644 clients/rust/src/generated/instructions/delegate_utility_v1.rs create mode 100644 clients/rust/src/generated/instructions/deprecated_mint_new_edition_from_master_edition_via_printing_token.rs create mode 100644 clients/rust/src/generated/instructions/freeze_delegated_account.rs create mode 100644 clients/rust/src/generated/instructions/lock_v1.rs create mode 100644 clients/rust/src/generated/instructions/migrate.rs create mode 100644 clients/rust/src/generated/instructions/mint_new_edition_from_master_edition_via_token.rs create mode 100644 clients/rust/src/generated/instructions/mint_new_edition_from_master_edition_via_vault_proxy.rs create mode 100644 clients/rust/src/generated/instructions/mint_v1.rs create mode 100644 clients/rust/src/generated/instructions/mod.rs create mode 100644 clients/rust/src/generated/instructions/print_v1.rs create mode 100644 clients/rust/src/generated/instructions/puff_metadata.rs create mode 100644 clients/rust/src/generated/instructions/remove_creator_verification.rs create mode 100644 clients/rust/src/generated/instructions/revoke_authority_item_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_collection_authority.rs create mode 100644 clients/rust/src/generated/instructions/revoke_collection_item_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_collection_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_data_item_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_data_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_locked_transfer_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_migration_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_programmable_config_item_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_programmable_config_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_sale_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_staking_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_standard_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_transfer_v1.rs create mode 100644 clients/rust/src/generated/instructions/revoke_use_authority.rs create mode 100644 clients/rust/src/generated/instructions/revoke_utility_v1.rs create mode 100644 clients/rust/src/generated/instructions/set_and_verify_collection.rs create mode 100644 clients/rust/src/generated/instructions/set_and_verify_sized_collection_item.rs create mode 100644 clients/rust/src/generated/instructions/set_collection_size.rs create mode 100644 clients/rust/src/generated/instructions/set_token_standard.rs create mode 100644 clients/rust/src/generated/instructions/sign_metadata.rs create mode 100644 clients/rust/src/generated/instructions/thaw_delegated_account.rs create mode 100644 clients/rust/src/generated/instructions/transfer_out_of_escrow.rs create mode 100644 clients/rust/src/generated/instructions/transfer_v1.rs create mode 100644 clients/rust/src/generated/instructions/unlock_v1.rs create mode 100644 clients/rust/src/generated/instructions/unverify_collection.rs create mode 100644 clients/rust/src/generated/instructions/unverify_collection_v1.rs create mode 100644 clients/rust/src/generated/instructions/unverify_creator_v1.rs create mode 100644 clients/rust/src/generated/instructions/unverify_sized_collection_item.rs create mode 100644 clients/rust/src/generated/instructions/update_as_authority_item_delegate_v2.rs create mode 100644 clients/rust/src/generated/instructions/update_as_collection_delegate_v2.rs create mode 100644 clients/rust/src/generated/instructions/update_as_collection_item_delegate_v2.rs create mode 100644 clients/rust/src/generated/instructions/update_as_data_delegate_v2.rs create mode 100644 clients/rust/src/generated/instructions/update_as_data_item_delegate_v2.rs create mode 100644 clients/rust/src/generated/instructions/update_as_programmable_config_delegate_v2.rs create mode 100644 clients/rust/src/generated/instructions/update_as_programmable_config_item_delegate_v2.rs create mode 100644 clients/rust/src/generated/instructions/update_as_update_authority_v2.rs create mode 100644 clients/rust/src/generated/instructions/update_metadata_account_v2.rs create mode 100644 clients/rust/src/generated/instructions/update_primary_sale_happened_via_token.rs create mode 100644 clients/rust/src/generated/instructions/update_v1.rs create mode 100644 clients/rust/src/generated/instructions/use_v1.rs create mode 100644 clients/rust/src/generated/instructions/utilize.rs create mode 100644 clients/rust/src/generated/instructions/verify_collection.rs create mode 100644 clients/rust/src/generated/instructions/verify_collection_v1.rs create mode 100644 clients/rust/src/generated/instructions/verify_creator_v1.rs create mode 100644 clients/rust/src/generated/instructions/verify_sized_collection_item.rs create mode 100644 clients/rust/src/generated/mod.rs create mode 100644 clients/rust/src/generated/programs.rs create mode 100644 clients/rust/src/generated/types/authority_type.rs create mode 100644 clients/rust/src/generated/types/authorization_data.rs create mode 100644 clients/rust/src/generated/types/burn_args.rs create mode 100644 clients/rust/src/generated/types/collection.rs create mode 100644 clients/rust/src/generated/types/collection_details.rs create mode 100644 clients/rust/src/generated/types/collection_details_toggle.rs create mode 100644 clients/rust/src/generated/types/collection_toggle.rs create mode 100644 clients/rust/src/generated/types/create_args.rs create mode 100644 clients/rust/src/generated/types/creator.rs create mode 100644 clients/rust/src/generated/types/data_v2.rs create mode 100644 clients/rust/src/generated/types/delegate_args.rs create mode 100644 clients/rust/src/generated/types/escrow_authority.rs create mode 100644 clients/rust/src/generated/types/key.rs create mode 100644 clients/rust/src/generated/types/leaf_info.rs create mode 100644 clients/rust/src/generated/types/lock_args.rs create mode 100644 clients/rust/src/generated/types/metadata_delegate_role.rs create mode 100644 clients/rust/src/generated/types/migration_type.rs create mode 100644 clients/rust/src/generated/types/mint_args.rs create mode 100644 clients/rust/src/generated/types/mint_new_edition_from_master_edition_via_token_args.rs create mode 100644 clients/rust/src/generated/types/mod.rs create mode 100644 clients/rust/src/generated/types/payload.rs create mode 100644 clients/rust/src/generated/types/payload_key.rs create mode 100644 clients/rust/src/generated/types/payload_type.rs create mode 100644 clients/rust/src/generated/types/print_args.rs create mode 100644 clients/rust/src/generated/types/print_supply.rs create mode 100644 clients/rust/src/generated/types/programmable_config.rs create mode 100644 clients/rust/src/generated/types/reservation.rs create mode 100644 clients/rust/src/generated/types/reservation_v1.rs create mode 100644 clients/rust/src/generated/types/revoke_args.rs create mode 100644 clients/rust/src/generated/types/rule_set_toggle.rs create mode 100644 clients/rust/src/generated/types/seeds_vec.rs create mode 100644 clients/rust/src/generated/types/set_collection_size_args.rs create mode 100644 clients/rust/src/generated/types/token_delegate_role.rs create mode 100644 clients/rust/src/generated/types/token_standard.rs create mode 100644 clients/rust/src/generated/types/token_state.rs create mode 100644 clients/rust/src/generated/types/transfer_args.rs create mode 100644 clients/rust/src/generated/types/unlock_args.rs create mode 100644 clients/rust/src/generated/types/update_args.rs create mode 100644 clients/rust/src/generated/types/use_args.rs create mode 100644 clients/rust/src/generated/types/use_method.rs create mode 100644 clients/rust/src/generated/types/uses.rs create mode 100644 clients/rust/src/generated/types/uses_toggle.rs create mode 100644 clients/rust/src/generated/types/verification_args.rs create mode 100644 clients/rust/src/hooked/metadata_delegate_role_seed.rs create mode 100644 clients/rust/src/hooked/mod.rs create mode 100644 clients/rust/src/lib.rs create mode 100644 clients/rust/tests/create.rs create mode 100644 clients/rust/tests/lock.rs create mode 100644 clients/rust/tests/setup/digital_asset.rs create mode 100644 clients/rust/tests/setup/dirty_clone.rs create mode 100644 clients/rust/tests/setup/mod.rs create mode 100755 configs/client-scripts/test-js-client.sh create mode 100755 configs/client-scripts/test-rust-client.sh rename idls/{mpl_token_metadata.json => token_metadata.json} (76%) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 83da2c5c..f04ab179 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -23,7 +23,9 @@ programs: &programs client_common: &client_common - *programs - - ".github/workflows/test-js.yml" + - ".github/workflows/test-js-client.yml" + - ".github/workflows/test-rust-client.yml" + - ".github/workflows/build-rust-client.yml" - ".github/workflows/main.yml" - ".github/file-filters.yml" - ".github/.env" @@ -34,8 +36,13 @@ js_client: &js_client - *client_common - "clients/js/**" +rust_client: &rust_client + - *client_common + - "clients/rust/**" + clients: &clients - *js_client + - *rust_client # Any. diff --git a/.github/workflows/build-rust-client.yml b/.github/workflows/build-rust-client.yml new file mode 100644 index 00000000..26867f5d --- /dev/null +++ b/.github/workflows/build-rust-client.yml @@ -0,0 +1,65 @@ +name: Build Rust Client + +on: + workflow_call: + inputs: + rust: + type: string + solana: + type: string + workflow_dispatch: + inputs: + rust: + description: Rust version + default: 1.68.0 + required: true + type: string + solana: + description: Solana version + default: 1.16.8 + required: true + type: string + +env: + CACHE: true + +jobs: + build_sdk: + name: Build + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v3 + + - name: Load environment variables + run: cat .github/.env >> $GITHUB_ENV + + - name: Install Rust + uses: metaplex-foundation/actions/install-rust@v1 + with: + toolchain: ${{ inputs.rust || env.RUST_VERSION }} + + - name: Install Solana + uses: metaplex-foundation/actions/install-solana@v1 + with: + version: ${{ inputs.solana || env.SOLANA_VERSION }} + cache: ${{ env.CACHE }} + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --all-targets --all-features --no-deps --manifest-path ./clients/rust/Cargo.toml + + - name: Build Rust client + shell: bash + working-directory: clients/rust + run: cargo build --release + + - name: Upload Rust client builds + uses: actions/upload-artifact@v3 + with: + name: rust-client-builds + # First wildcard ensures exported paths are consistently under the clients folder. + path: ./client*/rust/target/release/*mpl_token_metadata* + if-no-files-found: error diff --git a/.github/workflows/create-proposal.yml b/.github/workflows/create-proposal.yml index e259aa9e..52692828 100644 --- a/.github/workflows/create-proposal.yml +++ b/.github/workflows/create-proposal.yml @@ -101,33 +101,21 @@ jobs: - name: Determine program version run: | IDL_NAME=`echo "${{ inputs.program }}" | tr - _` - VERSION=`jq '.version' ./idls/mpl_${IDL_NAME}.json | sed 's/"//g'` + VERSION=`jq '.version' ./idls/${IDL_NAME}.json | sed 's/"//g'` MAJOR=`echo ${VERSION} | cut -d. -f1` MINOR=`echo ${VERSION} | cut -d. -f2` - PATCH=`echo ${VERSION} | cut -d. -f3-4` - - case "$PATCH" in - *"beta"*) - PRERELEASE=`echo ${PATCH} | cut -d. -f2` - PATCH=`echo ${PATCH} | cut -d- -f1` - ;; - *) - PRERELEASE=0 - ;; - esac - - if [ $PRERELEASE -eq 0 ]; then - if [ "${{ inputs.bump }}" == "major" ]; then - MAJOR=$((MAJOR + 1)) - MINOR=0 - PATCH=0 - elif [ "${{ inputs.bump }}" == "minor" ]; then - MINOR=$((MINOR + 1)) - PATCH=0 - else - PATCH=$((PATCH + 1)) - fi + PATCH=`echo ${VERSION} | cut -d. -f3` + + if [ "${{ inputs.bump }}" == "major" ]; then + MAJOR=$((MAJOR + 1)) + MINOR=0 + PATCH=0 + elif [ "${{ inputs.bump }}" == "minor" ]; then + MINOR=$((MINOR + 1)) + PATCH=0 + else + PATCH=$((PATCH + 1)) fi echo PROGRAM_VERSION="${MAJOR}.${MINOR}.${PATCH}" >> $GITHUB_ENV diff --git a/.github/workflows/deploy-js.yml b/.github/workflows/deploy-js-client.yml similarity index 100% rename from .github/workflows/deploy-js.yml rename to .github/workflows/deploy-js-client.yml diff --git a/.github/workflows/deploy-rust-client.yml b/.github/workflows/deploy-rust-client.yml new file mode 100644 index 00000000..f2aa011a --- /dev/null +++ b/.github/workflows/deploy-rust-client.yml @@ -0,0 +1,92 @@ +name: Deploy Rust Client + +on: + workflow_dispatch: + inputs: + level: + description: Level + required: true + default: patch + type: choice + options: + - patch + - minor + - major + - rc + - beta + - alpha + - release + - version + version: + description: Version + required: false + type: string + dry_run: + description: Dry run + required: true + default: true + type: boolean + +env: + CACHE: true + +jobs: + build_rust_client: + name: Rust Client + uses: ./.github/workflows/build-rust-client.yml + secrets: inherit + + test_rust_client: + name: Rust Client + needs: build_rust_client + uses: ./.github/workflows/test-rust-client.yml + secrets: inherit + + publish_crate: + name: Rust Client / Publish Crate + runs-on: ubuntu-latest + needs: test_rust_client + permissions: + contents: write + steps: + - name: Git checkout + uses: actions/checkout@v3 + with: + token: ${{ secrets.SVC_TOKEN }} + + - name: Load environment variables + run: cat .github/.env >> $GITHUB_ENV + + - name: Install Rust + uses: metaplex-foundation/actions/install-rust@v1 + with: + toolchain: ${{ env.RUST_VERSION }} + + - name: Install Solana + uses: metaplex-foundation/actions/install-solana@v1 + with: + version: ${{ env.SOLANA_VERSION }} + cache: ${{ env.CACHE }} + + - name: Install cargo-release + uses: metaplex-foundation/actions/install-cargo-release@v1 + with: + cache: ${{ env.CACHE }} + + - name: Publish Crate + working-directory: ./clients/rust + run: | + if [ "${{ inputs.level }}" == "version" ]; then + BUMP=${{ inputs.version }} + else + BUMP=${{ inputs.level }} + fi + + if [ "${{ inputs.dry_run }}" == "false" ]; then + OPTIONS="--no-confirm --execute" + fi + + if [ "${{ inputs.level }}" == "version" ]; then + + cargo login ${{ secrets.CRATES_TOKEN }} + cargo release $BUMP $OPTIONS diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 488fa027..cd2a1732 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,6 +61,7 @@ jobs: runs-on: ubuntu-latest outputs: js_changed: ${{ steps.changes.outputs.js_client }} + rust_changed: ${{ steps.changes.outputs.rust_client }} permissions: contents: write steps: @@ -98,9 +99,23 @@ jobs: with: filters: .github/file-filters.yml - test_js: + test_js_client: if: needs.generate_clients.outputs.js_changed == 'true' name: JS Client needs: generate_clients - uses: ./.github/workflows/test-js.yml + uses: ./.github/workflows/test-js-client.yml + secrets: inherit + + build_rust_client: + if: needs.generate_clients.outputs.rust_changed == 'true' + name: Rust Client + needs: generate_clients + uses: ./.github/workflows/build-rust-client.yml + secrets: inherit + + test_rust_client: + if: needs.generate_clients.outputs.rust_changed == 'true' + name: Rust Client + needs: generate_clients + uses: ./.github/workflows/test-rust-client.yml secrets: inherit diff --git a/.github/workflows/test-js.yml b/.github/workflows/test-js-client.yml similarity index 100% rename from .github/workflows/test-js.yml rename to .github/workflows/test-js-client.yml diff --git a/.github/workflows/test-rust-client.yml b/.github/workflows/test-rust-client.yml new file mode 100644 index 00000000..fc5b4f35 --- /dev/null +++ b/.github/workflows/test-rust-client.yml @@ -0,0 +1,42 @@ +name: Test Rust Client + +on: + workflow_call: + inputs: + program_matrix: + type: string + +env: + CACHE: true + +jobs: + test_sdk: + name: Test + runs-on: ubuntu-latest-16-cores + steps: + - name: Git checkout + uses: actions/checkout@v3 + + - name: Load environment variables + run: cat .github/.env >> $GITHUB_ENV + + - name: Install Rust + uses: metaplex-foundation/actions/install-rust@v1 + with: + toolchain: ${{ env.RUST_VERSION }} + + - name: Install Solana + uses: metaplex-foundation/actions/install-solana@v1 + with: + version: ${{ env.SOLANA_VERSION }} + cache: ${{ env.CACHE }} + + - name: Download program builds + uses: actions/download-artifact@v3 + with: + name: program-builds + + - name: Run tests + shell: bash + working-directory: configs/client-scripts + run: RUST_LOG=error ./test-rust-client.sh diff --git a/.github/workflows/publish-crate.yml b/.github/workflows/version-program.yml similarity index 65% rename from .github/workflows/publish-crate.yml rename to .github/workflows/version-program.yml index 0b433c64..7f18f5fd 100644 --- a/.github/workflows/publish-crate.yml +++ b/.github/workflows/version-program.yml @@ -1,4 +1,4 @@ -name: Publish Crate +name: Version Program on: workflow_dispatch: @@ -10,11 +10,6 @@ on: type: choice options: - token-metadata - pre_release: - description: Pre-release (beta) - required: true - type: boolean - default: false bump: description: Version bump required: true @@ -42,16 +37,22 @@ jobs: with: program_matrix: '["${{ inputs.program }}"]' - test_js: + test_js_client: name: JS client needs: test_programs - uses: ./.github/workflows/test-js.yml + uses: ./.github/workflows/test-js-client.yml + secrets: inherit + + test_rust_client: + name: Rust client + needs: test_programs + uses: ./.github/workflows/test-rust-client.yml secrets: inherit - publish_crate: - name: Program / Publish Crate + version_program: + name: Program / Version runs-on: ubuntu-latest - needs: test_js + needs: [test_js_client, test_rust_client] permissions: contents: write steps: @@ -81,43 +82,25 @@ jobs: - name: Bump Program Version run: | - IDL_NAME="mpl_`echo "${{ inputs.program }}" | tr - _`" + IDL_NAME="`echo "${{ inputs.program }}" | tr - _`" VERSION=`jq '.version' ./idls/${IDL_NAME}.json | sed 's/"//g'` MAJOR=`echo ${VERSION} | cut -d. -f1` MINOR=`echo ${VERSION} | cut -d. -f2` - PATCH=`echo ${VERSION} | cut -d. -f3-4` - - case "$PATCH" in - *"beta"*) - PRERELEASE=`echo ${PATCH} | cut -d. -f2` - PATCH=`echo ${PATCH} | cut -d- -f1` - ;; - *) - PRERELEASE=0 - ;; - esac - - if [ $PRERELEASE -eq 0 ]; then - if [ "${{ inputs.bump }}" == "major" ]; then - MAJOR=$((MAJOR + 1)) - MINOR=0 - PATCH=0 - elif [ "${{ inputs.bump }}" == "minor" ]; then - MINOR=$((MINOR + 1)) - PATCH=0 - else - PATCH=$((PATCH + 1)) - fi - fi - - if [ "${{ inputs.pre_release }}" == "true" ]; then - PRERELEASE="-beta.$((PRERELEASE + 1))" + PATCH=`echo ${VERSION} | cut -d. -f3` + + if [ "${{ inputs.bump }}" == "major" ]; then + MAJOR=$((MAJOR + 1)) + MINOR=0 + PATCH=0 + elif [ "${{ inputs.bump }}" == "minor" ]; then + MINOR=$((MINOR + 1)) + PATCH=0 else - PRERELEASE="" + PATCH=$((PATCH + 1)) fi - PROGRAM_VERSION="${MAJOR}.${MINOR}.${PATCH}${PRERELEASE}" + PROGRAM_VERSION="${MAJOR}.${MINOR}.${PATCH}" cp ./idls/${IDL_NAME}.json ./idls/${IDL_NAME}-previous.json jq ".version = \"${PROGRAM_VERSION}\"" ./idls/${IDL_NAME}-previous.json > ./idls/${IDL_NAME}.json @@ -130,7 +113,7 @@ jobs: with: name: program-builds - - name: Publish Crate + - name: Version Program working-directory: ./programs/${{ inputs.program }}/program run: | git stash @@ -138,7 +121,7 @@ jobs: git config user.email "${{ env.COMMIT_USER_EMAIL }}" cargo login ${{ secrets.CRATES_TOKEN }} - cargo release ${{ env.PROGRAM_VERSION }} --no-confirm --no-push --no-tag --execute + cargo release ${{ env.PROGRAM_VERSION }} --no-confirm --no-push --no-tag --no-publish --execute git reset --soft HEAD~1 git stash pop @@ -146,5 +129,5 @@ jobs: - name: Commit and tag new version uses: stefanzweifel/git-auto-commit-action@v4 with: - commit_message: Publish mpl-${{ inputs.program }} crate v${{ env.PROGRAM_VERSION }} - tagging_message: mpl-${{ inputs.program }}@v${{ env.PROGRAM_VERSION }} + commit_message: "chore: ${{ inputs.program }} version ${{ env.PROGRAM_VERSION }}" + tagging_message: ${{ inputs.program }}@v${{ env.PROGRAM_VERSION }} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 4547514d..fc4904d3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "rust-analyzer.linkedProjects": [ + "./clients/rust/Cargo.toml", "./programs/token-metadata/Cargo.toml", ] } \ No newline at end of file diff --git a/clients/js/src/generated/accounts/editionMarkerV2.ts b/clients/js/src/generated/accounts/editionMarkerV2.ts index 2b3809f6..be9ca246 100644 --- a/clients/js/src/generated/accounts/editionMarkerV2.ts +++ b/clients/js/src/generated/accounts/editionMarkerV2.ts @@ -25,6 +25,7 @@ import { publicKey as publicKeySerializer, string, struct, + u32, } from '@metaplex-foundation/umi/serializers'; import { Key, KeyArgs, getKeySerializer } from '../types'; @@ -51,7 +52,7 @@ export function getEditionMarkerV2AccountDataSerializer( return struct( [ ['key', getKeySerializer()], - ['ledger', bytes()], + ['ledger', bytes({ size: u32() })], ], { description: 'EditionMarkerV2AccountData' } ) as Serializer; @@ -141,7 +142,7 @@ export function getEditionMarkerV2GpaBuilder( return gpaBuilder(context, programId) .registerFields<{ key: KeyArgs; ledger: Uint8Array }>({ key: [0, getKeySerializer()], - ledger: [1, bytes()], + ledger: [1, bytes({ size: u32() })], }) .deserializeUsing((account) => deserializeEditionMarkerV2(account) diff --git a/clients/js/src/generated/accounts/masterEdition.ts b/clients/js/src/generated/accounts/masterEdition.ts index 35ae997d..2806fa39 100644 --- a/clients/js/src/generated/accounts/masterEdition.ts +++ b/clients/js/src/generated/accounts/masterEdition.ts @@ -168,10 +168,6 @@ export function getMasterEditionGpaBuilder( .whereField('key', Key.MasterEditionV2); } -export function getMasterEditionSize(): number { - return 282; -} - export function findMasterEditionPda( context: Pick, seeds: { diff --git a/clients/js/src/generated/accounts/metadata.ts b/clients/js/src/generated/accounts/metadata.ts index 57719a6f..49288a16 100644 --- a/clients/js/src/generated/accounts/metadata.ts +++ b/clients/js/src/generated/accounts/metadata.ts @@ -250,10 +250,6 @@ export function getMetadataGpaBuilder( .whereField('key', Key.MetadataV1); } -export function getMetadataSize(): number { - return 679; -} - export function findMetadataPda( context: Pick, seeds: { diff --git a/clients/js/src/generated/types/seedsVec.ts b/clients/js/src/generated/types/seedsVec.ts index 3aec4b3d..bc483fbf 100644 --- a/clients/js/src/generated/types/seedsVec.ts +++ b/clients/js/src/generated/types/seedsVec.ts @@ -11,6 +11,7 @@ import { array, bytes, struct, + u32, } from '@metaplex-foundation/umi/serializers'; export type SeedsVec = { seeds: Array }; @@ -25,7 +26,7 @@ export function getSeedsVecSerializer(): Serializer; export function getSeedsVecSerializer( _context: object = {} ): Serializer { - return struct([['seeds', array(bytes())]], { + return struct([['seeds', array(bytes({ size: u32() }))]], { description: 'SeedsVec', }) as Serializer; } diff --git a/clients/js/src/hooked/resolvers.ts b/clients/js/src/hooked/resolvers.ts index 280e44e4..0ac7f73f 100644 --- a/clients/js/src/hooked/resolvers.ts +++ b/clients/js/src/hooked/resolvers.ts @@ -21,12 +21,14 @@ import { findEditionMarkerV2Pda, findMasterEditionPda, findTokenRecordPda, - getMasterEditionSize, - getMetadataSize, printSupply, } from '../generated'; import { findEditionMarkerFromEditionNumberPda } from './editionMarker'; +const METADATA_SIZE: number = 679; + +const MASTER_EDITION_SIZE: number = 282; + export const resolveCollectionDetails = ( context: any, accounts: any, @@ -103,9 +105,9 @@ export const resolveCreateV1Bytes = ( programId: any, isWritable?: boolean ): number => { - const base = getMintSize() + getMetadataSize() + 2 * ACCOUNT_HEADER_SIZE; + const base = getMintSize() + METADATA_SIZE + 2 * ACCOUNT_HEADER_SIZE; if (isNonFungible(args.tokenStandard)) { - return base + getMasterEditionSize() + ACCOUNT_HEADER_SIZE; + return base + MASTER_EDITION_SIZE + ACCOUNT_HEADER_SIZE; } return base; }; diff --git a/clients/js/test/printV1.test.ts b/clients/js/test/printV1.test.ts index 01d74f8f..44d0d8ad 100644 --- a/clients/js/test/printV1.test.ts +++ b/clients/js/test/printV1.test.ts @@ -1,5 +1,13 @@ -import { createMintWithAssociatedToken } from '@metaplex-foundation/mpl-toolbox'; -import { generateSigner, percentAmount, some } from '@metaplex-foundation/umi'; +import { + createMintWithAssociatedToken, + setComputeUnitLimit, +} from '@metaplex-foundation/mpl-toolbox'; +import { + generateSigner, + percentAmount, + some, + transactionBuilder, +} from '@metaplex-foundation/umi'; import test from 'ava'; import { DigitalAsset, @@ -88,14 +96,19 @@ test('it can print a new edition from a ProgrammableNonFungible', async (t) => { // When we print a new edition of the asset. const editionMint = generateSigner(umi); const editionOwner = generateSigner(umi); - await printV1(umi, { - masterTokenAccountOwner: originalOwner, - masterEditionMint: originalMint.publicKey, - editionMint, - editionTokenAccountOwner: editionOwner.publicKey, - editionNumber: 1, - tokenStandard: TokenStandard.ProgrammableNonFungible, - }).sendAndConfirm(umi); + await transactionBuilder() + .add(setComputeUnitLimit(umi, { units: 400_000 })) + .add( + printV1(umi, { + masterTokenAccountOwner: originalOwner, + masterEditionMint: originalMint.publicKey, + editionMint, + editionTokenAccountOwner: editionOwner.publicKey, + editionNumber: 1, + tokenStandard: TokenStandard.ProgrammableNonFungible, + }) + ) + .sendAndConfirm(umi); // Then the original NFT was updated. const originalAsset = await fetchDigitalAsset(umi, originalMint.publicKey); diff --git a/clients/rust/Cargo.lock b/clients/rust/Cargo.lock new file mode 100644 index 00000000..b82c26d5 --- /dev/null +++ b/clients/rust/Cargo.lock @@ -0,0 +1,5560 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[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 = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", + "opaque-debug", +] + +[[package]] +name = "aes-gcm-siv" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589c637f0e68c877bbd59a4599bbe849cac8e5f3e4b5a3ebae8f528cd218dcdc" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "polyval", + "subtle", + "zeroize", +] + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.10", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.10", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +dependencies = [ + "memchr", +] + +[[package]] +name = "aliasable" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" + +[[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 = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[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.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools", + "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", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools", + "num-bigint 0.4.3", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote 1.0.33", + "syn 1.0.109", +] + +[[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.3", + "num-traits", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.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", + "ark-std", + "digest 0.10.7", + "num-bigint 0.4.3", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[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 = "array-bytes" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ad284aeb45c13f2fb4f084de4a420ebf447423bdf9386c0540ce33cb3ef4b8c" + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "ascii" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" + +[[package]] +name = "asn1-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time 0.3.25", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-compression" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a" +dependencies = [ + "brotli", + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "async-mutex" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-trait" +version = "0.1.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[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.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + +[[package]] +name = "blake3" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +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 = [ + "block-padding", + "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 = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive 0.9.3", + "hashbrown 0.11.2", +] + +[[package]] +name = "borsh" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" +dependencies = [ + "borsh-derive 0.10.3", + "hashbrown 0.13.2", +] + +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal 0.9.3", + "borsh-schema-derive-internal 0.9.3", + "proc-macro-crate 0.1.5", + "proc-macro2 1.0.66", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" +dependencies = [ + "borsh-derive-internal 0.10.3", + "borsh-schema-derive-internal 0.10.3", + "proc-macro-crate 0.1.5", + "proc-macro2 1.0.66", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "brotli" +version = "3.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bumpalo" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[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 = "bytemuck" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "caps" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190baaad529bcfbde9e1a19022c42781bdb6ff9de25721abdb8fd98c0807730b" +dependencies = [ + "libc", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "time 0.1.45", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "chrono-humanize" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799627e6b4d27827a814e837b9d8a504832086081806d45b1afa34dc982b023b" +dependencies = [ + "chrono", +] + +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags 1.3.2", + "strsim 0.8.0", + "textwrap 0.11.0", + "unicode-width", + "vec_map", +] + +[[package]] +name = "clap" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +dependencies = [ + "atty", + "bitflags 1.3.2", + "clap_lex", + "indexmap 1.9.3", + "once_cell", + "strsim 0.10.0", + "termcolor", + "textwrap 0.16.0", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[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 = "concurrent-queue" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "console" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.45.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 = "const-oid" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" + +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cpufeatures" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset 0.9.0", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "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.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "serde", + "subtle", + "zeroize", +] + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2 1.0.66", + "quote 1.0.33", + "strsim 0.10.0", + "syn 2.0.29", +] + +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "dashmap" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +dependencies = [ + "cfg-if", + "num_cpus", + "rayon", +] + +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + +[[package]] +name = "der" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +dependencies = [ + "const-oid", +] + +[[package]] +name = "der-parser" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint 0.4.3", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "deranged" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" + +[[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 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "dialoguer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" +dependencies = [ + "console", + "shell-words", + "tempfile", + "zeroize", +] + +[[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 = "dir-diff" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2860407d7d7e2e004bb2128510ad9e8d669e76fa005ccf567977b5d71b8b4a0b" +dependencies = [ + "walkdir", +] + +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "dlopen" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e80ad39f814a9abe68583cd50a2d45c8a67561c3361ab8da240587dda80937" +dependencies = [ + "dlopen_derive", + "lazy_static", + "libc", + "winapi", +] + +[[package]] +name = "dlopen_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f236d9e1b1fbd81cea0f9cbdc8dcc7e8ebcd80e6659cd7cb2ad5f6c05946c581" +dependencies = [ + "libc", + "quote 0.6.13", + "syn 0.15.44", +] + +[[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", + "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.7", +] + +[[package]] +name = "educe" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "079044df30bb07de7d846d41a184c4b00e66ebdac93ee459253474f3a47e50ae" +dependencies = [ + "enum-ordinalize", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enum-iterator" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7add3873b5dd076766ee79c8e406ad1a472c385476b9e38849f8eec24f1be689" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "enum-ordinalize" +version = "3.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4f76552f53cefc9a7f64987c3701b99d982f7690606fd67de1d09712fbf52f1" +dependencies = [ + "num-bigint 0.4.3", + "num-traits", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + +[[package]] +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "filetime" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.3.5", + "windows-sys 0.48.0", +] + +[[package]] +name = "flate2" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +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 = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +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 = [ + "serde", + "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.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "goblin" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7666983ed0dd8d21a6f6576ee00053ca0926fb281a5522577a4dbd0f1b54143" +dependencies = [ + "log", + "plain", + "scroll", +] + +[[package]] +name = "h2" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.9.3", + "slab", + "tokio", + "tokio-util 0.7.2", + "tracing", +] + +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", +] + +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "histogram" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cb882ccb290b8646e554b157ab0b71e64e8d5bef775cd66b6531e52d302669" + +[[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.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +dependencies = [ + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows", +] + +[[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 = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "rayon", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + +[[package]] +name = "index_list" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a9d968042a4902e08810946fc7cd5851eb75e80301342305af755ca06cb82ce" + +[[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", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + +[[package]] +name = "indicatif" +version = "0.17.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b297dc40733f23a0e52728a58fa9489a5b7638a324932de16b41adc3ef80730" +dependencies = [ + "console", + "instant", + "number_prefix", + "portable-atomic", + "unicode-width", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "jobserver" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "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 = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[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 = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "lru" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown 0.12.3", +] + +[[package]] +name = "lz4" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1" +dependencies = [ + "libc", + "lz4-sys", +] + +[[package]] +name = "lz4-sys" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[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.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +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 = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "modular-bitfield" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74" +dependencies = [ + "modular-bitfield-impl", + "static_assertions", +] + +[[package]] +name = "modular-bitfield-impl" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "mpl-token-metadata" +version = "2.0.0-beta.1" +dependencies = [ + "assert_matches", + "borsh 0.10.3", + "num-derive", + "num-traits", + "solana-program", + "solana-program-test", + "solana-sdk", + "spl-associated-token-account 2.0.0", + "spl-token 4.0.0", + "thiserror", +] + +[[package]] +name = "nix" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset 0.7.1", + "pin-utils", + "static_assertions", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi", +] + +[[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.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[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-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +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.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.2", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive 0.6.1", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] +name = "oid-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" +dependencies = [ + "asn1-rs", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[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", +] + +[[package]] +name = "os_str_bytes" +version = "6.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" + +[[package]] +name = "ouroboros" +version = "0.15.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db" +dependencies = [ + "aliasable", + "ouroboros_macro", +] + +[[package]] +name = "ouroboros_macro" +version = "0.15.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" +dependencies = [ + "Inflector", + "proc-macro-error", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.8", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.3.5", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac", +] + +[[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 = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "percentage" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd23b938276f14057220b707937bcb42fa76dda7560e57a2da30cb52d557937" +dependencies = [ + "num", +] + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +dependencies = [ + "der", + "spki", + "zeroize", +] + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "portable-atomic" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f32154ba0af3a075eefa1eda8bb414ee928f62303a54ea85b8d6638ff1a6ee9e" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +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 = "quinn" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8b432585672228923edbbf64b8b12c14e1112f62e88737655b4a083dbcd78e" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "thiserror", + "tokio", + "tracing", + "webpki", +] + +[[package]] +name = "quinn-proto" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31999cfc7927c4e212e60fd50934ab40e8e8bfd2d493d6095d2d306bc0764d9" +dependencies = [ + "bytes", + "rand 0.8.5", + "ring", + "rustc-hash", + "rustls", + "rustls-native-certs", + "slab", + "thiserror", + "tinyvec", + "tracing", + "webpki", +] + +[[package]] +name = "quinn-udp" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "641538578b21f5e5c8ea733b736895576d0fe329bb883b937db6f4d163dbaaf4" +dependencies = [ + "libc", + "quinn-proto", + "socket2", + "tracing", + "windows-sys 0.42.0", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2 1.0.66", +] + +[[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_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_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.10", +] + +[[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 = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + +[[package]] +name = "rcgen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +dependencies = [ + "pem", + "ring", + "time 0.3.25", + "yasna", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" + +[[package]] +name = "reqwest" +version = "0.11.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" +dependencies = [ + "async-compression", + "base64 0.21.2", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls", + "tokio-util 0.7.2", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rpassword" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6678cf63ab3491898c0d021b493c94c9b221d91295294a2a5746eacbe5928322" +dependencies = [ + "libc", + "rtoolbox", + "winapi", +] + +[[package]] +name = "rtoolbox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034e22c514f5c0cb8a10ff341b9b048b5ceb21591f31c8f44c43b960f9b3524a" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + +[[package]] +name = "rustix" +version = "0.38.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustls" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.2", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scroll" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" +dependencies = [ + "scroll_derive", +] + +[[package]] +name = "scroll_derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" + +[[package]] +name = "serde" +version = "1.0.183" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.183" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "serde_json" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +dependencies = [ + "itoa", + "ryu", + "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 = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[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.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shell-words" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "solana-account-decoder" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c387acc1a8ce38f65fe35690a5afd16f0d4c943067cf2db133e7120a38a1c423" +dependencies = [ + "Inflector", + "base64 0.21.2", + "bincode", + "bs58", + "bv", + "lazy_static", + "serde", + "serde_derive", + "serde_json", + "solana-address-lookup-table-program", + "solana-config-program", + "solana-sdk", + "spl-token 3.5.0", + "spl-token-2022 0.6.1", + "thiserror", + "zstd", +] + +[[package]] +name = "solana-address-lookup-table-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "571f011a61ab6a61f5e6eec41d862e1451d2e0937e2829429f75a17c460858b1" +dependencies = [ + "bincode", + "bytemuck", + "log", + "num-derive", + "num-traits", + "rustc_version", + "serde", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-program", + "solana-program-runtime", + "solana-sdk", + "thiserror", +] + +[[package]] +name = "solana-banks-client" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "526d5731217a0702eecbb49a4a0a9f106d72e5077e658ef57688b3d9efe6e3f5" +dependencies = [ + "borsh 0.10.3", + "futures", + "solana-banks-interface", + "solana-program", + "solana-sdk", + "tarpc", + "thiserror", + "tokio", + "tokio-serde", +] + +[[package]] +name = "solana-banks-interface" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f92c8e8baddeb229acbe96be4a919d7f186e05c8f8fc2ad51d0b634816a5c9b" +dependencies = [ + "serde", + "solana-sdk", + "tarpc", +] + +[[package]] +name = "solana-banks-server" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad49dc8e38a9f4cced3f297a4242a1eea325cf5de9d8f7af8c1fe951d348cd8" +dependencies = [ + "bincode", + "crossbeam-channel", + "futures", + "solana-banks-interface", + "solana-client", + "solana-runtime", + "solana-sdk", + "solana-send-transaction-service", + "tarpc", + "tokio", + "tokio-serde", +] + +[[package]] +name = "solana-bpf-loader-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476efcec2fd6899d1a8b3378bd4e4420d248cd4369217012129efcff528da691" +dependencies = [ + "bincode", + "byteorder", + "libsecp256k1", + "log", + "rand 0.7.3", + "solana-measure", + "solana-program-runtime", + "solana-sdk", + "solana-zk-token-sdk", + "solana_rbpf", + "thiserror", +] + +[[package]] +name = "solana-bucket-map" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3faa5818fcdf97f58a75ff20a06ce51cf40e3593b3db6fd08a42f8539e18ddc" +dependencies = [ + "bv", + "log", + "memmap2", + "modular-bitfield", + "num_enum 0.6.1", + "rand 0.7.3", + "solana-measure", + "solana-sdk", + "tempfile", +] + +[[package]] +name = "solana-clap-utils" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1752e9fe9fb659ab0318cb6aef6b2aa7e0317be5fe7f4e3f74e09c42a4572ec5" +dependencies = [ + "chrono", + "clap 2.34.0", + "rpassword", + "solana-perf", + "solana-remote-wallet", + "solana-sdk", + "thiserror", + "tiny-bip39", + "uriparse", + "url", +] + +[[package]] +name = "solana-client" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e17610496b75585f40b4a26b2a54b07a468d62f09f22c18ed966e6a9006cd74" +dependencies = [ + "async-trait", + "bincode", + "futures", + "futures-util", + "indexmap 1.9.3", + "indicatif", + "log", + "quinn", + "rand 0.7.3", + "rayon", + "solana-connection-cache", + "solana-measure", + "solana-metrics", + "solana-pubsub-client", + "solana-quic-client", + "solana-rpc-client", + "solana-rpc-client-api", + "solana-rpc-client-nonce-utils", + "solana-sdk", + "solana-streamer", + "solana-thin-client", + "solana-tpu-client", + "solana-udp-client", + "thiserror", + "tokio", +] + +[[package]] +name = "solana-compute-budget-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb9c9031bbf2a774ace3ec991f6b0019134a30e7dafb50b3ede4f2df32c85d5a" +dependencies = [ + "solana-program-runtime", + "solana-sdk", +] + +[[package]] +name = "solana-config-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a707c726e0f1a6764f11fd6c25e129d1fe16dc14a641b7d5f23ab6a1c1f583" +dependencies = [ + "bincode", + "chrono", + "serde", + "serde_derive", + "solana-program-runtime", + "solana-sdk", +] + +[[package]] +name = "solana-connection-cache" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6024d0046d3672476cafc1d302599b936b9efb69ce1c41efc98b6a9554d07af" +dependencies = [ + "async-trait", + "bincode", + "futures-util", + "indexmap 1.9.3", + "log", + "rand 0.7.3", + "rayon", + "rcgen", + "solana-measure", + "solana-metrics", + "solana-sdk", + "thiserror", + "tokio", +] + +[[package]] +name = "solana-frozen-abi" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89ed0a4ba426c461866700f082a00d490e4bde6d27d2d88e129acb3fde79054" +dependencies = [ + "ahash 0.8.3", + "blake3", + "block-buffer 0.10.4", + "bs58", + "bv", + "byteorder", + "cc", + "either", + "generic-array", + "getrandom 0.1.16", + "im", + "lazy_static", + "log", + "memmap2", + "once_cell", + "rand_core 0.6.4", + "rustc_version", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "sha2 0.10.7", + "solana-frozen-abi-macro", + "subtle", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b69dd83d2d675cad4ed0f0086a7d0c669dc407213b4bc916555ed329ea93f531" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "rustc_version", + "syn 2.0.29", +] + +[[package]] +name = "solana-loader-v4-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b058e4cad9057315272cda2d2693ab39d49a1448ad4e8c3211b7389c61678c47" +dependencies = [ + "log", + "rand 0.7.3", + "solana-measure", + "solana-program-runtime", + "solana-sdk", + "solana_rbpf", +] + +[[package]] +name = "solana-logger" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2d34ee6f40d1be05852e9e442b7b3ead2c2ec6fef567079c1c0a4b3d3b8eb3" +dependencies = [ + "env_logger", + "lazy_static", + "log", +] + +[[package]] +name = "solana-measure" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "848131da616377ecef14f84424f5c28cbffbd0018148452a278d8bc9e5c91399" +dependencies = [ + "log", + "solana-sdk", +] + +[[package]] +name = "solana-metrics" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a24707f323c8fcbd3f05b6353ec917188aff73ade879dd9bfdaec18f13dde24a" +dependencies = [ + "crossbeam-channel", + "gethostname", + "lazy_static", + "log", + "reqwest", + "solana-sdk", +] + +[[package]] +name = "solana-net-utils" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec117234c551f3b93c7710e800b1786a5226cd62ce80f935b5a43f3a2c9d3" +dependencies = [ + "bincode", + "clap 3.2.25", + "crossbeam-channel", + "log", + "nix", + "rand 0.7.3", + "serde", + "serde_derive", + "socket2", + "solana-logger", + "solana-sdk", + "solana-version", + "tokio", + "url", +] + +[[package]] +name = "solana-perf" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27fb0d9be450228c6eb03808a3e87fb7df61f7d96a042d9967f921a6caea2fe6" +dependencies = [ + "ahash 0.8.3", + "bincode", + "bv", + "caps", + "curve25519-dalek", + "dlopen", + "dlopen_derive", + "fnv", + "lazy_static", + "libc", + "log", + "nix", + "rand 0.7.3", + "rayon", + "serde", + "solana-metrics", + "solana-rayon-threadlimit", + "solana-sdk", + "solana-vote-program", +] + +[[package]] +name = "solana-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c38a798723409541aae8ddc9b69c4c78b798e6c219e3e526b5bd4280974a5f29" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "array-bytes", + "base64 0.21.2", + "bincode", + "bitflags 1.3.2", + "blake3", + "borsh 0.10.3", + "borsh 0.9.3", + "bs58", + "bv", + "bytemuck", + "cc", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.2.10", + "itertools", + "js-sys", + "lazy_static", + "libc", + "libsecp256k1", + "log", + "memoffset 0.9.0", + "num-bigint 0.4.3", + "num-derive", + "num-traits", + "parking_lot 0.12.1", + "rand 0.7.3", + "rand_chacha 0.2.2", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "sha2 0.10.7", + "sha3 0.10.8", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk-macro", + "thiserror", + "tiny-bip39", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "solana-program-runtime" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2f1803db91cd46bef3b84c5fceff2b5278b0daa651be20c5ec81a37cbccf4d" +dependencies = [ + "base64 0.21.2", + "bincode", + "eager", + "enum-iterator", + "itertools", + "libc", + "log", + "num-derive", + "num-traits", + "percentage", + "rand 0.7.3", + "rustc_version", + "serde", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-measure", + "solana-metrics", + "solana-sdk", + "solana_rbpf", + "thiserror", +] + +[[package]] +name = "solana-program-test" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a557d319cecaed9a68b88f20c558103b7c43f1e797fc3f11127951c1b62038" +dependencies = [ + "assert_matches", + "async-trait", + "base64 0.21.2", + "bincode", + "chrono-humanize", + "crossbeam-channel", + "log", + "serde", + "solana-banks-client", + "solana-banks-interface", + "solana-banks-server", + "solana-bpf-loader-program", + "solana-logger", + "solana-program-runtime", + "solana-runtime", + "solana-sdk", + "solana-vote-program", + "thiserror", + "tokio", +] + +[[package]] +name = "solana-pubsub-client" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "591cc19e71fca27a344cb08ae6e906f8b2e8cfa10e9cc74a0676044b157e3506" +dependencies = [ + "crossbeam-channel", + "futures-util", + "log", + "reqwest", + "semver", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder", + "solana-rpc-client-api", + "solana-sdk", + "thiserror", + "tokio", + "tokio-stream", + "tokio-tungstenite", + "tungstenite", + "url", +] + +[[package]] +name = "solana-quic-client" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05db835947c6623c86ef3b21baf388ea016e03039252fcf20a2789fce4962eb1" +dependencies = [ + "async-mutex", + "async-trait", + "futures", + "itertools", + "lazy_static", + "log", + "quinn", + "quinn-proto", + "quinn-udp", + "rcgen", + "rustls", + "solana-connection-cache", + "solana-measure", + "solana-metrics", + "solana-net-utils", + "solana-rpc-client-api", + "solana-sdk", + "solana-streamer", + "thiserror", + "tokio", +] + +[[package]] +name = "solana-rayon-threadlimit" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111747d986e2d968084de753a8034d486471c6a6192a16c31ec1c2eee95b2d47" +dependencies = [ + "lazy_static", + "num_cpus", +] + +[[package]] +name = "solana-remote-wallet" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e71075e996f5b9ac83f6fb068361fd2f4bcd7319832b3eea1ef2f705d84942b" +dependencies = [ + "console", + "dialoguer", + "log", + "num-derive", + "num-traits", + "parking_lot 0.12.1", + "qstring", + "semver", + "solana-sdk", + "thiserror", + "uriparse", +] + +[[package]] +name = "solana-rpc-client" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77d9c7a14b02ace2d22838a2656512fd91003ebac59301fd898dcec4fcb87737" +dependencies = [ + "async-trait", + "base64 0.21.2", + "bincode", + "bs58", + "indicatif", + "log", + "reqwest", + "semver", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder", + "solana-rpc-client-api", + "solana-sdk", + "solana-transaction-status", + "solana-version", + "solana-vote-program", + "tokio", +] + +[[package]] +name = "solana-rpc-client-api" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad7a807372d7b3e9b4b70189d311a3d7c734c9354d604befc5d099a097803192" +dependencies = [ + "base64 0.21.2", + "bs58", + "jsonrpc-core", + "reqwest", + "semver", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder", + "solana-sdk", + "solana-transaction-status", + "solana-version", + "spl-token-2022 0.6.1", + "thiserror", +] + +[[package]] +name = "solana-rpc-client-nonce-utils" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "557b43c6fa4e364e9334900afb026998ec1d3a20f4471138f4744aa35abd7fb5" +dependencies = [ + "clap 2.34.0", + "solana-clap-utils", + "solana-rpc-client", + "solana-sdk", + "thiserror", +] + +[[package]] +name = "solana-runtime" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7b736ed27efa42c3baad5ab25fa1e53fa49f52855cb7f6aeee3a7168fc403bc" +dependencies = [ + "arrayref", + "bincode", + "blake3", + "bv", + "bytemuck", + "byteorder", + "bzip2", + "crossbeam-channel", + "dashmap", + "dir-diff", + "flate2", + "fnv", + "im", + "index_list", + "itertools", + "lazy_static", + "log", + "lru", + "lz4", + "memmap2", + "modular-bitfield", + "num-derive", + "num-traits", + "num_cpus", + "num_enum 0.6.1", + "once_cell", + "ouroboros", + "percentage", + "rand 0.7.3", + "rayon", + "regex", + "rustc_version", + "serde", + "serde_derive", + "solana-address-lookup-table-program", + "solana-bpf-loader-program", + "solana-bucket-map", + "solana-compute-budget-program", + "solana-config-program", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-loader-v4-program", + "solana-measure", + "solana-metrics", + "solana-perf", + "solana-program-runtime", + "solana-rayon-threadlimit", + "solana-sdk", + "solana-stake-program", + "solana-system-program", + "solana-vote-program", + "solana-zk-token-proof-program", + "solana-zk-token-sdk", + "static_assertions", + "strum", + "strum_macros", + "symlink", + "tar", + "tempfile", + "thiserror", + "zstd", +] + +[[package]] +name = "solana-sdk" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce456629674fdba5556ab109baac6ef5fc4caf5d42e375a1e3c4413807f3e81c" +dependencies = [ + "assert_matches", + "base64 0.21.2", + "bincode", + "bitflags 1.3.2", + "borsh 0.10.3", + "bs58", + "bytemuck", + "byteorder", + "chrono", + "derivation-path", + "digest 0.10.7", + "ed25519-dalek", + "ed25519-dalek-bip32", + "generic-array", + "hmac 0.12.1", + "itertools", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "memmap2", + "num-derive", + "num-traits", + "num_enum 0.6.1", + "pbkdf2 0.11.0", + "qstring", + "rand 0.7.3", + "rand_chacha 0.2.2", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "serde_with", + "sha2 0.10.7", + "sha3 0.10.8", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-program", + "solana-sdk-macro", + "thiserror", + "uriparse", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-macro" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e5a8c7e9e91c7d35f24ffd47a04221f76edb9aba968d79ee10e1cb26f16d2f" +dependencies = [ + "bs58", + "proc-macro2 1.0.66", + "quote 1.0.33", + "rustversion", + "syn 2.0.29", +] + +[[package]] +name = "solana-send-transaction-service" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30194bffc07760335352d6fec3a8d65ab17ac653e2f60709a11099722d6f0fe" +dependencies = [ + "crossbeam-channel", + "log", + "solana-client", + "solana-measure", + "solana-metrics", + "solana-runtime", + "solana-sdk", + "solana-tpu-client", +] + +[[package]] +name = "solana-stake-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1716d64627a098bf7fc0807ac9a5dc616fe8ade48168f49f80c30c96b2009240" +dependencies = [ + "bincode", + "log", + "rustc_version", + "solana-config-program", + "solana-program-runtime", + "solana-sdk", + "solana-vote-program", +] + +[[package]] +name = "solana-streamer" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54302d45994b8054f0a86f91684d11343de6dd1007919f8465b74845831012aa" +dependencies = [ + "async-channel", + "bytes", + "crossbeam-channel", + "futures-util", + "histogram", + "indexmap 1.9.3", + "itertools", + "libc", + "log", + "nix", + "pem", + "percentage", + "pkcs8", + "quinn", + "quinn-proto", + "quinn-udp", + "rand 0.7.3", + "rcgen", + "rustls", + "solana-metrics", + "solana-perf", + "solana-sdk", + "thiserror", + "tokio", + "x509-parser", +] + +[[package]] +name = "solana-system-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b322cdb3118f20472bca12ceb65c29d86f8dedd504591859eb30a904f2ea1c4" +dependencies = [ + "bincode", + "log", + "serde", + "serde_derive", + "solana-program-runtime", + "solana-sdk", +] + +[[package]] +name = "solana-thin-client" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ef9e0b5c06c4f573c7b8615dc5fefd55d8b7dbfded6fdf66bd45c0bac975ed" +dependencies = [ + "bincode", + "log", + "rayon", + "solana-connection-cache", + "solana-rpc-client", + "solana-rpc-client-api", + "solana-sdk", +] + +[[package]] +name = "solana-tpu-client" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "508f295dd72b0a2040322083ed88468a8ab6e5b51caaa34a8054b66452fac39a" +dependencies = [ + "async-trait", + "bincode", + "futures-util", + "indexmap 1.9.3", + "indicatif", + "log", + "rand 0.7.3", + "rayon", + "solana-connection-cache", + "solana-measure", + "solana-metrics", + "solana-pubsub-client", + "solana-rpc-client", + "solana-rpc-client-api", + "solana-sdk", + "thiserror", + "tokio", +] + +[[package]] +name = "solana-transaction-status" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b24b10eecf139b2a47b6ccae13685e3c41458e871c57670f9963afe461659f8" +dependencies = [ + "Inflector", + "base64 0.21.2", + "bincode", + "borsh 0.9.3", + "bs58", + "lazy_static", + "log", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder", + "solana-address-lookup-table-program", + "solana-sdk", + "spl-associated-token-account 1.1.3", + "spl-memo", + "spl-token 3.5.0", + "spl-token-2022 0.6.1", + "thiserror", +] + +[[package]] +name = "solana-udp-client" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b01e752329901acdc2a788044253cdb9439c924832bca8a9c23112429477fd20" +dependencies = [ + "async-trait", + "solana-connection-cache", + "solana-net-utils", + "solana-sdk", + "solana-streamer", + "thiserror", + "tokio", +] + +[[package]] +name = "solana-version" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976a54918e3e5516e53825d1bfc5f728b97fada082e2cc2e203bd29f9b5640e7" +dependencies = [ + "log", + "rustc_version", + "semver", + "serde", + "serde_derive", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk", +] + +[[package]] +name = "solana-vote-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8394fd700d24cd8505233fbf1cdb85fa6de1f40b3a48992ea8b3ee7b7dd28c97" +dependencies = [ + "bincode", + "log", + "num-derive", + "num-traits", + "rustc_version", + "serde", + "serde_derive", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-metrics", + "solana-program", + "solana-program-runtime", + "solana-sdk", + "thiserror", +] + +[[package]] +name = "solana-zk-token-proof-program" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9be05a31cac0e0fad15e198ac95e9c3f1bcce26c7834bcdfaefbead9c5ff2f" +dependencies = [ + "bytemuck", + "getrandom 0.1.16", + "num-derive", + "num-traits", + "solana-program-runtime", + "solana-sdk", + "solana-zk-token-sdk", +] + +[[package]] +name = "solana-zk-token-sdk" +version = "1.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de66fbc7bd6cc3177270cb6c157722fb33f8f2cd2c5c3ad555c6f558705678c4" +dependencies = [ + "aes-gcm-siv", + "base64 0.21.2", + "bincode", + "bytemuck", + "byteorder", + "curve25519-dalek", + "getrandom 0.1.16", + "itertools", + "lazy_static", + "merlin", + "num-derive", + "num-traits", + "rand 0.7.3", + "serde", + "serde_json", + "sha3 0.9.1", + "solana-program", + "solana-sdk", + "subtle", + "thiserror", + "zeroize", +] + +[[package]] +name = "solana_rbpf" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3082ec3a1d4ef7879eb5b84916d5acde057abd59733eec3647e0ab8885283ef" +dependencies = [ + "byteorder", + "combine", + "goblin", + "hash32", + "libc", + "log", + "rand 0.8.5", + "rustc-demangle", + "scroll", + "thiserror", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "spl-associated-token-account" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978dba3bcbe88d0c2c58366c254d9ea41c5f73357e72fc0bdee4d6b5fc99c8f4" +dependencies = [ + "assert_matches", + "borsh 0.9.3", + "num-derive", + "num-traits", + "solana-program", + "spl-token 3.5.0", + "spl-token-2022 0.6.1", + "thiserror", +] + +[[package]] +name = "spl-associated-token-account" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02693d7b36cea2b45318b87f22406909879226963296f31f4ebb0fc7f6e1aeb3" +dependencies = [ + "assert_matches", + "borsh 0.10.3", + "num-derive", + "num-traits", + "solana-program", + "spl-token 4.0.0", + "spl-token-2022 0.7.0", + "thiserror", +] + +[[package]] +name = "spl-discriminator" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator-derive", +] + +[[package]] +name = "spl-discriminator-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4fa8f409b5c5e0ac571df17c981ae1424b204743daa4428430627d38717caf5" +dependencies = [ + "quote 1.0.33", + "spl-discriminator-syn", + "syn 2.0.29", +] + +[[package]] +name = "spl-discriminator-syn" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21968d7da2f0a624c509f24580c3fee70b364a6886d90709e679e64f572eca2f" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "solana-program", + "syn 2.0.29", + "thiserror", +] + +[[package]] +name = "spl-memo" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325" +dependencies = [ + "solana-program", +] + +[[package]] +name = "spl-program-error" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af92f74cd3b0fdfda59fef4b571a92123e4df0f67cc43f73163975d31118ef82" +dependencies = [ + "num-derive", + "num-traits", + "solana-program", + "spl-program-error-derive", + "thiserror", +] + +[[package]] +name = "spl-program-error-derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173f3cc506847882189b3a5b67299f617fed2f9730f122dd197b82e1e213dee5" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "spl-tlv-account-resolution" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82149a5a06b5f158d03904066375eaf0c8a2422557cc3d5a25d277260d9a3b16" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator", + "spl-program-error", + "spl-type-length-value", +] + +[[package]] +name = "spl-token" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e85e168a785e82564160dcb87b2a8e04cee9bfd1f4d488c729d53d6a4bd300d" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.5.11", + "solana-program", + "thiserror", +] + +[[package]] +name = "spl-token" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08459ba1b8f7c1020b4582c4edf0f5c7511a5e099a7a97570c9698d4f2337060" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.6.1", + "solana-program", + "thiserror", +] + +[[package]] +name = "spl-token-2022" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0043b590232c400bad5ee9eb983ced003d15163c4c5d56b090ac6d9a57457b47" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.5.11", + "solana-program", + "solana-zk-token-sdk", + "spl-memo", + "spl-token 3.5.0", + "thiserror", +] + +[[package]] +name = "spl-token-2022" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b24ac5786a3fefbf59f5606312c61abf87b23154e7a717e5d18216fbea4711db" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.6.1", + "solana-program", + "solana-zk-token-sdk", + "spl-memo", + "spl-token 4.0.0", + "spl-transfer-hook-interface", + "thiserror", +] + +[[package]] +name = "spl-transfer-hook-interface" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a2326852adf88716fbac7f54cd6ee2c8a0b5a14ede24db3b4519c4ff13df04b" +dependencies = [ + "arrayref", + "bytemuck", + "num-derive", + "num-traits", + "num_enum 0.6.1", + "solana-program", + "spl-discriminator", + "spl-tlv-account-resolution", + "spl-type-length-value", + "thiserror", +] + +[[package]] +name = "spl-type-length-value" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1d085f426b33b8365fb98383d1b8b3925e21bdfe579c851ceaa7f511dbec191" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator", + "spl-program-error", +] + +[[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.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck", + "proc-macro2 1.0.66", + "quote 1.0.33", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "symlink" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a" + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", + "unicode-xid 0.2.4", +] + +[[package]] +name = "tar" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[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", + "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 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall 0.3.5", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + +[[package]] +name = "thiserror" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "time" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" +dependencies = [ + "deranged", + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + +[[package]] +name = "time-macros" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" +dependencies = [ + "time-core", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +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.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d0183f6f6001549ab68f8c7585093bb732beefbcf6d23a10b9b95c73a1dd49" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "once_cell", + "parking_lot 0.11.2", + "pin-project-lite", + "signal-hook-registry", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-serde" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "911a61637386b789af998ee23f50aa30d5fd7edcec8d6d3dedae5e5815205466" +dependencies = [ + "bincode", + "bytes", + "educe", + "futures-core", + "futures-sink", + "pin-project", + "serde", + "serde_json", +] + +[[package]] +name = "tokio-stream" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181" +dependencies = [ + "futures-util", + "log", + "rustls", + "tokio", + "tokio-rustls", + "tungstenite", + "webpki", + "webpki-roots", +] + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" + +[[package]] +name = "toml_edit" +version = "0.19.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +dependencies = [ + "indexmap 2.0.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +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.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "sharded-slab", + "thread_local", + "tracing-core", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "tungstenite" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" +dependencies = [ + "base64 0.13.1", + "byteorder", + "bytes", + "http", + "httparse", + "log", + "rand 0.8.5", + "rustls", + "sha-1", + "thiserror", + "url", + "utf-8", + "webpki", + "webpki-roots", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array", + "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.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[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.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "walkdir" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +dependencies = [ + "same-file", + "winapi-util", +] + +[[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.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote 1.0.33", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.29", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[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" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[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-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[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_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[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_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[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_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[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_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[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_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winnow" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d09770118a7eb1ccaf4a594a221334119a44a814fcb0d31c5b85e83e97227a97" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + +[[package]] +name = "x509-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +dependencies = [ + "asn1-rs", + "base64 0.13.1", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time 0.3.25", +] + +[[package]] +name = "xattr" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" +dependencies = [ + "libc", +] + +[[package]] +name = "yasna" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" +dependencies = [ + "time 0.3.25", +] + +[[package]] +name = "zeroize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +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 1.0.66", + "quote 1.0.33", + "syn 2.0.29", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.8+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" +dependencies = [ + "cc", + "libc", + "pkg-config", +] diff --git a/clients/rust/Cargo.toml b/clients/rust/Cargo.toml new file mode 100644 index 00000000..ed037913 --- /dev/null +++ b/clients/rust/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "mpl-token-metadata" +version = "2.0.0-beta.1" +description = "Metaplex Token Metadata SDK" +authors = ["Metaplex Developers "] +repository = "https://github.com/metaplex-foundation/mpl-token-metadata" +license-file = "../../LICENSE" +edition = "2021" +readme = "README.md" + +[lib] +crate-type = ["cdylib", "lib"] + +[features] +test-sbf = [] + +[dependencies] +solana-program = "^1.10" +borsh = ">= 0.9, < 0.11" +num-derive = "^0.3" +num-traits = "^0.2" +thiserror = "^1.0" + +[dev-dependencies] +assert_matches = "1.5.0" +solana-program-test = "^1.10" +solana-sdk = "^1.10" +spl-token = { version = ">= 3.5.0, < 5.0", features = ["no-entrypoint"] } +spl-associated-token-account = { version = ">= 1.1.3, < 3.0", features = ["no-entrypoint"] } diff --git a/clients/rust/README.md b/clients/rust/README.md new file mode 100644 index 00000000..ab9a4db1 --- /dev/null +++ b/clients/rust/README.md @@ -0,0 +1,276 @@ +

+ Metaplex Token Metadata SDK +

+

+ Rust library for interacting with Metaplex Token Metadata program. +

+

+ + +

+ +## Why using a client library (SDK)? + + Using a program crate as a dependency has its caveats. The main one is that you are bound to the same dependencies of that program, which tend to be quite a few. In many cases, this leads to dependency problems when trying to update crate versions. Secondly, the program crate is generated from the program source code, which its main purpose is to offer the functionality of the program, not necessarily a _friendly_ client API. + + Enter an SDK crate: minimal dependencies, useful helpers. By autogenerating a client SDK to include all `accounts`, `types`, `instructions` and `errors` from a program using the IDL, we can significantly reduce the number of dependencies. The autogenerated code can be refined by adding (manually-written) helpers. + + > **Note** + > Although the SDK crate has 5 dependencies, in practice the only "real" dependency is the `solana-program` crate since the remaining 4 dependencies are also dependencies of the `solana-program`. + +## Getting started + +From your project folder: + ```bash + cargo add mpl-token-metadata + ``` + +## Structure + + The client SDK is divided into several modules: + + * `accounts`: structs representing the accounts of the program + * `errors`: enums representing the program errors + * `instructions`: structs to facilitate the creation of instructions, instruction arguments and CPI instructions + * `types`: structs representing types used by the program + +## Instruction Builders + +One of the main features of the client SDK is to facilitate the creation of instructions. There are two "types" of instruction builders automatically generated – both support passing accounts by name and optional positional + +### _Client_ instruction builders + +This are intended to be used by off-chain client code. Each instruction is represented by a corresponding struct – e.g., `CreateV1`: +```rust +pub struct CreateV1 { + /// Unallocated metadata account with address as pda of ['metadata', program id, mint id] + pub metadata: solana_program::pubkey::Pubkey, + /// Unallocated edition account with address as pda of ['metadata', program id, mint, 'edition'] + pub master_edition: Option, + /// Mint of token asset + pub mint: (solana_program::pubkey::Pubkey, bool), + /// Mint authority + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// Update authority for the metadata account + pub update_authority: (solana_program::pubkey::Pubkey, bool), + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token program + pub spl_token_program: solana_program::pubkey::Pubkey, +} +``` + +After filling in the instruction account fields, you can use the `instruction(...)` method to generate the corresponding `solana_program::instruction::Instruction`: +```rust +// instruction args +let args = CreateV1InstructionArgs { + name: String::from("pNFT"), + symbol: String::from(""), + uri: String::from("http://my.pnft"), + seller_fee_basis_points: 500, + primary_sale_happened: false, + is_mutable: true, + token_standard: TokenStandard::ProgrammableNonFungible, + collection: None, + uses: None, + collection_details: None, + creators: None, + rule_set: None, + decimals: Some(0), + print_supply: Some(PrintSupply::Zero), +}; + +// instruction accounts +let create_ix = CreateV1 { + metadata, + master_edition: Some(master_edition), + mint: (mint_pubkey, true), + authority: payer_pubkey, + payer: payer_pubkey, + update_authority: (payer_pubkey, true), + system_program: system_program::ID, + sysvar_instructions: solana_program::sysvar::instructions::ID, + spl_token_program: spl_token::ID, +}; + +// creates the instruction +let create_ix = create_ix.instruction(args); +``` + +Alternatively, you can use the `CreateV1Builder` to create the appropriate instruction: +```rust +let create_ix = CreateV1Builder::new() + .metadata(metadata) + .master_edition(master_edition) + .mint(mint_pubkey, true) + .authority(payer_pubkey) + .payer(payer_pubkey) + .update_authority(payer_pubkey, true) + .is_mutable(true) + .primary_sale_happened(false) + .name(String::from("pNFT")) + .uri(String::from("http://my.pnft")) + .seller_fee_basis_points(500) + .token_standard(TokenStandard::ProgrammableNonFungible) + .print_supply(PrintSupply::Zero) + .build(); +``` + +### _CPI_ instruction builders + +These are builders to be used by on-chain code, which will CPI into Token Metadata. Similarly to "off-chain" builders, each instruction has a struct to invoke CPI instructions – e.g., `TransferV1Cpi`: +```rust +pub struct TransferV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account owner + pub token_owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Destination token account + pub destination_token: &'a solana_program::account_info::AccountInfo<'a>, + /// Destination token account owner + pub destination_owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of token asset + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition of token asset + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Destination token record account + pub destination_token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Transfer authority (token owner or delegate) + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Associated Token Account program + pub spl_ata_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: TransferV1InstructionArgs, +} +``` + +After filling in the instruction account info and argument fields, you can use the `invoke()` or `invoke_signed(...)` method to perform the CPI: +```rust +// instruction args +let mut args = TransferV1InstructionArgs { + amount, + authorization_data: None, +}; + +// instruction accounts +let cpi_transfer = TransferV1Cpi { + __program: metadata_program_info, + __args: args, + token: owner_token_info, + token_owner: owner_info, + destination_token: destination_token_info, + destination_owner: destination_info, + mint: mint_info, + metadata: metadata_info, + authority: vault_info, + payer: payer_info, + system_program: system_program_info, + sysvar_instructions: sysvar_instructions_info, + spl_token_program: spl_token_program_info, + spl_ata_program: spl_ata_program_info, + edition: edition_info, + token_record: None, + destination_token_record: None, + authorization_rules: None, + authorization_rules_program: None, +}; + +// performs the CPI +cpi_transfer.invoke_signed(&[&signer_seeds]) +``` + +You can also use the `TransferV1CpiBuilder` to simplify the process: +```rust +let cpi_transfer = TransferV1CpiBuilder::new(metadata_program_info) + .token(owner_token_info) + .token_owner(owner_info) + .destination_token(destination_token_info) + .destination_owner(destination_info) + .mint(mint_info) + .metadata(metadata_info) + .edition(edition_info) + .authority(vault_info) + .payer(payer_info) + .system_program(system_program_info) + .sysvar_instructions(sysvar_instructions_info) + .spl_token_program(spl_token_program_info) + .spl_ata_program(spl_ata_program_info) + .amount(amount) + .build(); + +// performs the CPI +cpi_transfer.invoke_signed(&[&signer_seeds]) +``` + +> **Note** +> `*Builder` provide a simplified way to create the required structs, since they take advantage of any default value set on the Kinobi config and do not require to set a `None` value to optional fields. + +## PDA helpers + +Account types (e.g., `Metadata`) have associated functions to find PDA or to create PDA `Pubkey`s: +```rust +impl Metadata { + pub fn find_pda(mint: Pubkey) -> (solana_program::pubkey::Pubkey, u8) { + solana_program::pubkey::Pubkey::find_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } + pub fn create_pda( + mint: Pubkey, + bump: u8, + ) -> Result { + solana_program::pubkey::Pubkey::create_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + &[bump], + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } +} +``` +> If a bump seed is known, it is _cheaper_ (in terms of compute units) to use the `create_pda` function, in particular for on-chain code. + + ## Testing + + To run the SDK tests, run the following from the root directory of the repository: + ```bash + pnpm install + ``` + and then: + ```bash + pnpm programs:sdk + ``` + + ## Documentation + + The crate documentation can be found [here](https://docs.rs/mpl-token-metadata/latest/mpl_token_metadata/). diff --git a/clients/rust/src/generated/accounts/collection_authority_record.rs b/clients/rust/src/generated/accounts/collection_authority_record.rs new file mode 100644 index 00000000..657840e8 --- /dev/null +++ b/clients/rust/src/generated/accounts/collection_authority_record.rs @@ -0,0 +1,64 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Key; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct CollectionAuthorityRecord { + pub key: Key, + pub bump: u8, + pub update_authority: Option, +} + +impl CollectionAuthorityRecord { + pub fn find_pda( + mint: &Pubkey, + collection_authority: &Pubkey, + ) -> (solana_program::pubkey::Pubkey, u8) { + solana_program::pubkey::Pubkey::find_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "collection_authority".as_bytes(), + collection_authority.as_ref(), + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } + pub fn create_pda( + mint: Pubkey, + collection_authority: Pubkey, + bump: u8, + ) -> Result { + solana_program::pubkey::Pubkey::create_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "collection_authority".as_bytes(), + collection_authority.as_ref(), + &[bump], + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for CollectionAuthorityRecord { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/accounts/edition.rs b/clients/rust/src/generated/accounts/edition.rs new file mode 100644 index 00000000..87853288 --- /dev/null +++ b/clients/rust/src/generated/accounts/edition.rs @@ -0,0 +1,33 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Key; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct Edition { + pub key: Key, + pub parent: Pubkey, + pub edition: u64, +} + +impl Edition { + pub const LEN: usize = 41; +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for Edition { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/accounts/edition_marker.rs b/clients/rust/src/generated/accounts/edition_marker.rs new file mode 100644 index 00000000..1f7f5b93 --- /dev/null +++ b/clients/rust/src/generated/accounts/edition_marker.rs @@ -0,0 +1,62 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Key; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct EditionMarker { + pub key: Key, + pub ledger: [u8; 31], +} + +impl EditionMarker { + pub const LEN: usize = 32; + + pub fn find_pda(mint: &Pubkey, edition_marker: &str) -> (solana_program::pubkey::Pubkey, u8) { + solana_program::pubkey::Pubkey::find_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "edition".as_bytes(), + edition_marker.to_string().as_ref(), + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } + pub fn create_pda( + mint: Pubkey, + edition_marker: &str, + bump: u8, + ) -> Result { + solana_program::pubkey::Pubkey::create_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "edition".as_bytes(), + edition_marker.to_string().as_ref(), + &[bump], + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for EditionMarker { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/accounts/edition_marker_v2.rs b/clients/rust/src/generated/accounts/edition_marker_v2.rs new file mode 100644 index 00000000..4732e702 --- /dev/null +++ b/clients/rust/src/generated/accounts/edition_marker_v2.rs @@ -0,0 +1,59 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Key; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct EditionMarkerV2 { + pub key: Key, + pub ledger: Vec, +} + +impl EditionMarkerV2 { + pub fn find_pda(mint: &Pubkey) -> (solana_program::pubkey::Pubkey, u8) { + solana_program::pubkey::Pubkey::find_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "edition".as_bytes(), + "marker".as_bytes(), + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } + pub fn create_pda( + mint: Pubkey, + bump: u8, + ) -> Result { + solana_program::pubkey::Pubkey::create_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "edition".as_bytes(), + "marker".as_bytes(), + &[bump], + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for EditionMarkerV2 { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/accounts/master_edition.rs b/clients/rust/src/generated/accounts/master_edition.rs new file mode 100644 index 00000000..db1b6b3f --- /dev/null +++ b/clients/rust/src/generated/accounts/master_edition.rs @@ -0,0 +1,58 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Key; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct MasterEdition { + pub key: Key, + pub supply: u64, + pub max_supply: Option, +} + +impl MasterEdition { + pub fn find_pda(mint: &Pubkey) -> (solana_program::pubkey::Pubkey, u8) { + solana_program::pubkey::Pubkey::find_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "edition".as_bytes(), + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } + pub fn create_pda( + mint: Pubkey, + bump: u8, + ) -> Result { + solana_program::pubkey::Pubkey::create_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "edition".as_bytes(), + &[bump], + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for MasterEdition { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/accounts/metadata.rs b/clients/rust/src/generated/accounts/metadata.rs new file mode 100644 index 00000000..033b4c07 --- /dev/null +++ b/clients/rust/src/generated/accounts/metadata.rs @@ -0,0 +1,75 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Collection; +use crate::generated::types::CollectionDetails; +use crate::generated::types::Creator; +use crate::generated::types::Key; +use crate::generated::types::ProgrammableConfig; +use crate::generated::types::TokenStandard; +use crate::generated::types::Uses; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct Metadata { + pub key: Key, + pub update_authority: Pubkey, + pub mint: Pubkey, + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, + pub primary_sale_happened: bool, + pub is_mutable: bool, + pub edition_nonce: Option, + pub token_standard: Option, + pub collection: Option, + pub uses: Option, + pub collection_details: Option, + pub programmable_config: Option, +} + +impl Metadata { + pub fn find_pda(mint: &Pubkey) -> (solana_program::pubkey::Pubkey, u8) { + solana_program::pubkey::Pubkey::find_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } + pub fn create_pda( + mint: Pubkey, + bump: u8, + ) -> Result { + solana_program::pubkey::Pubkey::create_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + &[bump], + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for Metadata { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/accounts/metadata_delegate_record.rs b/clients/rust/src/generated/accounts/metadata_delegate_record.rs new file mode 100644 index 00000000..17c61b50 --- /dev/null +++ b/clients/rust/src/generated/accounts/metadata_delegate_record.rs @@ -0,0 +1,75 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Key; +use crate::hooked::MetadataDelegateRoleSeed; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct MetadataDelegateRecord { + pub key: Key, + pub bump: u8, + pub mint: Pubkey, + pub delegate: Pubkey, + pub update_authority: Pubkey, +} + +impl MetadataDelegateRecord { + pub const LEN: usize = 98; + + pub fn find_pda( + mint: &Pubkey, + delegate_role: MetadataDelegateRoleSeed, + update_authority: &Pubkey, + delegate: &Pubkey, + ) -> (solana_program::pubkey::Pubkey, u8) { + solana_program::pubkey::Pubkey::find_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + delegate_role.to_string().as_ref(), + update_authority.as_ref(), + delegate.as_ref(), + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } + pub fn create_pda( + mint: Pubkey, + delegate_role: MetadataDelegateRoleSeed, + update_authority: Pubkey, + delegate: Pubkey, + bump: u8, + ) -> Result { + solana_program::pubkey::Pubkey::create_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + delegate_role.to_string().as_ref(), + update_authority.as_ref(), + delegate.as_ref(), + &[bump], + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for MetadataDelegateRecord { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/accounts/mod.rs b/clients/rust/src/generated/accounts/mod.rs new file mode 100644 index 00000000..7fe23f41 --- /dev/null +++ b/clients/rust/src/generated/accounts/mod.rs @@ -0,0 +1,28 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +pub mod collection_authority_record; +pub mod edition; +pub mod edition_marker; +pub mod edition_marker_v2; +pub mod master_edition; +pub mod metadata; +pub mod metadata_delegate_record; +pub mod token_owned_escrow; +pub mod token_record; +pub mod use_authority_record; + +pub use self::collection_authority_record::*; +pub use self::edition::*; +pub use self::edition_marker::*; +pub use self::edition_marker_v2::*; +pub use self::master_edition::*; +pub use self::metadata::*; +pub use self::metadata_delegate_record::*; +pub use self::token_owned_escrow::*; +pub use self::token_record::*; +pub use self::use_authority_record::*; diff --git a/clients/rust/src/generated/accounts/token_owned_escrow.rs b/clients/rust/src/generated/accounts/token_owned_escrow.rs new file mode 100644 index 00000000..f15a6c0b --- /dev/null +++ b/clients/rust/src/generated/accounts/token_owned_escrow.rs @@ -0,0 +1,31 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::EscrowAuthority; +use crate::generated::types::Key; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct TokenOwnedEscrow { + pub key: Key, + pub base_token: Pubkey, + pub authority: EscrowAuthority, + pub bump: u8, +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for TokenOwnedEscrow { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/accounts/token_record.rs b/clients/rust/src/generated/accounts/token_record.rs new file mode 100644 index 00000000..7840e082 --- /dev/null +++ b/clients/rust/src/generated/accounts/token_record.rs @@ -0,0 +1,69 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Key; +use crate::generated::types::TokenDelegateRole; +use crate::generated::types::TokenState; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct TokenRecord { + pub key: Key, + pub bump: u8, + pub state: TokenState, + pub rule_set_revision: Option, + pub delegate: Option, + pub delegate_role: Option, + pub locked_transfer: Option, +} + +impl TokenRecord { + pub const LEN: usize = 80; + + pub fn find_pda(mint: &Pubkey, token: &Pubkey) -> (solana_program::pubkey::Pubkey, u8) { + solana_program::pubkey::Pubkey::find_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "token_record".as_bytes(), + token.as_ref(), + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } + pub fn create_pda( + mint: Pubkey, + token: Pubkey, + bump: u8, + ) -> Result { + solana_program::pubkey::Pubkey::create_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "token_record".as_bytes(), + token.as_ref(), + &[bump], + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for TokenRecord { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/accounts/use_authority_record.rs b/clients/rust/src/generated/accounts/use_authority_record.rs new file mode 100644 index 00000000..2a514bce --- /dev/null +++ b/clients/rust/src/generated/accounts/use_authority_record.rs @@ -0,0 +1,63 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Key; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct UseAuthorityRecord { + pub key: Key, + pub allowed_uses: u64, + pub bump: u8, +} + +impl UseAuthorityRecord { + pub const LEN: usize = 10; + + pub fn find_pda(mint: &Pubkey, use_authority: &Pubkey) -> (solana_program::pubkey::Pubkey, u8) { + solana_program::pubkey::Pubkey::find_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "user".as_bytes(), + use_authority.as_ref(), + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } + pub fn create_pda( + mint: Pubkey, + use_authority: Pubkey, + bump: u8, + ) -> Result { + solana_program::pubkey::Pubkey::create_program_address( + &[ + "metadata".as_bytes(), + crate::MPL_TOKEN_METADATA_ID.as_ref(), + mint.as_ref(), + "user".as_bytes(), + use_authority.as_ref(), + &[bump], + ], + &crate::MPL_TOKEN_METADATA_ID, + ) + } +} + +impl<'a> TryFrom<&'a solana_program::account_info::AccountInfo<'a>> for UseAuthorityRecord { + type Error = std::io::Error; + + fn try_from( + account_info: &'a solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} diff --git a/clients/rust/src/generated/errors/mod.rs b/clients/rust/src/generated/errors/mod.rs new file mode 100644 index 00000000..af3ff710 --- /dev/null +++ b/clients/rust/src/generated/errors/mod.rs @@ -0,0 +1,10 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +pub mod mpl_token_metadata; + +pub use self::mpl_token_metadata::MplTokenMetadataError; diff --git a/clients/rust/src/generated/errors/mpl_token_metadata.rs b/clients/rust/src/generated/errors/mpl_token_metadata.rs new file mode 100644 index 00000000..e83b0d09 --- /dev/null +++ b/clients/rust/src/generated/errors/mpl_token_metadata.rs @@ -0,0 +1,598 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use num_derive::FromPrimitive; +use thiserror::Error; + +#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)] +pub enum MplTokenMetadataError { + /// 0x0 - + #[error("")] + InstructionUnpackError, + /// 0x1 - + #[error("")] + InstructionPackError, + /// 0x2 - Lamport balance below rent-exempt threshold + #[error("Lamport balance below rent-exempt threshold")] + NotRentExempt, + /// 0x3 - Already initialized + #[error("Already initialized")] + AlreadyInitialized, + /// 0x4 - Uninitialized + #[error("Uninitialized")] + Uninitialized, + /// 0x5 - Metadata's key must match seed of ['metadata', program id, mint] provided + #[error(" Metadata's key must match seed of ['metadata', program id, mint] provided")] + InvalidMetadataKey, + /// 0x6 - Edition's key must match seed of ['metadata', program id, name, 'edition'] provided + #[error("Edition's key must match seed of ['metadata', program id, name, 'edition'] provided")] + InvalidEditionKey, + /// 0x7 - Update Authority given does not match + #[error("Update Authority given does not match")] + UpdateAuthorityIncorrect, + /// 0x8 - Update Authority needs to be signer to update metadata + #[error("Update Authority needs to be signer to update metadata")] + UpdateAuthorityIsNotSigner, + /// 0x9 - You must be the mint authority and signer on this transaction + #[error("You must be the mint authority and signer on this transaction")] + NotMintAuthority, + /// 0xA - Mint authority provided does not match the authority on the mint + #[error("Mint authority provided does not match the authority on the mint")] + InvalidMintAuthority, + /// 0xB - Name too long + #[error("Name too long")] + NameTooLong, + /// 0xC - Symbol too long + #[error("Symbol too long")] + SymbolTooLong, + /// 0xD - URI too long + #[error("URI too long")] + UriTooLong, + /// 0xE - + #[error("")] + UpdateAuthorityMustBeEqualToMetadataAuthorityAndSigner, + /// 0xF - Mint given does not match mint on Metadata + #[error("Mint given does not match mint on Metadata")] + MintMismatch, + /// 0x10 - Editions must have exactly one token + #[error("Editions must have exactly one token")] + EditionsMustHaveExactlyOneToken, + /// 0x11 - + #[error("")] + MaxEditionsMintedAlready, + /// 0x12 - + #[error("")] + TokenMintToFailed, + /// 0x13 - + #[error("")] + MasterRecordMismatch, + /// 0x14 - + #[error("")] + DestinationMintMismatch, + /// 0x15 - + #[error("")] + EditionAlreadyMinted, + /// 0x16 - + #[error("")] + PrintingMintDecimalsShouldBeZero, + /// 0x17 - + #[error("")] + OneTimePrintingAuthorizationMintDecimalsShouldBeZero, + /// 0x18 - EditionMintDecimalsShouldBeZero + #[error("EditionMintDecimalsShouldBeZero")] + EditionMintDecimalsShouldBeZero, + /// 0x19 - + #[error("")] + TokenBurnFailed, + /// 0x1A - + #[error("")] + TokenAccountOneTimeAuthMintMismatch, + /// 0x1B - Derived key invalid + #[error("Derived key invalid")] + DerivedKeyInvalid, + /// 0x1C - The Printing mint does not match that on the master edition! + #[error("The Printing mint does not match that on the master edition!")] + PrintingMintMismatch, + /// 0x1D - The One Time Printing Auth mint does not match that on the master edition! + #[error("The One Time Printing Auth mint does not match that on the master edition!")] + OneTimePrintingAuthMintMismatch, + /// 0x1E - The mint of the token account does not match the Printing mint! + #[error("The mint of the token account does not match the Printing mint!")] + TokenAccountMintMismatch, + /// 0x1F - The mint of the token account does not match the master metadata mint! + #[error("The mint of the token account does not match the master metadata mint!")] + TokenAccountMintMismatchV2, + /// 0x20 - Not enough tokens to mint a limited edition + #[error("Not enough tokens to mint a limited edition")] + NotEnoughTokens, + /// 0x21 - + #[error("")] + PrintingMintAuthorizationAccountMismatch, + /// 0x22 - + #[error("")] + AuthorizationTokenAccountOwnerMismatch, + /// 0x23 - + #[error("")] + Disabled, + /// 0x24 - Creators list too long + #[error("Creators list too long")] + CreatorsTooLong, + /// 0x25 - Creators must be at least one if set + #[error("Creators must be at least one if set")] + CreatorsMustBeAtleastOne, + /// 0x26 - + #[error("")] + MustBeOneOfCreators, + /// 0x27 - This metadata does not have creators + #[error("This metadata does not have creators")] + NoCreatorsPresentOnMetadata, + /// 0x28 - This creator address was not found + #[error("This creator address was not found")] + CreatorNotFound, + /// 0x29 - Basis points cannot be more than 10000 + #[error("Basis points cannot be more than 10000")] + InvalidBasisPoints, + /// 0x2A - Primary sale can only be flipped to true and is immutable + #[error("Primary sale can only be flipped to true and is immutable")] + PrimarySaleCanOnlyBeFlippedToTrue, + /// 0x2B - Owner does not match that on the account given + #[error("Owner does not match that on the account given")] + OwnerMismatch, + /// 0x2C - This account has no tokens to be used for authorization + #[error("This account has no tokens to be used for authorization")] + NoBalanceInAccountForAuthorization, + /// 0x2D - Share total must equal 100 for creator array + #[error("Share total must equal 100 for creator array")] + ShareTotalMustBe100, + /// 0x2E - + #[error("")] + ReservationExists, + /// 0x2F - + #[error("")] + ReservationDoesNotExist, + /// 0x30 - + #[error("")] + ReservationNotSet, + /// 0x31 - + #[error("")] + ReservationAlreadyMade, + /// 0x32 - + #[error("")] + BeyondMaxAddressSize, + /// 0x33 - NumericalOverflowError + #[error("NumericalOverflowError")] + NumericalOverflowError, + /// 0x34 - + #[error("")] + ReservationBreachesMaximumSupply, + /// 0x35 - + #[error("")] + AddressNotInReservation, + /// 0x36 - You cannot unilaterally verify another creator, they must sign + #[error("You cannot unilaterally verify another creator, they must sign")] + CannotVerifyAnotherCreator, + /// 0x37 - You cannot unilaterally unverify another creator + #[error("You cannot unilaterally unverify another creator")] + CannotUnverifyAnotherCreator, + /// 0x38 - + #[error("")] + SpotMismatch, + /// 0x39 - Incorrect account owner + #[error("Incorrect account owner")] + IncorrectOwner, + /// 0x3A - + #[error("")] + PrintingWouldBreachMaximumSupply, + /// 0x3B - Data is immutable + #[error("Data is immutable")] + DataIsImmutable, + /// 0x3C - No duplicate creator addresses + #[error("No duplicate creator addresses")] + DuplicateCreatorAddress, + /// 0x3D - + #[error("")] + ReservationSpotsRemainingShouldMatchTotalSpotsAtStart, + /// 0x3E - Invalid token program + #[error("Invalid token program")] + InvalidTokenProgram, + /// 0x3F - Data type mismatch + #[error("Data type mismatch")] + DataTypeMismatch, + /// 0x40 - + #[error("")] + BeyondAlottedAddressSize, + /// 0x41 - + #[error("")] + ReservationNotComplete, + /// 0x42 - + #[error("")] + TriedToReplaceAnExistingReservation, + /// 0x43 - Invalid operation + #[error("Invalid operation")] + InvalidOperation, + /// 0x44 - Invalid Owner + #[error("Invalid Owner")] + InvalidOwner, + /// 0x45 - Printing mint supply must be zero for conversion + #[error("Printing mint supply must be zero for conversion")] + PrintingMintSupplyMustBeZeroForConversion, + /// 0x46 - One Time Auth mint supply must be zero for conversion + #[error("One Time Auth mint supply must be zero for conversion")] + OneTimeAuthMintSupplyMustBeZeroForConversion, + /// 0x47 - You tried to insert one edition too many into an edition mark pda + #[error("You tried to insert one edition too many into an edition mark pda")] + InvalidEditionIndex, + /// 0x48 - + #[error("")] + ReservationArrayShouldBeSizeOne, + /// 0x49 - Is Mutable can only be flipped to false + #[error("Is Mutable can only be flipped to false")] + IsMutableCanOnlyBeFlippedToFalse, + /// 0x4A - Collection cannot be verified in this instruction + #[error("Collection cannot be verified in this instruction")] + CollectionCannotBeVerifiedInThisInstruction, + /// 0x4B - This instruction was deprecated in a previous release and is now removed + #[error("This instruction was deprecated in a previous release and is now removed")] + Removed, + /// 0x4C - + #[error("")] + MustBeBurned, + /// 0x4D - This use method is invalid + #[error("This use method is invalid")] + InvalidUseMethod, + /// 0x4E - Cannot Change Use Method after the first use + #[error("Cannot Change Use Method after the first use")] + CannotChangeUseMethodAfterFirstUse, + /// 0x4F - Cannot Change Remaining or Available uses after the first use + #[error("Cannot Change Remaining or Available uses after the first use")] + CannotChangeUsesAfterFirstUse, + /// 0x50 - Collection Not Found on Metadata + #[error("Collection Not Found on Metadata")] + CollectionNotFound, + /// 0x51 - Collection Update Authority is invalid + #[error("Collection Update Authority is invalid")] + InvalidCollectionUpdateAuthority, + /// 0x52 - Collection Must Be a Unique Master Edition v2 + #[error("Collection Must Be a Unique Master Edition v2")] + CollectionMustBeAUniqueMasterEdition, + /// 0x53 - The Use Authority Record Already Exists, to modify it Revoke, then Approve + #[error("The Use Authority Record Already Exists, to modify it Revoke, then Approve")] + UseAuthorityRecordAlreadyExists, + /// 0x54 - The Use Authority Record is empty or already revoked + #[error("The Use Authority Record is empty or already revoked")] + UseAuthorityRecordAlreadyRevoked, + /// 0x55 - This token has no uses + #[error("This token has no uses")] + Unusable, + /// 0x56 - There are not enough Uses left on this token. + #[error("There are not enough Uses left on this token.")] + NotEnoughUses, + /// 0x57 - This Collection Authority Record Already Exists. + #[error("This Collection Authority Record Already Exists.")] + CollectionAuthorityRecordAlreadyExists, + /// 0x58 - This Collection Authority Record Does Not Exist. + #[error("This Collection Authority Record Does Not Exist.")] + CollectionAuthorityDoesNotExist, + /// 0x59 - This Use Authority Record is invalid. + #[error("This Use Authority Record is invalid.")] + InvalidUseAuthorityRecord, + /// 0x5A - + #[error("")] + InvalidCollectionAuthorityRecord, + /// 0x5B - Metadata does not match the freeze authority on the mint + #[error("Metadata does not match the freeze authority on the mint")] + InvalidFreezeAuthority, + /// 0x5C - All tokens in this account have not been delegated to this user. + #[error("All tokens in this account have not been delegated to this user.")] + InvalidDelegate, + /// 0x5D - + #[error("")] + CannotAdjustVerifiedCreator, + /// 0x5E - Verified creators cannot be removed. + #[error("Verified creators cannot be removed.")] + CannotRemoveVerifiedCreator, + /// 0x5F - + #[error("")] + CannotWipeVerifiedCreators, + /// 0x60 - + #[error("")] + NotAllowedToChangeSellerFeeBasisPoints, + /// 0x61 - Edition override cannot be zero + #[error("Edition override cannot be zero")] + EditionOverrideCannotBeZero, + /// 0x62 - Invalid User + #[error("Invalid User")] + InvalidUser, + /// 0x63 - Revoke Collection Authority signer is incorrect + #[error("Revoke Collection Authority signer is incorrect")] + RevokeCollectionAuthoritySignerIncorrect, + /// 0x64 - + #[error("")] + TokenCloseFailed, + /// 0x65 - Can't use this function on unsized collection + #[error("Can't use this function on unsized collection")] + UnsizedCollection, + /// 0x66 - Can't use this function on a sized collection + #[error("Can't use this function on a sized collection")] + SizedCollection, + /// 0x67 - Missing collection metadata account + #[error("Missing collection metadata account")] + MissingCollectionMetadata, + /// 0x68 - This NFT is not a member of the specified collection. + #[error("This NFT is not a member of the specified collection.")] + NotAMemberOfCollection, + /// 0x69 - This NFT is not a verified member of the specified collection. + #[error("This NFT is not a verified member of the specified collection.")] + NotVerifiedMemberOfCollection, + /// 0x6A - This NFT is not a collection parent NFT. + #[error("This NFT is not a collection parent NFT.")] + NotACollectionParent, + /// 0x6B - Could not determine a TokenStandard type. + #[error("Could not determine a TokenStandard type.")] + CouldNotDetermineTokenStandard, + /// 0x6C - This mint account has an edition but none was provided. + #[error("This mint account has an edition but none was provided.")] + MissingEditionAccount, + /// 0x6D - This edition is not a Master Edition + #[error("This edition is not a Master Edition")] + NotAMasterEdition, + /// 0x6E - This Master Edition has existing prints + #[error("This Master Edition has existing prints")] + MasterEditionHasPrints, + /// 0x6F - + #[error("")] + BorshDeserializationError, + /// 0x70 - Cannot update a verified collection in this command + #[error("Cannot update a verified collection in this command")] + CannotUpdateVerifiedCollection, + /// 0x71 - Edition account doesnt match collection + #[error("Edition account doesnt match collection ")] + CollectionMasterEditionAccountInvalid, + /// 0x72 - Item is already verified. + #[error("Item is already verified.")] + AlreadyVerified, + /// 0x73 - + #[error("")] + AlreadyUnverified, + /// 0x74 - This edition is not a Print Edition + #[error("This edition is not a Print Edition")] + NotAPrintEdition, + /// 0x75 - Invalid Master Edition + #[error("Invalid Master Edition")] + InvalidMasterEdition, + /// 0x76 - Invalid Print Edition + #[error("Invalid Print Edition")] + InvalidPrintEdition, + /// 0x77 - Invalid Edition Marker + #[error("Invalid Edition Marker")] + InvalidEditionMarker, + /// 0x78 - Reservation List is Deprecated + #[error("Reservation List is Deprecated")] + ReservationListDeprecated, + /// 0x79 - Print Edition does not match Master Edition + #[error("Print Edition does not match Master Edition")] + PrintEditionDoesNotMatchMasterEdition, + /// 0x7A - Edition Number greater than max supply + #[error("Edition Number greater than max supply")] + EditionNumberGreaterThanMaxSupply, + /// 0x7B - Must unverify before migrating collections. + #[error("Must unverify before migrating collections.")] + MustUnverify, + /// 0x7C - Invalid Escrow Account Bump Seed + #[error("Invalid Escrow Account Bump Seed")] + InvalidEscrowBumpSeed, + /// 0x7D - Must Escrow Authority + #[error("Must Escrow Authority")] + MustBeEscrowAuthority, + /// 0x7E - Invalid System Program + #[error("Invalid System Program")] + InvalidSystemProgram, + /// 0x7F - Must be a Non Fungible Token + #[error("Must be a Non Fungible Token")] + MustBeNonFungible, + /// 0x80 - Insufficient tokens for transfer + #[error("Insufficient tokens for transfer")] + InsufficientTokens, + /// 0x81 - Borsh Serialization Error + #[error("Borsh Serialization Error")] + BorshSerializationError, + /// 0x82 - Cannot create NFT with no Freeze Authority. + #[error("Cannot create NFT with no Freeze Authority.")] + NoFreezeAuthoritySet, + /// 0x83 - Invalid collection size change + #[error("Invalid collection size change")] + InvalidCollectionSizeChange, + /// 0x84 - Invalid bubblegum signer + #[error("Invalid bubblegum signer")] + InvalidBubblegumSigner, + /// 0x85 - Escrow parent cannot have a delegate + #[error("Escrow parent cannot have a delegate")] + EscrowParentHasDelegate, + /// 0x86 - Mint needs to be signer to initialize the account + #[error("Mint needs to be signer to initialize the account")] + MintIsNotSigner, + /// 0x87 - Invalid token standard + #[error("Invalid token standard")] + InvalidTokenStandard, + /// 0x88 - Invalid mint account for specified token standard + #[error("Invalid mint account for specified token standard")] + InvalidMintForTokenStandard, + /// 0x89 - Invalid authorization rules account + #[error("Invalid authorization rules account")] + InvalidAuthorizationRules, + /// 0x8A - Missing authorization rules account + #[error("Missing authorization rules account")] + MissingAuthorizationRules, + /// 0x8B - Missing programmable configuration + #[error("Missing programmable configuration")] + MissingProgrammableConfig, + /// 0x8C - Invalid programmable configuration + #[error("Invalid programmable configuration")] + InvalidProgrammableConfig, + /// 0x8D - Delegate already exists + #[error("Delegate already exists")] + DelegateAlreadyExists, + /// 0x8E - Delegate not found + #[error("Delegate not found")] + DelegateNotFound, + /// 0x8F - Required account not set in instruction builder + #[error("Required account not set in instruction builder")] + MissingAccountInBuilder, + /// 0x90 - Required argument not set in instruction builder + #[error("Required argument not set in instruction builder")] + MissingArgumentInBuilder, + /// 0x91 - Feature not supported currently + #[error("Feature not supported currently")] + FeatureNotSupported, + /// 0x92 - Invalid system wallet + #[error("Invalid system wallet")] + InvalidSystemWallet, + /// 0x93 - Only the sale delegate can transfer while its set + #[error("Only the sale delegate can transfer while its set")] + OnlySaleDelegateCanTransfer, + /// 0x94 - Missing token account + #[error("Missing token account")] + MissingTokenAccount, + /// 0x95 - Missing SPL token program + #[error("Missing SPL token program")] + MissingSplTokenProgram, + /// 0x96 - Missing authorization rules program + #[error("Missing authorization rules program")] + MissingAuthorizationRulesProgram, + /// 0x97 - Invalid delegate role for transfer + #[error("Invalid delegate role for transfer")] + InvalidDelegateRoleForTransfer, + /// 0x98 - Invalid transfer authority + #[error("Invalid transfer authority")] + InvalidTransferAuthority, + /// 0x99 - Instruction not supported for ProgrammableNonFungible assets + #[error("Instruction not supported for ProgrammableNonFungible assets")] + InstructionNotSupported, + /// 0x9A - Public key does not match expected value + #[error("Public key does not match expected value")] + KeyMismatch, + /// 0x9B - Token is locked + #[error("Token is locked")] + LockedToken, + /// 0x9C - Token is unlocked + #[error("Token is unlocked")] + UnlockedToken, + /// 0x9D - Missing delegate role + #[error("Missing delegate role")] + MissingDelegateRole, + /// 0x9E - Invalid authority type + #[error("Invalid authority type")] + InvalidAuthorityType, + /// 0x9F - Missing token record account + #[error("Missing token record account")] + MissingTokenRecord, + /// 0xA0 - Mint supply must be zero for programmable assets + #[error("Mint supply must be zero for programmable assets")] + MintSupplyMustBeZero, + /// 0xA1 - Data is empty or zeroed + #[error("Data is empty or zeroed")] + DataIsEmptyOrZeroed, + /// 0xA2 - Missing token owner + #[error("Missing token owner")] + MissingTokenOwnerAccount, + /// 0xA3 - Master edition account has an invalid length + #[error("Master edition account has an invalid length")] + InvalidMasterEditionAccountLength, + /// 0xA4 - Incorrect token state + #[error("Incorrect token state")] + IncorrectTokenState, + /// 0xA5 - Invalid delegate role + #[error("Invalid delegate role")] + InvalidDelegateRole, + /// 0xA6 - Print supply is required for non-fungibles + #[error("Print supply is required for non-fungibles")] + MissingPrintSupply, + /// 0xA7 - Missing master edition account + #[error("Missing master edition account")] + MissingMasterEditionAccount, + /// 0xA8 - Amount must be greater than zero + #[error("Amount must be greater than zero")] + AmountMustBeGreaterThanZero, + /// 0xA9 - Invalid delegate args + #[error("Invalid delegate args")] + InvalidDelegateArgs, + /// 0xAA - Missing address for locked transfer + #[error("Missing address for locked transfer")] + MissingLockedTransferAddress, + /// 0xAB - Invalid destination address for locked transfer + #[error("Invalid destination address for locked transfer")] + InvalidLockedTransferAddress, + /// 0xAC - Exceeded account realloc increase limit + #[error("Exceeded account realloc increase limit")] + DataIncrementLimitExceeded, + /// 0xAD - Cannot update the rule set of a programmable asset that has a delegate + #[error("Cannot update the rule set of a programmable asset that has a delegate")] + CannotUpdateAssetWithDelegate, + /// 0xAE - Invalid token amount for this operation or token standard + #[error("Invalid token amount for this operation or token standard")] + InvalidAmount, + /// 0xAF - Missing master edition mint account + #[error("Missing master edition mint account")] + MissingMasterEditionMintAccount, + /// 0xB0 - Missing master edition token account + #[error("Missing master edition token account")] + MissingMasterEditionTokenAccount, + /// 0xB1 - Missing edition marker account + #[error("Missing edition marker account")] + MissingEditionMarkerAccount, + /// 0xB2 - Cannot burn while persistent delegate is set + #[error("Cannot burn while persistent delegate is set")] + CannotBurnWithDelegate, + /// 0xB3 - Missing edition account + #[error("Missing edition account")] + MissingEdition, + /// 0xB4 - Invalid Associated Token Account Program + #[error("Invalid Associated Token Account Program")] + InvalidAssociatedTokenAccountProgram, + /// 0xB5 - Invalid InstructionsSysvar + #[error("Invalid InstructionsSysvar")] + InvalidInstructionsSysvar, + /// 0xB6 - Invalid or Unneeded parent accounts + #[error("Invalid or Unneeded parent accounts")] + InvalidParentAccounts, + /// 0xB7 - Authority cannot apply all update args + #[error("Authority cannot apply all update args")] + InvalidUpdateArgs, + /// 0xB8 - Token account does not have enough tokens + #[error("Token account does not have enough tokens")] + InsufficientTokenBalance, + /// 0xB9 - Missing collection account + #[error("Missing collection account")] + MissingCollectionMint, + /// 0xBA - Missing collection master edition account + #[error("Missing collection master edition account")] + MissingCollectionMasterEdition, + /// 0xBB - Invalid token record account + #[error("Invalid token record account")] + InvalidTokenRecord, + /// 0xBC - The close authority needs to be revoked by the Utility Delegate + #[error("The close authority needs to be revoked by the Utility Delegate")] + InvalidCloseAuthority, + /// 0xBD - Invalid or removed instruction + #[error("Invalid or removed instruction")] + InvalidInstruction, + /// 0xBE - Missing delegate record + #[error("Missing delegate record")] + MissingDelegateRecord, + /// 0xBF - + #[error("")] + InvalidFeeAccount, + /// 0xC0 - + #[error("")] + InvalidMetadataFlags, +} + +impl solana_program::program_error::PrintProgramError for MplTokenMetadataError { + fn print(&self) { + solana_program::msg!(&self.to_string()); + } +} diff --git a/clients/rust/src/generated/instructions/approve_collection_authority.rs b/clients/rust/src/generated/instructions/approve_collection_authority.rs new file mode 100644 index 00000000..2d28d78c --- /dev/null +++ b/clients/rust/src/generated/instructions/approve_collection_authority.rs @@ -0,0 +1,413 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct ApproveCollectionAuthority { + /// Collection Authority Record PDA + pub collection_authority_record: solana_program::pubkey::Pubkey, + /// A Collection Authority + pub new_collection_authority: solana_program::pubkey::Pubkey, + /// Update Authority of Collection NFT + pub update_authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// Collection Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Mint of Collection Metadata + pub mint: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Rent info + pub rent: Option, +} + +impl ApproveCollectionAuthority { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_authority_record, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.new_collection_authority, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.update_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + rent, false, + )); + } + let data = ApproveCollectionAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct ApproveCollectionAuthorityInstructionData { + discriminator: u8, +} + +impl ApproveCollectionAuthorityInstructionData { + fn new() -> Self { + Self { discriminator: 23 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct ApproveCollectionAuthorityBuilder { + collection_authority_record: Option, + new_collection_authority: Option, + update_authority: Option, + payer: Option, + metadata: Option, + mint: Option, + system_program: Option, + rent: Option, +} + +impl ApproveCollectionAuthorityBuilder { + pub fn new() -> Self { + Self::default() + } + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + /// A Collection Authority + #[inline(always)] + pub fn new_collection_authority( + &mut self, + new_collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.new_collection_authority = Some(new_collection_authority); + self + } + /// Update Authority of Collection NFT + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.update_authority = Some(update_authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Collection Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Mint of Collection Metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self { + self.rent = Some(rent); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = ApproveCollectionAuthority { + collection_authority_record: self + .collection_authority_record + .expect("collection_authority_record is not set"), + new_collection_authority: self + .new_collection_authority + .expect("new_collection_authority is not set"), + update_authority: self.update_authority.expect("update_authority is not set"), + payer: self.payer.expect("payer is not set"), + metadata: self.metadata.expect("metadata is not set"), + mint: self.mint.expect("mint is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + rent: self.rent, + }; + + accounts.instruction() + } +} + +/// `approve_collection_authority` CPI instruction. +pub struct ApproveCollectionAuthorityCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + /// A Collection Authority + pub new_collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Update Authority of Collection NFT + pub update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of Collection Metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Rent info + pub rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> ApproveCollectionAuthorityCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_authority_record.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.new_collection_authority.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.update_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *rent.key, false, + )); + } + let data = ApproveCollectionAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(8 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.collection_authority_record.clone()); + account_infos.push(self.new_collection_authority.clone()); + account_infos.push(self.update_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.system_program.clone()); + if let Some(rent) = self.rent { + account_infos.push(rent.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `approve_collection_authority` CPI instruction builder. +pub struct ApproveCollectionAuthorityCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> ApproveCollectionAuthorityCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ApproveCollectionAuthorityCpiBuilderInstruction { + __program: program, + collection_authority_record: None, + new_collection_authority: None, + update_authority: None, + payer: None, + metadata: None, + mint: None, + system_program: None, + rent: None, + }); + Self { instruction } + } + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + /// A Collection Authority + #[inline(always)] + pub fn new_collection_authority( + &mut self, + new_collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_collection_authority = Some(new_collection_authority); + self + } + /// Update Authority of Collection NFT + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.update_authority = Some(update_authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Collection Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Mint of Collection Metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.rent = Some(rent); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> ApproveCollectionAuthorityCpi<'a> { + ApproveCollectionAuthorityCpi { + __program: self.instruction.__program, + + collection_authority_record: self + .instruction + .collection_authority_record + .expect("collection_authority_record is not set"), + + new_collection_authority: self + .instruction + .new_collection_authority + .expect("new_collection_authority is not set"), + + update_authority: self + .instruction + .update_authority + .expect("update_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + rent: self.instruction.rent, + } + } +} + +struct ApproveCollectionAuthorityCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_collection_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/approve_use_authority.rs b/clients/rust/src/generated/instructions/approve_use_authority.rs new file mode 100644 index 00000000..371504c8 --- /dev/null +++ b/clients/rust/src/generated/instructions/approve_use_authority.rs @@ -0,0 +1,548 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct ApproveUseAuthority { + /// Use Authority Record PDA + pub use_authority_record: solana_program::pubkey::Pubkey, + /// Owner + pub owner: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// A Use Authority + pub user: solana_program::pubkey::Pubkey, + /// Owned Token Account Of Mint + pub owner_token_account: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Mint of Metadata + pub mint: solana_program::pubkey::Pubkey, + /// Program As Signer (Burner) + pub burner: solana_program::pubkey::Pubkey, + /// Token program + pub token_program: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Rent info + pub rent: Option, +} + +impl ApproveUseAuthority { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: ApproveUseAuthorityInstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new( + self.use_authority_record, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.owner, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.user, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.owner_token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.burner, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + rent, false, + )); + } + let mut data = ApproveUseAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct ApproveUseAuthorityInstructionData { + discriminator: u8, +} + +impl ApproveUseAuthorityInstructionData { + fn new() -> Self { + Self { discriminator: 20 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct ApproveUseAuthorityInstructionArgs { + pub number_of_uses: u64, +} + +/// Instruction builder. +#[derive(Default)] +pub struct ApproveUseAuthorityBuilder { + use_authority_record: Option, + owner: Option, + payer: Option, + user: Option, + owner_token_account: Option, + metadata: Option, + mint: Option, + burner: Option, + token_program: Option, + system_program: Option, + rent: Option, + number_of_uses: Option, +} + +impl ApproveUseAuthorityBuilder { + pub fn new() -> Self { + Self::default() + } + /// Use Authority Record PDA + #[inline(always)] + pub fn use_authority_record( + &mut self, + use_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.use_authority_record = Some(use_authority_record); + self + } + /// Owner + #[inline(always)] + pub fn owner(&mut self, owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.owner = Some(owner); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// A Use Authority + #[inline(always)] + pub fn user(&mut self, user: solana_program::pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + /// Owned Token Account Of Mint + #[inline(always)] + pub fn owner_token_account( + &mut self, + owner_token_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.owner_token_account = Some(owner_token_account); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Mint of Metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Program As Signer (Burner) + #[inline(always)] + pub fn burner(&mut self, burner: solana_program::pubkey::Pubkey) -> &mut Self { + self.burner = Some(burner); + self + } + /// Token program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self { + self.rent = Some(rent); + self + } + #[inline(always)] + pub fn number_of_uses(&mut self, number_of_uses: u64) -> &mut Self { + self.number_of_uses = Some(number_of_uses); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = ApproveUseAuthority { + use_authority_record: self + .use_authority_record + .expect("use_authority_record is not set"), + owner: self.owner.expect("owner is not set"), + payer: self.payer.expect("payer is not set"), + user: self.user.expect("user is not set"), + owner_token_account: self + .owner_token_account + .expect("owner_token_account is not set"), + metadata: self.metadata.expect("metadata is not set"), + mint: self.mint.expect("mint is not set"), + burner: self.burner.expect("burner is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + rent: self.rent, + }; + let args = ApproveUseAuthorityInstructionArgs { + number_of_uses: self + .number_of_uses + .clone() + .expect("number_of_uses is not set"), + }; + + accounts.instruction(args) + } +} + +/// `approve_use_authority` CPI instruction. +pub struct ApproveUseAuthorityCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Use Authority Record PDA + pub use_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + /// Owner + pub owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// A Use Authority + pub user: &'a solana_program::account_info::AccountInfo<'a>, + /// Owned Token Account Of Mint + pub owner_token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of Metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Program As Signer (Burner) + pub burner: &'a solana_program::account_info::AccountInfo<'a>, + /// Token program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Rent info + pub rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: ApproveUseAuthorityInstructionArgs, +} + +impl<'a> ApproveUseAuthorityCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.use_authority_record.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.owner.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.user.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.owner_token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.burner.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *rent.key, false, + )); + } + let mut data = ApproveUseAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.use_authority_record.clone()); + account_infos.push(self.owner.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.owner_token_account.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.burner.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.system_program.clone()); + if let Some(rent) = self.rent { + account_infos.push(rent.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `approve_use_authority` CPI instruction builder. +pub struct ApproveUseAuthorityCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> ApproveUseAuthorityCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ApproveUseAuthorityCpiBuilderInstruction { + __program: program, + use_authority_record: None, + owner: None, + payer: None, + user: None, + owner_token_account: None, + metadata: None, + mint: None, + burner: None, + token_program: None, + system_program: None, + rent: None, + number_of_uses: None, + }); + Self { instruction } + } + /// Use Authority Record PDA + #[inline(always)] + pub fn use_authority_record( + &mut self, + use_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.use_authority_record = Some(use_authority_record); + self + } + /// Owner + #[inline(always)] + pub fn owner(&mut self, owner: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.owner = Some(owner); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// A Use Authority + #[inline(always)] + pub fn user(&mut self, user: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + /// Owned Token Account Of Mint + #[inline(always)] + pub fn owner_token_account( + &mut self, + owner_token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.owner_token_account = Some(owner_token_account); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Mint of Metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Program As Signer (Burner) + #[inline(always)] + pub fn burner( + &mut self, + burner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.burner = Some(burner); + self + } + /// Token program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.rent = Some(rent); + self + } + #[inline(always)] + pub fn number_of_uses(&mut self, number_of_uses: u64) -> &mut Self { + self.instruction.number_of_uses = Some(number_of_uses); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> ApproveUseAuthorityCpi<'a> { + let args = ApproveUseAuthorityInstructionArgs { + number_of_uses: self + .instruction + .number_of_uses + .clone() + .expect("number_of_uses is not set"), + }; + + ApproveUseAuthorityCpi { + __program: self.instruction.__program, + + use_authority_record: self + .instruction + .use_authority_record + .expect("use_authority_record is not set"), + + owner: self.instruction.owner.expect("owner is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + user: self.instruction.user.expect("user is not set"), + + owner_token_account: self + .instruction + .owner_token_account + .expect("owner_token_account is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + burner: self.instruction.burner.expect("burner is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + rent: self.instruction.rent, + __args: args, + } + } +} + +struct ApproveUseAuthorityCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + use_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + user: Option<&'a solana_program::account_info::AccountInfo<'a>>, + owner_token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + burner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + number_of_uses: Option, +} diff --git a/clients/rust/src/generated/instructions/bubblegum_set_collection_size.rs b/clients/rust/src/generated/instructions/bubblegum_set_collection_size.rs new file mode 100644 index 00000000..135df73d --- /dev/null +++ b/clients/rust/src/generated/instructions/bubblegum_set_collection_size.rs @@ -0,0 +1,377 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::SetCollectionSizeArgs; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct BubblegumSetCollectionSize { + /// Collection Metadata account + pub collection_metadata: solana_program::pubkey::Pubkey, + /// Collection Update authority + pub collection_authority: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Signing PDA of Bubblegum program + pub bubblegum_signer: solana_program::pubkey::Pubkey, + /// Collection Authority Record PDA + pub collection_authority_record: Option, +} + +impl BubblegumSetCollectionSize { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: BubblegumSetCollectionSizeInstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(5); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.bubblegum_signer, + true, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_authority_record, + false, + )); + } + let mut data = BubblegumSetCollectionSizeInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct BubblegumSetCollectionSizeInstructionData { + discriminator: u8, +} + +impl BubblegumSetCollectionSizeInstructionData { + fn new() -> Self { + Self { discriminator: 36 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct BubblegumSetCollectionSizeInstructionArgs { + pub set_collection_size_args: SetCollectionSizeArgs, +} + +/// Instruction builder. +#[derive(Default)] +pub struct BubblegumSetCollectionSizeBuilder { + collection_metadata: Option, + collection_authority: Option, + collection_mint: Option, + bubblegum_signer: Option, + collection_authority_record: Option, + set_collection_size_args: Option, +} + +impl BubblegumSetCollectionSizeBuilder { + pub fn new() -> Self { + Self::default() + } + /// Collection Metadata account + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority = Some(collection_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// Signing PDA of Bubblegum program + #[inline(always)] + pub fn bubblegum_signer( + &mut self, + bubblegum_signer: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.bubblegum_signer = Some(bubblegum_signer); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + #[inline(always)] + pub fn set_collection_size_args( + &mut self, + set_collection_size_args: SetCollectionSizeArgs, + ) -> &mut Self { + self.set_collection_size_args = Some(set_collection_size_args); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = BubblegumSetCollectionSize { + collection_metadata: self + .collection_metadata + .expect("collection_metadata is not set"), + collection_authority: self + .collection_authority + .expect("collection_authority is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + bubblegum_signer: self.bubblegum_signer.expect("bubblegum_signer is not set"), + collection_authority_record: self.collection_authority_record, + }; + let args = BubblegumSetCollectionSizeInstructionArgs { + set_collection_size_args: self + .set_collection_size_args + .clone() + .expect("set_collection_size_args is not set"), + }; + + accounts.instruction(args) + } +} + +/// `bubblegum_set_collection_size` CPI instruction. +pub struct BubblegumSetCollectionSizeCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Metadata account + pub collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Update authority + pub collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Signing PDA of Bubblegum program + pub bubblegum_signer: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: BubblegumSetCollectionSizeInstructionArgs, +} + +impl<'a> BubblegumSetCollectionSizeCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(5); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.bubblegum_signer.key, + true, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_authority_record.key, + false, + )); + } + let mut data = BubblegumSetCollectionSizeInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.collection_metadata.clone()); + account_infos.push(self.collection_authority.clone()); + account_infos.push(self.collection_mint.clone()); + account_infos.push(self.bubblegum_signer.clone()); + if let Some(collection_authority_record) = self.collection_authority_record { + account_infos.push(collection_authority_record.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `bubblegum_set_collection_size` CPI instruction builder. +pub struct BubblegumSetCollectionSizeCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> BubblegumSetCollectionSizeCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(BubblegumSetCollectionSizeCpiBuilderInstruction { + __program: program, + collection_metadata: None, + collection_authority: None, + collection_mint: None, + bubblegum_signer: None, + collection_authority_record: None, + set_collection_size_args: None, + }); + Self { instruction } + } + /// Collection Metadata account + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority = Some(collection_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// Signing PDA of Bubblegum program + #[inline(always)] + pub fn bubblegum_signer( + &mut self, + bubblegum_signer: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.bubblegum_signer = Some(bubblegum_signer); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + #[inline(always)] + pub fn set_collection_size_args( + &mut self, + set_collection_size_args: SetCollectionSizeArgs, + ) -> &mut Self { + self.instruction.set_collection_size_args = Some(set_collection_size_args); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> BubblegumSetCollectionSizeCpi<'a> { + let args = BubblegumSetCollectionSizeInstructionArgs { + set_collection_size_args: self + .instruction + .set_collection_size_args + .clone() + .expect("set_collection_size_args is not set"), + }; + + BubblegumSetCollectionSizeCpi { + __program: self.instruction.__program, + + collection_metadata: self + .instruction + .collection_metadata + .expect("collection_metadata is not set"), + + collection_authority: self + .instruction + .collection_authority + .expect("collection_authority is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + bubblegum_signer: self + .instruction + .bubblegum_signer + .expect("bubblegum_signer is not set"), + + collection_authority_record: self.instruction.collection_authority_record, + __args: args, + } + } +} + +struct BubblegumSetCollectionSizeCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + bubblegum_signer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + set_collection_size_args: Option, +} diff --git a/clients/rust/src/generated/instructions/burn_edition_nft.rs b/clients/rust/src/generated/instructions/burn_edition_nft.rs new file mode 100644 index 00000000..2a63927f --- /dev/null +++ b/clients/rust/src/generated/instructions/burn_edition_nft.rs @@ -0,0 +1,515 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct BurnEditionNft { + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// NFT owner + pub owner: solana_program::pubkey::Pubkey, + /// Mint of the print edition NFT + pub print_edition_mint: solana_program::pubkey::Pubkey, + /// Mint of the original/master NFT + pub master_edition_mint: solana_program::pubkey::Pubkey, + /// Token account the print edition NFT is in + pub print_edition_token_account: solana_program::pubkey::Pubkey, + /// Token account the Master Edition NFT is in + pub master_edition_token_account: solana_program::pubkey::Pubkey, + /// MasterEdition2 of the original NFT + pub master_edition_account: solana_program::pubkey::Pubkey, + /// Print Edition account of the NFT + pub print_edition_account: solana_program::pubkey::Pubkey, + /// Edition Marker PDA of the NFT + pub edition_marker_account: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: solana_program::pubkey::Pubkey, +} + +impl BurnEditionNft { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(10); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.owner, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.print_edition_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.master_edition_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.print_edition_token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.master_edition_token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.master_edition_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.print_edition_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition_marker_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_token_program, + false, + )); + let data = BurnEditionNftInstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct BurnEditionNftInstructionData { + discriminator: u8, +} + +impl BurnEditionNftInstructionData { + fn new() -> Self { + Self { discriminator: 37 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct BurnEditionNftBuilder { + metadata: Option, + owner: Option, + print_edition_mint: Option, + master_edition_mint: Option, + print_edition_token_account: Option, + master_edition_token_account: Option, + master_edition_account: Option, + print_edition_account: Option, + edition_marker_account: Option, + spl_token_program: Option, +} + +impl BurnEditionNftBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// NFT owner + #[inline(always)] + pub fn owner(&mut self, owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.owner = Some(owner); + self + } + /// Mint of the print edition NFT + #[inline(always)] + pub fn print_edition_mint( + &mut self, + print_edition_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.print_edition_mint = Some(print_edition_mint); + self + } + /// Mint of the original/master NFT + #[inline(always)] + pub fn master_edition_mint( + &mut self, + master_edition_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_edition_mint = Some(master_edition_mint); + self + } + /// Token account the print edition NFT is in + #[inline(always)] + pub fn print_edition_token_account( + &mut self, + print_edition_token_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.print_edition_token_account = Some(print_edition_token_account); + self + } + /// Token account the Master Edition NFT is in + #[inline(always)] + pub fn master_edition_token_account( + &mut self, + master_edition_token_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_edition_token_account = Some(master_edition_token_account); + self + } + /// MasterEdition2 of the original NFT + #[inline(always)] + pub fn master_edition_account( + &mut self, + master_edition_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_edition_account = Some(master_edition_account); + self + } + /// Print Edition account of the NFT + #[inline(always)] + pub fn print_edition_account( + &mut self, + print_edition_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.print_edition_account = Some(print_edition_account); + self + } + /// Edition Marker PDA of the NFT + #[inline(always)] + pub fn edition_marker_account( + &mut self, + edition_marker_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.edition_marker_account = Some(edition_marker_account); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = BurnEditionNft { + metadata: self.metadata.expect("metadata is not set"), + owner: self.owner.expect("owner is not set"), + print_edition_mint: self + .print_edition_mint + .expect("print_edition_mint is not set"), + master_edition_mint: self + .master_edition_mint + .expect("master_edition_mint is not set"), + print_edition_token_account: self + .print_edition_token_account + .expect("print_edition_token_account is not set"), + master_edition_token_account: self + .master_edition_token_account + .expect("master_edition_token_account is not set"), + master_edition_account: self + .master_edition_account + .expect("master_edition_account is not set"), + print_edition_account: self + .print_edition_account + .expect("print_edition_account is not set"), + edition_marker_account: self + .edition_marker_account + .expect("edition_marker_account is not set"), + spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + }; + + accounts.instruction() + } +} + +/// `burn_edition_nft` CPI instruction. +pub struct BurnEditionNftCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// NFT owner + pub owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the print edition NFT + pub print_edition_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the original/master NFT + pub master_edition_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account the print edition NFT is in + pub print_edition_token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account the Master Edition NFT is in + pub master_edition_token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// MasterEdition2 of the original NFT + pub master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Print Edition account of the NFT + pub print_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition Marker PDA of the NFT + pub edition_marker_account: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> BurnEditionNftCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(10); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.owner.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.print_edition_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.master_edition_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.print_edition_token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.master_edition_token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.master_edition_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.print_edition_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition_marker_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_token_program.key, + false, + )); + let data = BurnEditionNftInstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(10 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.owner.clone()); + account_infos.push(self.print_edition_mint.clone()); + account_infos.push(self.master_edition_mint.clone()); + account_infos.push(self.print_edition_token_account.clone()); + account_infos.push(self.master_edition_token_account.clone()); + account_infos.push(self.master_edition_account.clone()); + account_infos.push(self.print_edition_account.clone()); + account_infos.push(self.edition_marker_account.clone()); + account_infos.push(self.spl_token_program.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `burn_edition_nft` CPI instruction builder. +pub struct BurnEditionNftCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> BurnEditionNftCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(BurnEditionNftCpiBuilderInstruction { + __program: program, + metadata: None, + owner: None, + print_edition_mint: None, + master_edition_mint: None, + print_edition_token_account: None, + master_edition_token_account: None, + master_edition_account: None, + print_edition_account: None, + edition_marker_account: None, + spl_token_program: None, + }); + Self { instruction } + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// NFT owner + #[inline(always)] + pub fn owner(&mut self, owner: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.owner = Some(owner); + self + } + /// Mint of the print edition NFT + #[inline(always)] + pub fn print_edition_mint( + &mut self, + print_edition_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.print_edition_mint = Some(print_edition_mint); + self + } + /// Mint of the original/master NFT + #[inline(always)] + pub fn master_edition_mint( + &mut self, + master_edition_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition_mint = Some(master_edition_mint); + self + } + /// Token account the print edition NFT is in + #[inline(always)] + pub fn print_edition_token_account( + &mut self, + print_edition_token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.print_edition_token_account = Some(print_edition_token_account); + self + } + /// Token account the Master Edition NFT is in + #[inline(always)] + pub fn master_edition_token_account( + &mut self, + master_edition_token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition_token_account = Some(master_edition_token_account); + self + } + /// MasterEdition2 of the original NFT + #[inline(always)] + pub fn master_edition_account( + &mut self, + master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition_account = Some(master_edition_account); + self + } + /// Print Edition account of the NFT + #[inline(always)] + pub fn print_edition_account( + &mut self, + print_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.print_edition_account = Some(print_edition_account); + self + } + /// Edition Marker PDA of the NFT + #[inline(always)] + pub fn edition_marker_account( + &mut self, + edition_marker_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_marker_account = Some(edition_marker_account); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> BurnEditionNftCpi<'a> { + BurnEditionNftCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + owner: self.instruction.owner.expect("owner is not set"), + + print_edition_mint: self + .instruction + .print_edition_mint + .expect("print_edition_mint is not set"), + + master_edition_mint: self + .instruction + .master_edition_mint + .expect("master_edition_mint is not set"), + + print_edition_token_account: self + .instruction + .print_edition_token_account + .expect("print_edition_token_account is not set"), + + master_edition_token_account: self + .instruction + .master_edition_token_account + .expect("master_edition_token_account is not set"), + + master_edition_account: self + .instruction + .master_edition_account + .expect("master_edition_account is not set"), + + print_edition_account: self + .instruction + .print_edition_account + .expect("print_edition_account is not set"), + + edition_marker_account: self + .instruction + .edition_marker_account + .expect("edition_marker_account is not set"), + + spl_token_program: self + .instruction + .spl_token_program + .expect("spl_token_program is not set"), + } + } +} + +struct BurnEditionNftCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + print_edition_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + print_edition_token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition_token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + print_edition_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_marker_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/burn_nft.rs b/clients/rust/src/generated/instructions/burn_nft.rs new file mode 100644 index 00000000..3aeea0e6 --- /dev/null +++ b/clients/rust/src/generated/instructions/burn_nft.rs @@ -0,0 +1,375 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct BurnNft { + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// NFT owner + pub owner: solana_program::pubkey::Pubkey, + /// Mint of the NFT + pub mint: solana_program::pubkey::Pubkey, + /// Token account to close + pub token_account: solana_program::pubkey::Pubkey, + /// MasterEdition2 of the NFT + pub master_edition_account: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: solana_program::pubkey::Pubkey, + /// Metadata of the Collection + pub collection_metadata: Option, +} + +impl BurnNft { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.owner, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.master_edition_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_token_program, + false, + )); + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + collection_metadata, + false, + )); + } + let data = BurnNftInstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct BurnNftInstructionData { + discriminator: u8, +} + +impl BurnNftInstructionData { + fn new() -> Self { + Self { discriminator: 29 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct BurnNftBuilder { + metadata: Option, + owner: Option, + mint: Option, + token_account: Option, + master_edition_account: Option, + spl_token_program: Option, + collection_metadata: Option, +} + +impl BurnNftBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// NFT owner + #[inline(always)] + pub fn owner(&mut self, owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.owner = Some(owner); + self + } + /// Mint of the NFT + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account to close + #[inline(always)] + pub fn token_account(&mut self, token_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_account = Some(token_account); + self + } + /// MasterEdition2 of the NFT + #[inline(always)] + pub fn master_edition_account( + &mut self, + master_edition_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_edition_account = Some(master_edition_account); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Metadata of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = BurnNft { + metadata: self.metadata.expect("metadata is not set"), + owner: self.owner.expect("owner is not set"), + mint: self.mint.expect("mint is not set"), + token_account: self.token_account.expect("token_account is not set"), + master_edition_account: self + .master_edition_account + .expect("master_edition_account is not set"), + spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + collection_metadata: self.collection_metadata, + }; + + accounts.instruction() + } +} + +/// `burn_nft` CPI instruction. +pub struct BurnNftCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// NFT owner + pub owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the NFT + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account to close + pub token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// MasterEdition2 of the NFT + pub master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata of the Collection + pub collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> BurnNftCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.owner.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.master_edition_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_token_program.key, + false, + )); + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + *collection_metadata.key, + false, + )); + } + let data = BurnNftInstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.owner.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.token_account.clone()); + account_infos.push(self.master_edition_account.clone()); + account_infos.push(self.spl_token_program.clone()); + if let Some(collection_metadata) = self.collection_metadata { + account_infos.push(collection_metadata.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `burn_nft` CPI instruction builder. +pub struct BurnNftCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> BurnNftCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(BurnNftCpiBuilderInstruction { + __program: program, + metadata: None, + owner: None, + mint: None, + token_account: None, + master_edition_account: None, + spl_token_program: None, + collection_metadata: None, + }); + Self { instruction } + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// NFT owner + #[inline(always)] + pub fn owner(&mut self, owner: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.owner = Some(owner); + self + } + /// Mint of the NFT + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account to close + #[inline(always)] + pub fn token_account( + &mut self, + token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_account = Some(token_account); + self + } + /// MasterEdition2 of the NFT + #[inline(always)] + pub fn master_edition_account( + &mut self, + master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition_account = Some(master_edition_account); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Metadata of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> BurnNftCpi<'a> { + BurnNftCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + owner: self.instruction.owner.expect("owner is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + token_account: self + .instruction + .token_account + .expect("token_account is not set"), + + master_edition_account: self + .instruction + .master_edition_account + .expect("master_edition_account is not set"), + + spl_token_program: self + .instruction + .spl_token_program + .expect("spl_token_program is not set"), + + collection_metadata: self.instruction.collection_metadata, + } + } +} + +struct BurnNftCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/burn_v1.rs b/clients/rust/src/generated/instructions/burn_v1.rs new file mode 100644 index 00000000..47b3216d --- /dev/null +++ b/clients/rust/src/generated/instructions/burn_v1.rs @@ -0,0 +1,779 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct BurnV1 { + /// Asset owner or Utility delegate + pub authority: solana_program::pubkey::Pubkey, + /// Metadata of the Collection + pub collection_metadata: Option, + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// Edition of the asset + pub edition: Option, + /// Mint of token asset + pub mint: solana_program::pubkey::Pubkey, + /// Token account to close + pub token: solana_program::pubkey::Pubkey, + /// Master edition account + pub master_edition: Option, + /// Master edition mint of the asset + pub master_edition_mint: Option, + /// Master edition token account + pub master_edition_token: Option, + /// Edition marker account + pub edition_marker: Option, + /// Token record account + pub token_record: Option, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: solana_program::pubkey::Pubkey, +} + +impl BurnV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: BurnV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + accounts.push(solana_program::instruction::AccountMeta::new( + self.authority, + true, + )); + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + collection_metadata, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(master_edition_mint) = self.master_edition_mint { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition_mint, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(master_edition_token) = self.master_edition_token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition_token, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(edition_marker) = self.edition_marker { + accounts.push(solana_program::instruction::AccountMeta::new( + edition_marker, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_token_program, + false, + )); + let mut data = BurnV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct BurnV1InstructionData { + discriminator: u8, + burn_v1_discriminator: u8, +} + +impl BurnV1InstructionData { + fn new() -> Self { + Self { + discriminator: 41, + burn_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct BurnV1InstructionArgs { + pub amount: u64, +} + +/// Instruction builder. +#[derive(Default)] +pub struct BurnV1Builder { + authority: Option, + collection_metadata: Option, + metadata: Option, + edition: Option, + mint: Option, + token: Option, + master_edition: Option, + master_edition_mint: Option, + master_edition_token: Option, + edition_marker: Option, + token_record: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + amount: Option, +} + +impl BurnV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Asset owner or Utility delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Metadata of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition of the asset + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account to close + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// `[optional account]` + /// Master edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Master edition mint of the asset + #[inline(always)] + pub fn master_edition_mint( + &mut self, + master_edition_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_edition_mint = Some(master_edition_mint); + self + } + /// `[optional account]` + /// Master edition token account + #[inline(always)] + pub fn master_edition_token( + &mut self, + master_edition_token: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_edition_token = Some(master_edition_token); + self + } + /// `[optional account]` + /// Edition marker account + #[inline(always)] + pub fn edition_marker(&mut self, edition_marker: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition_marker = Some(edition_marker); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = BurnV1 { + authority: self.authority.expect("authority is not set"), + collection_metadata: self.collection_metadata, + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + master_edition: self.master_edition, + master_edition_mint: self.master_edition_mint, + master_edition_token: self.master_edition_token, + edition_marker: self.edition_marker, + token_record: self.token_record, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + }; + let args = BurnV1InstructionArgs { + amount: self.amount.clone().unwrap_or(1), + }; + + accounts.instruction(args) + } +} + +/// `burn_v1` CPI instruction. +pub struct BurnV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Asset owner or Utility delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata of the Collection + pub collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition of the asset + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of token asset + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account to close + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Master edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Master edition mint of the asset + pub master_edition_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Master edition token account + pub master_edition_token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Edition marker account + pub edition_marker: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: BurnV1InstructionArgs, +} + +impl<'a> BurnV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.authority.key, + true, + )); + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + *collection_metadata.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(master_edition_mint) = self.master_edition_mint { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition_mint.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(master_edition_token) = self.master_edition_token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition_token.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(edition_marker) = self.edition_marker { + accounts.push(solana_program::instruction::AccountMeta::new( + *edition_marker.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_token_program.key, + false, + )); + let mut data = BurnV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(collection_metadata) = self.collection_metadata { + account_infos.push(collection_metadata.clone()); + } + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(master_edition_mint) = self.master_edition_mint { + account_infos.push(master_edition_mint.clone()); + } + if let Some(master_edition_token) = self.master_edition_token { + account_infos.push(master_edition_token.clone()); + } + if let Some(edition_marker) = self.edition_marker { + account_infos.push(edition_marker.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + account_infos.push(self.spl_token_program.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `burn_v1` CPI instruction builder. +pub struct BurnV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> BurnV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(BurnV1CpiBuilderInstruction { + __program: program, + authority: None, + collection_metadata: None, + metadata: None, + edition: None, + mint: None, + token: None, + master_edition: None, + master_edition_mint: None, + master_edition_token: None, + edition_marker: None, + token_record: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + amount: None, + }); + Self { instruction } + } + /// Asset owner or Utility delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Metadata of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition of the asset + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account to close + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// `[optional account]` + /// Master edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Master edition mint of the asset + #[inline(always)] + pub fn master_edition_mint( + &mut self, + master_edition_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition_mint = Some(master_edition_mint); + self + } + /// `[optional account]` + /// Master edition token account + #[inline(always)] + pub fn master_edition_token( + &mut self, + master_edition_token: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition_token = Some(master_edition_token); + self + } + /// `[optional account]` + /// Edition marker account + #[inline(always)] + pub fn edition_marker( + &mut self, + edition_marker: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_marker = Some(edition_marker); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> BurnV1Cpi<'a> { + let args = BurnV1InstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + }; + + BurnV1Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + collection_metadata: self.instruction.collection_metadata, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + master_edition: self.instruction.master_edition, + + master_edition_mint: self.instruction.master_edition_mint, + + master_edition_token: self.instruction.master_edition_token, + + edition_marker: self.instruction.edition_marker, + + token_record: self.instruction.token_record, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self + .instruction + .spl_token_program + .expect("spl_token_program is not set"), + __args: args, + } + } +} + +struct BurnV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition_token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_marker: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, +} diff --git a/clients/rust/src/generated/instructions/close_escrow_account.rs b/clients/rust/src/generated/instructions/close_escrow_account.rs new file mode 100644 index 00000000..5cc745dc --- /dev/null +++ b/clients/rust/src/generated/instructions/close_escrow_account.rs @@ -0,0 +1,399 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct CloseEscrowAccount { + /// Escrow account + pub escrow: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Token account + pub token_account: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: solana_program::pubkey::Pubkey, + /// Wallet paying for the transaction and new account + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, +} + +impl CloseEscrowAccount { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new( + self.escrow, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + let data = CloseEscrowAccountInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct CloseEscrowAccountInstructionData { + discriminator: u8, +} + +impl CloseEscrowAccountInstructionData { + fn new() -> Self { + Self { discriminator: 39 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct CloseEscrowAccountBuilder { + escrow: Option, + metadata: Option, + mint: Option, + token_account: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, +} + +impl CloseEscrowAccountBuilder { + pub fn new() -> Self { + Self::default() + } + /// Escrow account + #[inline(always)] + pub fn escrow(&mut self, escrow: solana_program::pubkey::Pubkey) -> &mut Self { + self.escrow = Some(escrow); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account + #[inline(always)] + pub fn token_account(&mut self, token_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_account = Some(token_account); + self + } + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Wallet paying for the transaction and new account + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = CloseEscrowAccount { + escrow: self.escrow.expect("escrow is not set"), + metadata: self.metadata.expect("metadata is not set"), + mint: self.mint.expect("mint is not set"), + token_account: self.token_account.expect("token_account is not set"), + edition: self.edition.expect("edition is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + }; + + accounts.instruction() + } +} + +/// `close_escrow_account` CPI instruction. +pub struct CloseEscrowAccountCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Escrow account + pub escrow: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account + pub token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Wallet paying for the transaction and new account + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> CloseEscrowAccountCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.escrow.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + let data = CloseEscrowAccountInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(8 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.escrow.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.token_account.clone()); + account_infos.push(self.edition.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `close_escrow_account` CPI instruction builder. +pub struct CloseEscrowAccountCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> CloseEscrowAccountCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CloseEscrowAccountCpiBuilderInstruction { + __program: program, + escrow: None, + metadata: None, + mint: None, + token_account: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + }); + Self { instruction } + } + /// Escrow account + #[inline(always)] + pub fn escrow( + &mut self, + escrow: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.escrow = Some(escrow); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account + #[inline(always)] + pub fn token_account( + &mut self, + token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_account = Some(token_account); + self + } + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Wallet paying for the transaction and new account + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> CloseEscrowAccountCpi<'a> { + CloseEscrowAccountCpi { + __program: self.instruction.__program, + + escrow: self.instruction.escrow.expect("escrow is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + token_account: self + .instruction + .token_account + .expect("token_account is not set"), + + edition: self.instruction.edition.expect("edition is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + } + } +} + +struct CloseEscrowAccountCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + escrow: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/collect.rs b/clients/rust/src/generated/instructions/collect.rs new file mode 100644 index 00000000..285a7742 --- /dev/null +++ b/clients/rust/src/generated/instructions/collect.rs @@ -0,0 +1,186 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct Collect { + /// Authority to collect fees + pub authority: solana_program::pubkey::Pubkey, + /// PDA to retrieve fees from + pub pda_account: solana_program::pubkey::Pubkey, +} + +impl Collect { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(2); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.pda_account, + false, + )); + let data = CollectInstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct CollectInstructionData { + discriminator: u8, +} + +impl CollectInstructionData { + fn new() -> Self { + Self { discriminator: 54 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct CollectBuilder { + authority: Option, + pda_account: Option, +} + +impl CollectBuilder { + pub fn new() -> Self { + Self::default() + } + /// Authority to collect fees + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// PDA to retrieve fees from + #[inline(always)] + pub fn pda_account(&mut self, pda_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.pda_account = Some(pda_account); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = Collect { + authority: self.authority.expect("authority is not set"), + pda_account: self.pda_account.expect("pda_account is not set"), + }; + + accounts.instruction() + } +} + +/// `collect` CPI instruction. +pub struct CollectCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Authority to collect fees + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// PDA to retrieve fees from + pub pda_account: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> CollectCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(2); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.pda_account.key, + false, + )); + let data = CollectInstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(2 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.pda_account.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `collect` CPI instruction builder. +pub struct CollectCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> CollectCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CollectCpiBuilderInstruction { + __program: program, + authority: None, + pda_account: None, + }); + Self { instruction } + } + /// Authority to collect fees + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// PDA to retrieve fees from + #[inline(always)] + pub fn pda_account( + &mut self, + pda_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.pda_account = Some(pda_account); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> CollectCpi<'a> { + CollectCpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + pda_account: self + .instruction + .pda_account + .expect("pda_account is not set"), + } + } +} + +struct CollectCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + pda_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/convert_master_edition_v1_to_v2.rs b/clients/rust/src/generated/instructions/convert_master_edition_v1_to_v2.rs new file mode 100644 index 00000000..617394f9 --- /dev/null +++ b/clients/rust/src/generated/instructions/convert_master_edition_v1_to_v2.rs @@ -0,0 +1,230 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct ConvertMasterEditionV1ToV2 { + /// Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition']) + pub master_edition: solana_program::pubkey::Pubkey, + /// One time authorization mint + pub one_time_auth: solana_program::pubkey::Pubkey, + /// Printing mint + pub printing_mint: solana_program::pubkey::Pubkey, +} + +impl ConvertMasterEditionV1ToV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(3); + accounts.push(solana_program::instruction::AccountMeta::new( + self.master_edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.one_time_auth, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.printing_mint, + false, + )); + let data = ConvertMasterEditionV1ToV2InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct ConvertMasterEditionV1ToV2InstructionData { + discriminator: u8, +} + +impl ConvertMasterEditionV1ToV2InstructionData { + fn new() -> Self { + Self { discriminator: 12 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct ConvertMasterEditionV1ToV2Builder { + master_edition: Option, + one_time_auth: Option, + printing_mint: Option, +} + +impl ConvertMasterEditionV1ToV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition']) + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// One time authorization mint + #[inline(always)] + pub fn one_time_auth(&mut self, one_time_auth: solana_program::pubkey::Pubkey) -> &mut Self { + self.one_time_auth = Some(one_time_auth); + self + } + /// Printing mint + #[inline(always)] + pub fn printing_mint(&mut self, printing_mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.printing_mint = Some(printing_mint); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = ConvertMasterEditionV1ToV2 { + master_edition: self.master_edition.expect("master_edition is not set"), + one_time_auth: self.one_time_auth.expect("one_time_auth is not set"), + printing_mint: self.printing_mint.expect("printing_mint is not set"), + }; + + accounts.instruction() + } +} + +/// `convert_master_edition_v1_to_v2` CPI instruction. +pub struct ConvertMasterEditionV1ToV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition']) + pub master_edition: &'a solana_program::account_info::AccountInfo<'a>, + /// One time authorization mint + pub one_time_auth: &'a solana_program::account_info::AccountInfo<'a>, + /// Printing mint + pub printing_mint: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> ConvertMasterEditionV1ToV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(3); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.master_edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.one_time_auth.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.printing_mint.key, + false, + )); + let data = ConvertMasterEditionV1ToV2InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(3 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.master_edition.clone()); + account_infos.push(self.one_time_auth.clone()); + account_infos.push(self.printing_mint.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `convert_master_edition_v1_to_v2` CPI instruction builder. +pub struct ConvertMasterEditionV1ToV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> ConvertMasterEditionV1ToV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ConvertMasterEditionV1ToV2CpiBuilderInstruction { + __program: program, + master_edition: None, + one_time_auth: None, + printing_mint: None, + }); + Self { instruction } + } + /// Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition']) + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// One time authorization mint + #[inline(always)] + pub fn one_time_auth( + &mut self, + one_time_auth: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.one_time_auth = Some(one_time_auth); + self + } + /// Printing mint + #[inline(always)] + pub fn printing_mint( + &mut self, + printing_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.printing_mint = Some(printing_mint); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> ConvertMasterEditionV1ToV2Cpi<'a> { + ConvertMasterEditionV1ToV2Cpi { + __program: self.instruction.__program, + + master_edition: self + .instruction + .master_edition + .expect("master_edition is not set"), + + one_time_auth: self + .instruction + .one_time_auth + .expect("one_time_auth is not set"), + + printing_mint: self + .instruction + .printing_mint + .expect("printing_mint is not set"), + } + } +} + +struct ConvertMasterEditionV1ToV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + one_time_auth: Option<&'a solana_program::account_info::AccountInfo<'a>>, + printing_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/create_escrow_account.rs b/clients/rust/src/generated/instructions/create_escrow_account.rs new file mode 100644 index 00000000..f72d4542 --- /dev/null +++ b/clients/rust/src/generated/instructions/create_escrow_account.rs @@ -0,0 +1,440 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct CreateEscrowAccount { + /// Escrow account + pub escrow: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Token account of the token + pub token_account: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: solana_program::pubkey::Pubkey, + /// Wallet paying for the transaction and new account + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Authority/creator of the escrow account + pub authority: Option, +} + +impl CreateEscrowAccount { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(9); + accounts.push(solana_program::instruction::AccountMeta::new( + self.escrow, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authority, true, + )); + } + let data = CreateEscrowAccountInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct CreateEscrowAccountInstructionData { + discriminator: u8, +} + +impl CreateEscrowAccountInstructionData { + fn new() -> Self { + Self { discriminator: 38 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct CreateEscrowAccountBuilder { + escrow: Option, + metadata: Option, + mint: Option, + token_account: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authority: Option, +} + +impl CreateEscrowAccountBuilder { + pub fn new() -> Self { + Self::default() + } + /// Escrow account + #[inline(always)] + pub fn escrow(&mut self, escrow: solana_program::pubkey::Pubkey) -> &mut Self { + self.escrow = Some(escrow); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of the token + #[inline(always)] + pub fn token_account(&mut self, token_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_account = Some(token_account); + self + } + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Wallet paying for the transaction and new account + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Authority/creator of the escrow account + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = CreateEscrowAccount { + escrow: self.escrow.expect("escrow is not set"), + metadata: self.metadata.expect("metadata is not set"), + mint: self.mint.expect("mint is not set"), + token_account: self.token_account.expect("token_account is not set"), + edition: self.edition.expect("edition is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authority: self.authority, + }; + + accounts.instruction() + } +} + +/// `create_escrow_account` CPI instruction. +pub struct CreateEscrowAccountCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Escrow account + pub escrow: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of the token + pub token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Wallet paying for the transaction and new account + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Authority/creator of the escrow account + pub authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> CreateEscrowAccountCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(9); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.escrow.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authority.key, + true, + )); + } + let data = CreateEscrowAccountInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(9 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.escrow.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.token_account.clone()); + account_infos.push(self.edition.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authority) = self.authority { + account_infos.push(authority.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `create_escrow_account` CPI instruction builder. +pub struct CreateEscrowAccountCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> CreateEscrowAccountCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CreateEscrowAccountCpiBuilderInstruction { + __program: program, + escrow: None, + metadata: None, + mint: None, + token_account: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authority: None, + }); + Self { instruction } + } + /// Escrow account + #[inline(always)] + pub fn escrow( + &mut self, + escrow: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.escrow = Some(escrow); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of the token + #[inline(always)] + pub fn token_account( + &mut self, + token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_account = Some(token_account); + self + } + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Wallet paying for the transaction and new account + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Authority/creator of the escrow account + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> CreateEscrowAccountCpi<'a> { + CreateEscrowAccountCpi { + __program: self.instruction.__program, + + escrow: self.instruction.escrow.expect("escrow is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + token_account: self + .instruction + .token_account + .expect("token_account is not set"), + + edition: self.instruction.edition.expect("edition is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authority: self.instruction.authority, + } + } +} + +struct CreateEscrowAccountCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + escrow: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/create_master_edition_v3.rs b/clients/rust/src/generated/instructions/create_master_edition_v3.rs new file mode 100644 index 00000000..b7345e68 --- /dev/null +++ b/clients/rust/src/generated/instructions/create_master_edition_v3.rs @@ -0,0 +1,476 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct CreateMasterEditionV3 { + /// Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition'] + pub edition: solana_program::pubkey::Pubkey, + /// Metadata mint + pub mint: solana_program::pubkey::Pubkey, + /// Update authority + pub update_authority: solana_program::pubkey::Pubkey, + /// Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub mint_authority: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Token program + pub token_program: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Rent info + pub rent: Option, +} + +impl CreateMasterEditionV3 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: CreateMasterEditionV3InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(9); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.update_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + rent, false, + )); + } + let mut data = CreateMasterEditionV3InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct CreateMasterEditionV3InstructionData { + discriminator: u8, +} + +impl CreateMasterEditionV3InstructionData { + fn new() -> Self { + Self { discriminator: 17 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct CreateMasterEditionV3InstructionArgs { + pub max_supply: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct CreateMasterEditionV3Builder { + edition: Option, + mint: Option, + update_authority: Option, + mint_authority: Option, + payer: Option, + metadata: Option, + token_program: Option, + system_program: Option, + rent: Option, + max_supply: Option, +} + +impl CreateMasterEditionV3Builder { + pub fn new() -> Self { + Self::default() + } + /// Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition'] + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Metadata mint + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Update authority + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.update_authority = Some(update_authority); + self + } + /// Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn mint_authority(&mut self, mint_authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint_authority = Some(mint_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self { + self.rent = Some(rent); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn max_supply(&mut self, max_supply: u64) -> &mut Self { + self.max_supply = Some(max_supply); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = CreateMasterEditionV3 { + edition: self.edition.expect("edition is not set"), + mint: self.mint.expect("mint is not set"), + update_authority: self.update_authority.expect("update_authority is not set"), + mint_authority: self.mint_authority.expect("mint_authority is not set"), + payer: self.payer.expect("payer is not set"), + metadata: self.metadata.expect("metadata is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + rent: self.rent, + }; + let args = CreateMasterEditionV3InstructionArgs { + max_supply: self.max_supply.clone(), + }; + + accounts.instruction(args) + } +} + +/// `create_master_edition_v3` CPI instruction. +pub struct CreateMasterEditionV3Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition'] + pub edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata mint + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority + pub update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Token program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Rent info + pub rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: CreateMasterEditionV3InstructionArgs, +} + +impl<'a> CreateMasterEditionV3Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(9); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.update_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *rent.key, false, + )); + } + let mut data = CreateMasterEditionV3InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(9 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.edition.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.update_authority.clone()); + account_infos.push(self.mint_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.system_program.clone()); + if let Some(rent) = self.rent { + account_infos.push(rent.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `create_master_edition_v3` CPI instruction builder. +pub struct CreateMasterEditionV3CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> CreateMasterEditionV3CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CreateMasterEditionV3CpiBuilderInstruction { + __program: program, + edition: None, + mint: None, + update_authority: None, + mint_authority: None, + payer: None, + metadata: None, + token_program: None, + system_program: None, + rent: None, + max_supply: None, + }); + Self { instruction } + } + /// Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition'] + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Metadata mint + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Update authority + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.update_authority = Some(update_authority); + self + } + /// Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn mint_authority( + &mut self, + mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mint_authority = Some(mint_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.rent = Some(rent); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn max_supply(&mut self, max_supply: u64) -> &mut Self { + self.instruction.max_supply = Some(max_supply); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> CreateMasterEditionV3Cpi<'a> { + let args = CreateMasterEditionV3InstructionArgs { + max_supply: self.instruction.max_supply.clone(), + }; + + CreateMasterEditionV3Cpi { + __program: self.instruction.__program, + + edition: self.instruction.edition.expect("edition is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + update_authority: self + .instruction + .update_authority + .expect("update_authority is not set"), + + mint_authority: self + .instruction + .mint_authority + .expect("mint_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + rent: self.instruction.rent, + __args: args, + } + } +} + +struct CreateMasterEditionV3CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + max_supply: Option, +} diff --git a/clients/rust/src/generated/instructions/create_metadata_account_v3.rs b/clients/rust/src/generated/instructions/create_metadata_account_v3.rs new file mode 100644 index 00000000..f1e536e8 --- /dev/null +++ b/clients/rust/src/generated/instructions/create_metadata_account_v3.rs @@ -0,0 +1,441 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::CollectionDetails; +use crate::generated::types::DataV2; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct CreateMetadataAccountV3 { + /// Metadata key (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// Mint of token asset + pub mint: solana_program::pubkey::Pubkey, + /// Mint authority + pub mint_authority: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// update authority info + pub update_authority: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Rent info + pub rent: Option, +} + +impl CreateMetadataAccountV3 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: CreateMetadataAccountV3InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.update_authority, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + rent, false, + )); + } + let mut data = CreateMetadataAccountV3InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct CreateMetadataAccountV3InstructionData { + discriminator: u8, +} + +impl CreateMetadataAccountV3InstructionData { + fn new() -> Self { + Self { discriminator: 33 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct CreateMetadataAccountV3InstructionArgs { + pub data: DataV2, + pub is_mutable: bool, + pub collection_details: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct CreateMetadataAccountV3Builder { + metadata: Option, + mint: Option, + mint_authority: Option, + payer: Option, + update_authority: Option, + system_program: Option, + rent: Option, + data: Option, + is_mutable: Option, + collection_details: Option, +} + +impl CreateMetadataAccountV3Builder { + pub fn new() -> Self { + Self::default() + } + /// Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Mint authority + #[inline(always)] + pub fn mint_authority(&mut self, mint_authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint_authority = Some(mint_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// update authority info + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.update_authority = Some(update_authority); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self { + self.rent = Some(rent); + self + } + #[inline(always)] + pub fn data(&mut self, data: DataV2) -> &mut Self { + self.data = Some(data); + self + } + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.is_mutable = Some(is_mutable); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn collection_details(&mut self, collection_details: CollectionDetails) -> &mut Self { + self.collection_details = Some(collection_details); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = CreateMetadataAccountV3 { + metadata: self.metadata.expect("metadata is not set"), + mint: self.mint.expect("mint is not set"), + mint_authority: self.mint_authority.expect("mint_authority is not set"), + payer: self.payer.expect("payer is not set"), + update_authority: self.update_authority.expect("update_authority is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + rent: self.rent, + }; + let args = CreateMetadataAccountV3InstructionArgs { + data: self.data.clone().expect("data is not set"), + is_mutable: self.is_mutable.clone().expect("is_mutable is not set"), + collection_details: self.collection_details.clone(), + }; + + accounts.instruction(args) + } +} + +/// `create_metadata_account_v3` CPI instruction. +pub struct CreateMetadataAccountV3Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata key (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of token asset + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint authority + pub mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// update authority info + pub update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Rent info + pub rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: CreateMetadataAccountV3InstructionArgs, +} + +impl<'a> CreateMetadataAccountV3Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.update_authority.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *rent.key, false, + )); + } + let mut data = CreateMetadataAccountV3InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.mint_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.update_authority.clone()); + account_infos.push(self.system_program.clone()); + if let Some(rent) = self.rent { + account_infos.push(rent.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `create_metadata_account_v3` CPI instruction builder. +pub struct CreateMetadataAccountV3CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> CreateMetadataAccountV3CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CreateMetadataAccountV3CpiBuilderInstruction { + __program: program, + metadata: None, + mint: None, + mint_authority: None, + payer: None, + update_authority: None, + system_program: None, + rent: None, + data: None, + is_mutable: None, + collection_details: None, + }); + Self { instruction } + } + /// Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Mint authority + #[inline(always)] + pub fn mint_authority( + &mut self, + mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mint_authority = Some(mint_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// update authority info + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.update_authority = Some(update_authority); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.rent = Some(rent); + self + } + #[inline(always)] + pub fn data(&mut self, data: DataV2) -> &mut Self { + self.instruction.data = Some(data); + self + } + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.instruction.is_mutable = Some(is_mutable); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn collection_details(&mut self, collection_details: CollectionDetails) -> &mut Self { + self.instruction.collection_details = Some(collection_details); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> CreateMetadataAccountV3Cpi<'a> { + let args = CreateMetadataAccountV3InstructionArgs { + data: self.instruction.data.clone().expect("data is not set"), + is_mutable: self + .instruction + .is_mutable + .clone() + .expect("is_mutable is not set"), + collection_details: self.instruction.collection_details.clone(), + }; + + CreateMetadataAccountV3Cpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + mint_authority: self + .instruction + .mint_authority + .expect("mint_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + update_authority: self + .instruction + .update_authority + .expect("update_authority is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + rent: self.instruction.rent, + __args: args, + } + } +} + +struct CreateMetadataAccountV3CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + data: Option, + is_mutable: Option, + collection_details: Option, +} diff --git a/clients/rust/src/generated/instructions/create_v1.rs b/clients/rust/src/generated/instructions/create_v1.rs new file mode 100644 index 00000000..92c79f32 --- /dev/null +++ b/clients/rust/src/generated/instructions/create_v1.rs @@ -0,0 +1,757 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Collection; +use crate::generated::types::CollectionDetails; +use crate::generated::types::Creator; +use crate::generated::types::PrintSupply; +use crate::generated::types::TokenStandard; +use crate::generated::types::Uses; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +/// Accounts. +pub struct CreateV1 { + /// Unallocated metadata account with address as pda of ['metadata', program id, mint id] + pub metadata: solana_program::pubkey::Pubkey, + /// Unallocated edition account with address as pda of ['metadata', program id, mint, 'edition'] + pub master_edition: Option, + /// Mint of token asset + pub mint: (solana_program::pubkey::Pubkey, bool), + /// Mint authority + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// Update authority for the metadata account + pub update_authority: (solana_program::pubkey::Pubkey, bool), + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token program + pub spl_token_program: solana_program::pubkey::Pubkey, +} + +impl CreateV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: CreateV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(9); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.mint.0, + self.mint.1, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.update_authority.0, + self.update_authority.1, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_token_program, + false, + )); + let mut data = CreateV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct CreateV1InstructionData { + discriminator: u8, + create_v1_discriminator: u8, +} + +impl CreateV1InstructionData { + fn new() -> Self { + Self { + discriminator: 42, + create_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct CreateV1InstructionArgs { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, + pub primary_sale_happened: bool, + pub is_mutable: bool, + pub token_standard: TokenStandard, + pub collection: Option, + pub uses: Option, + pub collection_details: Option, + pub rule_set: Option, + pub decimals: Option, + pub print_supply: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct CreateV1Builder { + metadata: Option, + master_edition: Option, + mint: Option<(solana_program::pubkey::Pubkey, bool)>, + authority: Option, + payer: Option, + update_authority: Option<(solana_program::pubkey::Pubkey, bool)>, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + name: Option, + symbol: Option, + uri: Option, + seller_fee_basis_points: Option, + creators: Option>, + primary_sale_happened: Option, + is_mutable: Option, + token_standard: Option, + collection: Option, + uses: Option, + collection_details: Option, + rule_set: Option, + decimals: Option, + print_supply: Option, +} + +impl CreateV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Unallocated metadata account with address as pda of ['metadata', program id, mint id] + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Unallocated edition account with address as pda of ['metadata', program id, mint, 'edition'] + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey, as_signer: bool) -> &mut Self { + self.mint = Some((mint, as_signer)); + self + } + /// Mint authority + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Update authority for the metadata account + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: solana_program::pubkey::Pubkey, + as_signer: bool, + ) -> &mut Self { + self.update_authority = Some((update_authority, as_signer)); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + #[inline(always)] + pub fn name(&mut self, name: String) -> &mut Self { + self.name = Some(name); + self + } + /// `[optional argument, defaults to 'String::from("")']` + #[inline(always)] + pub fn symbol(&mut self, symbol: String) -> &mut Self { + self.symbol = Some(symbol); + self + } + #[inline(always)] + pub fn uri(&mut self, uri: String) -> &mut Self { + self.uri = Some(uri); + self + } + #[inline(always)] + pub fn seller_fee_basis_points(&mut self, seller_fee_basis_points: u16) -> &mut Self { + self.seller_fee_basis_points = Some(seller_fee_basis_points); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn creators(&mut self, creators: Vec) -> &mut Self { + self.creators = Some(creators); + self + } + /// `[optional argument, defaults to 'false']` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument, defaults to 'true']` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.is_mutable = Some(is_mutable); + self + } + #[inline(always)] + pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self { + self.token_standard = Some(token_standard); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn collection(&mut self, collection: Collection) -> &mut Self { + self.collection = Some(collection); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn uses(&mut self, uses: Uses) -> &mut Self { + self.uses = Some(uses); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn collection_details(&mut self, collection_details: CollectionDetails) -> &mut Self { + self.collection_details = Some(collection_details); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: Pubkey) -> &mut Self { + self.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn decimals(&mut self, decimals: u8) -> &mut Self { + self.decimals = Some(decimals); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn print_supply(&mut self, print_supply: PrintSupply) -> &mut Self { + self.print_supply = Some(print_supply); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = CreateV1 { + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + mint: self.mint.expect("mint is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + update_authority: self.update_authority.expect("update_authority is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + }; + let args = CreateV1InstructionArgs { + name: self.name.clone().expect("name is not set"), + symbol: self.symbol.clone().unwrap_or(String::from("")), + uri: self.uri.clone().expect("uri is not set"), + seller_fee_basis_points: self + .seller_fee_basis_points + .clone() + .expect("seller_fee_basis_points is not set"), + creators: self.creators.clone(), + primary_sale_happened: self.primary_sale_happened.clone().unwrap_or(false), + is_mutable: self.is_mutable.clone().unwrap_or(true), + token_standard: self + .token_standard + .clone() + .expect("token_standard is not set"), + collection: self.collection.clone(), + uses: self.uses.clone(), + collection_details: self.collection_details.clone(), + rule_set: self.rule_set.clone(), + decimals: self.decimals.clone(), + print_supply: self.print_supply.clone(), + }; + + accounts.instruction(args) + } +} + +/// `create_v1` CPI instruction. +pub struct CreateV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Unallocated metadata account with address as pda of ['metadata', program id, mint id] + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Unallocated edition account with address as pda of ['metadata', program id, mint, 'edition'] + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of token asset + pub mint: (&'a solana_program::account_info::AccountInfo<'a>, bool), + /// Mint authority + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority for the metadata account + pub update_authority: (&'a solana_program::account_info::AccountInfo<'a>, bool), + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token program + pub spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: CreateV1InstructionArgs, +} + +impl<'a> CreateV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(9); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.mint.0.key, + self.mint.1, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.update_authority.0.key, + self.update_authority.1, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_token_program.key, + false, + )); + let mut data = CreateV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(9 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + account_infos.push(self.mint.0.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.update_authority.0.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + account_infos.push(self.spl_token_program.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `create_v1` CPI instruction builder. +pub struct CreateV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> CreateV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CreateV1CpiBuilderInstruction { + __program: program, + metadata: None, + master_edition: None, + mint: None, + authority: None, + payer: None, + update_authority: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + name: None, + symbol: None, + uri: None, + seller_fee_basis_points: None, + creators: None, + primary_sale_happened: None, + is_mutable: None, + token_standard: None, + collection: None, + uses: None, + collection_details: None, + rule_set: None, + decimals: None, + print_supply: None, + }); + Self { instruction } + } + /// Unallocated metadata account with address as pda of ['metadata', program id, mint id] + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Unallocated edition account with address as pda of ['metadata', program id, mint, 'edition'] + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint( + &mut self, + mint: &'a solana_program::account_info::AccountInfo<'a>, + as_signer: bool, + ) -> &mut Self { + self.instruction.mint = Some((mint, as_signer)); + self + } + /// Mint authority + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Update authority for the metadata account + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: &'a solana_program::account_info::AccountInfo<'a>, + as_signer: bool, + ) -> &mut Self { + self.instruction.update_authority = Some((update_authority, as_signer)); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + #[inline(always)] + pub fn name(&mut self, name: String) -> &mut Self { + self.instruction.name = Some(name); + self + } + /// `[optional argument, defaults to 'String::from("")']` + #[inline(always)] + pub fn symbol(&mut self, symbol: String) -> &mut Self { + self.instruction.symbol = Some(symbol); + self + } + #[inline(always)] + pub fn uri(&mut self, uri: String) -> &mut Self { + self.instruction.uri = Some(uri); + self + } + #[inline(always)] + pub fn seller_fee_basis_points(&mut self, seller_fee_basis_points: u16) -> &mut Self { + self.instruction.seller_fee_basis_points = Some(seller_fee_basis_points); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn creators(&mut self, creators: Vec) -> &mut Self { + self.instruction.creators = Some(creators); + self + } + /// `[optional argument, defaults to 'false']` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.instruction.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument, defaults to 'true']` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.instruction.is_mutable = Some(is_mutable); + self + } + #[inline(always)] + pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self { + self.instruction.token_standard = Some(token_standard); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn collection(&mut self, collection: Collection) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn uses(&mut self, uses: Uses) -> &mut Self { + self.instruction.uses = Some(uses); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn collection_details(&mut self, collection_details: CollectionDetails) -> &mut Self { + self.instruction.collection_details = Some(collection_details); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: Pubkey) -> &mut Self { + self.instruction.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn decimals(&mut self, decimals: u8) -> &mut Self { + self.instruction.decimals = Some(decimals); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn print_supply(&mut self, print_supply: PrintSupply) -> &mut Self { + self.instruction.print_supply = Some(print_supply); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> CreateV1Cpi<'a> { + let args = CreateV1InstructionArgs { + name: self.instruction.name.clone().expect("name is not set"), + symbol: self.instruction.symbol.clone().unwrap_or(String::from("")), + uri: self.instruction.uri.clone().expect("uri is not set"), + seller_fee_basis_points: self + .instruction + .seller_fee_basis_points + .clone() + .expect("seller_fee_basis_points is not set"), + creators: self.instruction.creators.clone(), + primary_sale_happened: self + .instruction + .primary_sale_happened + .clone() + .unwrap_or(false), + is_mutable: self.instruction.is_mutable.clone().unwrap_or(true), + token_standard: self + .instruction + .token_standard + .clone() + .expect("token_standard is not set"), + collection: self.instruction.collection.clone(), + uses: self.instruction.uses.clone(), + collection_details: self.instruction.collection_details.clone(), + rule_set: self.instruction.rule_set.clone(), + decimals: self.instruction.decimals.clone(), + print_supply: self.instruction.print_supply.clone(), + }; + + CreateV1Cpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + mint: self.instruction.mint.expect("mint is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + update_authority: self + .instruction + .update_authority + .expect("update_authority is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self + .instruction + .spl_token_program + .expect("spl_token_program is not set"), + __args: args, + } + } +} + +struct CreateV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<(&'a solana_program::account_info::AccountInfo<'a>, bool)>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + update_authority: Option<(&'a solana_program::account_info::AccountInfo<'a>, bool)>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + name: Option, + symbol: Option, + uri: Option, + seller_fee_basis_points: Option, + creators: Option>, + primary_sale_happened: Option, + is_mutable: Option, + token_standard: Option, + collection: Option, + uses: Option, + collection_details: Option, + rule_set: Option, + decimals: Option, + print_supply: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_authority_item_v1.rs b/clients/rust/src/generated/instructions/delegate_authority_item_v1.rs new file mode 100644 index 00000000..72619cf5 --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_authority_item_v1.rs @@ -0,0 +1,773 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateAuthorityItemV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateAuthorityItemV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateAuthorityItemV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateAuthorityItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateAuthorityItemV1InstructionData { + discriminator: u8, + delegate_authority_item_v1_discriminator: u8, +} + +impl DelegateAuthorityItemV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_authority_item_v1_discriminator: 9, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateAuthorityItemV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateAuthorityItemV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl DelegateAuthorityItemV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateAuthorityItemV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateAuthorityItemV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_authority_item_v1` CPI instruction. +pub struct DelegateAuthorityItemV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateAuthorityItemV1InstructionArgs, +} + +impl<'a> DelegateAuthorityItemV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateAuthorityItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_authority_item_v1` CPI instruction builder. +pub struct DelegateAuthorityItemV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateAuthorityItemV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateAuthorityItemV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateAuthorityItemV1Cpi<'a> { + let args = DelegateAuthorityItemV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateAuthorityItemV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateAuthorityItemV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_collection_item_v1.rs b/clients/rust/src/generated/instructions/delegate_collection_item_v1.rs new file mode 100644 index 00000000..575e2f06 --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_collection_item_v1.rs @@ -0,0 +1,773 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateCollectionItemV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateCollectionItemV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateCollectionItemV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateCollectionItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateCollectionItemV1InstructionData { + discriminator: u8, + delegate_collection_item_v1_discriminator: u8, +} + +impl DelegateCollectionItemV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_collection_item_v1_discriminator: 11, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateCollectionItemV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateCollectionItemV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl DelegateCollectionItemV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateCollectionItemV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateCollectionItemV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_collection_item_v1` CPI instruction. +pub struct DelegateCollectionItemV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateCollectionItemV1InstructionArgs, +} + +impl<'a> DelegateCollectionItemV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateCollectionItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_collection_item_v1` CPI instruction builder. +pub struct DelegateCollectionItemV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateCollectionItemV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateCollectionItemV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateCollectionItemV1Cpi<'a> { + let args = DelegateCollectionItemV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateCollectionItemV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateCollectionItemV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_collection_v1.rs b/clients/rust/src/generated/instructions/delegate_collection_v1.rs new file mode 100644 index 00000000..45aa6d90 --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_collection_v1.rs @@ -0,0 +1,773 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateCollectionV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateCollectionV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateCollectionV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateCollectionV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateCollectionV1InstructionData { + discriminator: u8, + delegate_collection_v1_discriminator: u8, +} + +impl DelegateCollectionV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_collection_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateCollectionV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateCollectionV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl DelegateCollectionV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateCollectionV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateCollectionV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_collection_v1` CPI instruction. +pub struct DelegateCollectionV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateCollectionV1InstructionArgs, +} + +impl<'a> DelegateCollectionV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateCollectionV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_collection_v1` CPI instruction builder. +pub struct DelegateCollectionV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateCollectionV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateCollectionV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateCollectionV1Cpi<'a> { + let args = DelegateCollectionV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateCollectionV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateCollectionV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_data_item_v1.rs b/clients/rust/src/generated/instructions/delegate_data_item_v1.rs new file mode 100644 index 00000000..2094250c --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_data_item_v1.rs @@ -0,0 +1,773 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateDataItemV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateDataItemV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateDataItemV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateDataItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateDataItemV1InstructionData { + discriminator: u8, + delegate_data_item_v1_discriminator: u8, +} + +impl DelegateDataItemV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_data_item_v1_discriminator: 10, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateDataItemV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateDataItemV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl DelegateDataItemV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateDataItemV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateDataItemV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_data_item_v1` CPI instruction. +pub struct DelegateDataItemV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateDataItemV1InstructionArgs, +} + +impl<'a> DelegateDataItemV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateDataItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_data_item_v1` CPI instruction builder. +pub struct DelegateDataItemV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateDataItemV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateDataItemV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateDataItemV1Cpi<'a> { + let args = DelegateDataItemV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateDataItemV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateDataItemV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_data_v1.rs b/clients/rust/src/generated/instructions/delegate_data_v1.rs new file mode 100644 index 00000000..bc4628bd --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_data_v1.rs @@ -0,0 +1,769 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateDataV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateDataV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateDataV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateDataV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateDataV1InstructionData { + discriminator: u8, + delegate_data_v1_discriminator: u8, +} + +impl DelegateDataV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_data_v1_discriminator: 3, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateDataV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateDataV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl DelegateDataV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateDataV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateDataV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_data_v1` CPI instruction. +pub struct DelegateDataV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateDataV1InstructionArgs, +} + +impl<'a> DelegateDataV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateDataV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_data_v1` CPI instruction builder. +pub struct DelegateDataV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateDataV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateDataV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateDataV1Cpi<'a> { + let args = DelegateDataV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateDataV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateDataV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_locked_transfer_v1.rs b/clients/rust/src/generated/instructions/delegate_locked_transfer_v1.rs new file mode 100644 index 00000000..ae126287 --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_locked_transfer_v1.rs @@ -0,0 +1,800 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +/// Accounts. +pub struct DelegateLockedTransferV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateLockedTransferV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateLockedTransferV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateLockedTransferV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateLockedTransferV1InstructionData { + discriminator: u8, + delegate_locked_transfer_v1_discriminator: u8, +} + +impl DelegateLockedTransferV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_locked_transfer_v1_discriminator: 7, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateLockedTransferV1InstructionArgs { + pub amount: u64, + pub locked_address: Pubkey, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateLockedTransferV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + amount: Option, + locked_address: Option, + authorization_data: Option, +} + +impl DelegateLockedTransferV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + #[inline(always)] + pub fn locked_address(&mut self, locked_address: Pubkey) -> &mut Self { + self.locked_address = Some(locked_address); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateLockedTransferV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateLockedTransferV1InstructionArgs { + amount: self.amount.clone().unwrap_or(1), + locked_address: self + .locked_address + .clone() + .expect("locked_address is not set"), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_locked_transfer_v1` CPI instruction. +pub struct DelegateLockedTransferV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateLockedTransferV1InstructionArgs, +} + +impl<'a> DelegateLockedTransferV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateLockedTransferV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_locked_transfer_v1` CPI instruction builder. +pub struct DelegateLockedTransferV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateLockedTransferV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateLockedTransferV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + amount: None, + locked_address: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + #[inline(always)] + pub fn locked_address(&mut self, locked_address: Pubkey) -> &mut Self { + self.instruction.locked_address = Some(locked_address); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateLockedTransferV1Cpi<'a> { + let args = DelegateLockedTransferV1InstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + locked_address: self + .instruction + .locked_address + .clone() + .expect("locked_address is not set"), + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateLockedTransferV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateLockedTransferV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, + locked_address: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_programmable_config_item_v1.rs b/clients/rust/src/generated/instructions/delegate_programmable_config_item_v1.rs new file mode 100644 index 00000000..26de8c51 --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_programmable_config_item_v1.rs @@ -0,0 +1,773 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateProgrammableConfigItemV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateProgrammableConfigItemV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateProgrammableConfigItemV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateProgrammableConfigItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateProgrammableConfigItemV1InstructionData { + discriminator: u8, + delegate_programmable_config_item_v1_discriminator: u8, +} + +impl DelegateProgrammableConfigItemV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_programmable_config_item_v1_discriminator: 12, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateProgrammableConfigItemV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateProgrammableConfigItemV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl DelegateProgrammableConfigItemV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateProgrammableConfigItemV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateProgrammableConfigItemV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_programmable_config_item_v1` CPI instruction. +pub struct DelegateProgrammableConfigItemV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateProgrammableConfigItemV1InstructionArgs, +} + +impl<'a> DelegateProgrammableConfigItemV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateProgrammableConfigItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_programmable_config_item_v1` CPI instruction builder. +pub struct DelegateProgrammableConfigItemV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateProgrammableConfigItemV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateProgrammableConfigItemV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateProgrammableConfigItemV1Cpi<'a> { + let args = DelegateProgrammableConfigItemV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateProgrammableConfigItemV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateProgrammableConfigItemV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_programmable_config_v1.rs b/clients/rust/src/generated/instructions/delegate_programmable_config_v1.rs new file mode 100644 index 00000000..6cc05f84 --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_programmable_config_v1.rs @@ -0,0 +1,773 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateProgrammableConfigV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateProgrammableConfigV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateProgrammableConfigV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateProgrammableConfigV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateProgrammableConfigV1InstructionData { + discriminator: u8, + delegate_programmable_config_v1_discriminator: u8, +} + +impl DelegateProgrammableConfigV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_programmable_config_v1_discriminator: 8, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateProgrammableConfigV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateProgrammableConfigV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl DelegateProgrammableConfigV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateProgrammableConfigV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateProgrammableConfigV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_programmable_config_v1` CPI instruction. +pub struct DelegateProgrammableConfigV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateProgrammableConfigV1InstructionArgs, +} + +impl<'a> DelegateProgrammableConfigV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateProgrammableConfigV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_programmable_config_v1` CPI instruction builder. +pub struct DelegateProgrammableConfigV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateProgrammableConfigV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateProgrammableConfigV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateProgrammableConfigV1Cpi<'a> { + let args = DelegateProgrammableConfigV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateProgrammableConfigV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateProgrammableConfigV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_sale_v1.rs b/clients/rust/src/generated/instructions/delegate_sale_v1.rs new file mode 100644 index 00000000..d0ecd1ee --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_sale_v1.rs @@ -0,0 +1,772 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateSaleV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateSaleV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateSaleV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateSaleV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateSaleV1InstructionData { + discriminator: u8, + delegate_sale_v1_discriminator: u8, +} + +impl DelegateSaleV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_sale_v1_discriminator: 1, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateSaleV1InstructionArgs { + pub amount: u64, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateSaleV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + amount: Option, + authorization_data: Option, +} + +impl DelegateSaleV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateSaleV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateSaleV1InstructionArgs { + amount: self.amount.clone().unwrap_or(1), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_sale_v1` CPI instruction. +pub struct DelegateSaleV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateSaleV1InstructionArgs, +} + +impl<'a> DelegateSaleV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateSaleV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_sale_v1` CPI instruction builder. +pub struct DelegateSaleV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateSaleV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateSaleV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + amount: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateSaleV1Cpi<'a> { + let args = DelegateSaleV1InstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateSaleV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateSaleV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_staking_v1.rs b/clients/rust/src/generated/instructions/delegate_staking_v1.rs new file mode 100644 index 00000000..06e081f8 --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_staking_v1.rs @@ -0,0 +1,776 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateStakingV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateStakingV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateStakingV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateStakingV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateStakingV1InstructionData { + discriminator: u8, + delegate_staking_v1_discriminator: u8, +} + +impl DelegateStakingV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_staking_v1_discriminator: 5, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateStakingV1InstructionArgs { + pub amount: u64, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateStakingV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + amount: Option, + authorization_data: Option, +} + +impl DelegateStakingV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateStakingV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateStakingV1InstructionArgs { + amount: self.amount.clone().unwrap_or(1), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_staking_v1` CPI instruction. +pub struct DelegateStakingV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateStakingV1InstructionArgs, +} + +impl<'a> DelegateStakingV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateStakingV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_staking_v1` CPI instruction builder. +pub struct DelegateStakingV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateStakingV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateStakingV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + amount: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateStakingV1Cpi<'a> { + let args = DelegateStakingV1InstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateStakingV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateStakingV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_standard_v1.rs b/clients/rust/src/generated/instructions/delegate_standard_v1.rs new file mode 100644 index 00000000..6b05b3ea --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_standard_v1.rs @@ -0,0 +1,757 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateStandardV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateStandardV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateStandardV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateStandardV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateStandardV1InstructionData { + discriminator: u8, + delegate_standard_v1_discriminator: u8, +} + +impl DelegateStandardV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_standard_v1_discriminator: 6, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateStandardV1InstructionArgs { + pub amount: u64, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateStandardV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + amount: Option, +} + +impl DelegateStandardV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateStandardV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateStandardV1InstructionArgs { + amount: self.amount.clone().unwrap_or(1), + }; + + accounts.instruction(args) + } +} + +/// `delegate_standard_v1` CPI instruction. +pub struct DelegateStandardV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateStandardV1InstructionArgs, +} + +impl<'a> DelegateStandardV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateStandardV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_standard_v1` CPI instruction builder. +pub struct DelegateStandardV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateStandardV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateStandardV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + amount: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateStandardV1Cpi<'a> { + let args = DelegateStandardV1InstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + }; + + DelegateStandardV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateStandardV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_transfer_v1.rs b/clients/rust/src/generated/instructions/delegate_transfer_v1.rs new file mode 100644 index 00000000..97b39ffb --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_transfer_v1.rs @@ -0,0 +1,776 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateTransferV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateTransferV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateTransferV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateTransferV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateTransferV1InstructionData { + discriminator: u8, + delegate_transfer_v1_discriminator: u8, +} + +impl DelegateTransferV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_transfer_v1_discriminator: 2, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateTransferV1InstructionArgs { + pub amount: u64, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateTransferV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + amount: Option, + authorization_data: Option, +} + +impl DelegateTransferV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateTransferV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateTransferV1InstructionArgs { + amount: self.amount.clone().unwrap_or(1), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_transfer_v1` CPI instruction. +pub struct DelegateTransferV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateTransferV1InstructionArgs, +} + +impl<'a> DelegateTransferV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateTransferV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_transfer_v1` CPI instruction builder. +pub struct DelegateTransferV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateTransferV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateTransferV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + amount: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateTransferV1Cpi<'a> { + let args = DelegateTransferV1InstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateTransferV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateTransferV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/delegate_utility_v1.rs b/clients/rust/src/generated/instructions/delegate_utility_v1.rs new file mode 100644 index 00000000..4b1070dd --- /dev/null +++ b/clients/rust/src/generated/instructions/delegate_utility_v1.rs @@ -0,0 +1,776 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DelegateUtilityV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl DelegateUtilityV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: DelegateUtilityV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateUtilityV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DelegateUtilityV1InstructionData { + discriminator: u8, + delegate_utility_v1_discriminator: u8, +} + +impl DelegateUtilityV1InstructionData { + fn new() -> Self { + Self { + discriminator: 44, + delegate_utility_v1_discriminator: 4, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct DelegateUtilityV1InstructionArgs { + pub amount: u64, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct DelegateUtilityV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + amount: Option, + authorization_data: Option, +} + +impl DelegateUtilityV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DelegateUtilityV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = DelegateUtilityV1InstructionArgs { + amount: self.amount.clone().unwrap_or(1), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `delegate_utility_v1` CPI instruction. +pub struct DelegateUtilityV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: DelegateUtilityV1InstructionArgs, +} + +impl<'a> DelegateUtilityV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = DelegateUtilityV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `delegate_utility_v1` CPI instruction builder. +pub struct DelegateUtilityV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> DelegateUtilityV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(DelegateUtilityV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + amount: None, + authorization_data: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DelegateUtilityV1Cpi<'a> { + let args = DelegateUtilityV1InstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + authorization_data: self.instruction.authorization_data.clone(), + }; + + DelegateUtilityV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct DelegateUtilityV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/deprecated_mint_new_edition_from_master_edition_via_printing_token.rs b/clients/rust/src/generated/instructions/deprecated_mint_new_edition_from_master_edition_via_printing_token.rs new file mode 100644 index 00000000..1b6e642d --- /dev/null +++ b/clients/rust/src/generated/instructions/deprecated_mint_new_edition_from_master_edition_via_printing_token.rs @@ -0,0 +1,714 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct DeprecatedMintNewEditionFromMasterEditionViaPrintingToken { + /// New Metadata key (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// New Edition V1 (pda of ['metadata', program id, mint id, 'edition']) + pub edition: solana_program::pubkey::Pubkey, + /// Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition']) + pub master_edition: solana_program::pubkey::Pubkey, + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub mint: solana_program::pubkey::Pubkey, + /// Mint authority of new mint + pub mint_authority: solana_program::pubkey::Pubkey, + /// Printing Mint of master record edition + pub printing_mint: solana_program::pubkey::Pubkey, + /// Token account containing Printing mint token to be transferred + pub master_token_account: solana_program::pubkey::Pubkey, + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master mint id, edition_number]) + pub edition_marker: solana_program::pubkey::Pubkey, + /// Burn authority for this token + pub burn_authority: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// update authority info for new metadata account + pub master_update_authority: solana_program::pubkey::Pubkey, + /// Master record metadata account + pub master_metadata: solana_program::pubkey::Pubkey, + /// Token program + pub token_program: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Rent info + pub rent: solana_program::pubkey::Pubkey, + /// Reservation List - If present, and you are on this list, you can get an edition number given by your position on the list. + pub reservation_list: Option, +} + +impl DeprecatedMintNewEditionFromMasterEditionViaPrintingToken { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(16); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.master_edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.printing_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.master_token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition_marker, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.burn_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.master_update_authority, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.master_metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.rent, false, + )); + if let Some(reservation_list) = self.reservation_list { + accounts.push(solana_program::instruction::AccountMeta::new( + reservation_list, + false, + )); + } + let data = DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenInstructionData { + discriminator: u8, +} + +impl DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenInstructionData { + fn new() -> Self { + Self { discriminator: 3 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenBuilder { + metadata: Option, + edition: Option, + master_edition: Option, + mint: Option, + mint_authority: Option, + printing_mint: Option, + master_token_account: Option, + edition_marker: Option, + burn_authority: Option, + payer: Option, + master_update_authority: Option, + master_metadata: Option, + token_program: Option, + system_program: Option, + rent: Option, + reservation_list: Option, +} + +impl DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenBuilder { + pub fn new() -> Self { + Self::default() + } + /// New Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// New Edition V1 (pda of ['metadata', program id, mint id, 'edition']) + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition']) + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Mint authority of new mint + #[inline(always)] + pub fn mint_authority(&mut self, mint_authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint_authority = Some(mint_authority); + self + } + /// Printing Mint of master record edition + #[inline(always)] + pub fn printing_mint(&mut self, printing_mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.printing_mint = Some(printing_mint); + self + } + /// Token account containing Printing mint token to be transferred + #[inline(always)] + pub fn master_token_account( + &mut self, + master_token_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_token_account = Some(master_token_account); + self + } + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master mint id, edition_number]) + #[inline(always)] + pub fn edition_marker(&mut self, edition_marker: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition_marker = Some(edition_marker); + self + } + /// Burn authority for this token + #[inline(always)] + pub fn burn_authority(&mut self, burn_authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.burn_authority = Some(burn_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// update authority info for new metadata account + #[inline(always)] + pub fn master_update_authority( + &mut self, + master_update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_update_authority = Some(master_update_authority); + self + } + /// Master record metadata account + #[inline(always)] + pub fn master_metadata( + &mut self, + master_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_metadata = Some(master_metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self { + self.rent = Some(rent); + self + } + /// `[optional account]` + /// Reservation List - If present, and you are on this list, you can get an edition number given by your position on the list. + #[inline(always)] + pub fn reservation_list( + &mut self, + reservation_list: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.reservation_list = Some(reservation_list); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = DeprecatedMintNewEditionFromMasterEditionViaPrintingToken { + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition.expect("edition is not set"), + master_edition: self.master_edition.expect("master_edition is not set"), + mint: self.mint.expect("mint is not set"), + mint_authority: self.mint_authority.expect("mint_authority is not set"), + printing_mint: self.printing_mint.expect("printing_mint is not set"), + master_token_account: self + .master_token_account + .expect("master_token_account is not set"), + edition_marker: self.edition_marker.expect("edition_marker is not set"), + burn_authority: self.burn_authority.expect("burn_authority is not set"), + payer: self.payer.expect("payer is not set"), + master_update_authority: self + .master_update_authority + .expect("master_update_authority is not set"), + master_metadata: self.master_metadata.expect("master_metadata is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + rent: self.rent.unwrap_or(solana_program::pubkey!( + "SysvarRent111111111111111111111111111111111" + )), + reservation_list: self.reservation_list, + }; + + accounts.instruction() + } +} + +/// `deprecated_mint_new_edition_from_master_edition_via_printing_token` CPI instruction. +pub struct DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// New Metadata key (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// New Edition V1 (pda of ['metadata', program id, mint id, 'edition']) + pub edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition']) + pub master_edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint authority of new mint + pub mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Printing Mint of master record edition + pub printing_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account containing Printing mint token to be transferred + pub master_token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master mint id, edition_number]) + pub edition_marker: &'a solana_program::account_info::AccountInfo<'a>, + /// Burn authority for this token + pub burn_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// update authority info for new metadata account + pub master_update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Master record metadata account + pub master_metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Token program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Rent info + pub rent: &'a solana_program::account_info::AccountInfo<'a>, + /// Reservation List - If present, and you are on this list, you can get an edition number given by your position on the list. + pub reservation_list: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(16); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.master_edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.printing_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.master_token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition_marker.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.burn_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.master_update_authority.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.master_metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.rent.key, + false, + )); + if let Some(reservation_list) = self.reservation_list { + accounts.push(solana_program::instruction::AccountMeta::new( + *reservation_list.key, + false, + )); + } + let data = DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(16 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.edition.clone()); + account_infos.push(self.master_edition.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.mint_authority.clone()); + account_infos.push(self.printing_mint.clone()); + account_infos.push(self.master_token_account.clone()); + account_infos.push(self.edition_marker.clone()); + account_infos.push(self.burn_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.master_update_authority.clone()); + account_infos.push(self.master_metadata.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.rent.clone()); + if let Some(reservation_list) = self.reservation_list { + account_infos.push(reservation_list.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `deprecated_mint_new_edition_from_master_edition_via_printing_token` CPI instruction builder. +pub struct DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenCpiBuilder<'a> { + instruction: + Box>, +} + +impl<'a> DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new( + DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenCpiBuilderInstruction { + __program: program, + metadata: None, + edition: None, + master_edition: None, + mint: None, + mint_authority: None, + printing_mint: None, + master_token_account: None, + edition_marker: None, + burn_authority: None, + payer: None, + master_update_authority: None, + master_metadata: None, + token_program: None, + system_program: None, + rent: None, + reservation_list: None, + }, + ); + Self { instruction } + } + /// New Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// New Edition V1 (pda of ['metadata', program id, mint id, 'edition']) + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition']) + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Mint authority of new mint + #[inline(always)] + pub fn mint_authority( + &mut self, + mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mint_authority = Some(mint_authority); + self + } + /// Printing Mint of master record edition + #[inline(always)] + pub fn printing_mint( + &mut self, + printing_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.printing_mint = Some(printing_mint); + self + } + /// Token account containing Printing mint token to be transferred + #[inline(always)] + pub fn master_token_account( + &mut self, + master_token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_token_account = Some(master_token_account); + self + } + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master mint id, edition_number]) + #[inline(always)] + pub fn edition_marker( + &mut self, + edition_marker: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_marker = Some(edition_marker); + self + } + /// Burn authority for this token + #[inline(always)] + pub fn burn_authority( + &mut self, + burn_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.burn_authority = Some(burn_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// update authority info for new metadata account + #[inline(always)] + pub fn master_update_authority( + &mut self, + master_update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_update_authority = Some(master_update_authority); + self + } + /// Master record metadata account + #[inline(always)] + pub fn master_metadata( + &mut self, + master_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_metadata = Some(master_metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.rent = Some(rent); + self + } + /// `[optional account]` + /// Reservation List - If present, and you are on this list, you can get an edition number given by your position on the list. + #[inline(always)] + pub fn reservation_list( + &mut self, + reservation_list: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.reservation_list = Some(reservation_list); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenCpi<'a> { + DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition.expect("edition is not set"), + + master_edition: self + .instruction + .master_edition + .expect("master_edition is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + mint_authority: self + .instruction + .mint_authority + .expect("mint_authority is not set"), + + printing_mint: self + .instruction + .printing_mint + .expect("printing_mint is not set"), + + master_token_account: self + .instruction + .master_token_account + .expect("master_token_account is not set"), + + edition_marker: self + .instruction + .edition_marker + .expect("edition_marker is not set"), + + burn_authority: self + .instruction + .burn_authority + .expect("burn_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + master_update_authority: self + .instruction + .master_update_authority + .expect("master_update_authority is not set"), + + master_metadata: self + .instruction + .master_metadata + .expect("master_metadata is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + rent: self.instruction.rent.expect("rent is not set"), + + reservation_list: self.instruction.reservation_list, + } + } +} + +struct DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + printing_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_marker: Option<&'a solana_program::account_info::AccountInfo<'a>>, + burn_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + reservation_list: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/freeze_delegated_account.rs b/clients/rust/src/generated/instructions/freeze_delegated_account.rs new file mode 100644 index 00000000..5a7ac7c5 --- /dev/null +++ b/clients/rust/src/generated/instructions/freeze_delegated_account.rs @@ -0,0 +1,293 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct FreezeDelegatedAccount { + /// Delegate + pub delegate: solana_program::pubkey::Pubkey, + /// Token account to freeze + pub token_account: solana_program::pubkey::Pubkey, + /// Edition + pub edition: solana_program::pubkey::Pubkey, + /// Token mint + pub mint: solana_program::pubkey::Pubkey, + /// Token Program + pub token_program: solana_program::pubkey::Pubkey, +} + +impl FreezeDelegatedAccount { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(5); + accounts.push(solana_program::instruction::AccountMeta::new( + self.delegate, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + let data = FreezeDelegatedAccountInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct FreezeDelegatedAccountInstructionData { + discriminator: u8, +} + +impl FreezeDelegatedAccountInstructionData { + fn new() -> Self { + Self { discriminator: 26 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct FreezeDelegatedAccountBuilder { + delegate: Option, + token_account: Option, + edition: Option, + mint: Option, + token_program: Option, +} + +impl FreezeDelegatedAccountBuilder { + pub fn new() -> Self { + Self::default() + } + /// Delegate + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Token account to freeze + #[inline(always)] + pub fn token_account(&mut self, token_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_account = Some(token_account); + self + } + /// Edition + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Token mint + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token Program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = FreezeDelegatedAccount { + delegate: self.delegate.expect("delegate is not set"), + token_account: self.token_account.expect("token_account is not set"), + edition: self.edition.expect("edition is not set"), + mint: self.mint.expect("mint is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + }; + + accounts.instruction() + } +} + +/// `freeze_delegated_account` CPI instruction. +pub struct FreezeDelegatedAccountCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account to freeze + pub token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition + pub edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Token mint + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> FreezeDelegatedAccountCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(5); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.delegate.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + let data = FreezeDelegatedAccountInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.delegate.clone()); + account_infos.push(self.token_account.clone()); + account_infos.push(self.edition.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.token_program.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `freeze_delegated_account` CPI instruction builder. +pub struct FreezeDelegatedAccountCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> FreezeDelegatedAccountCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(FreezeDelegatedAccountCpiBuilderInstruction { + __program: program, + delegate: None, + token_account: None, + edition: None, + mint: None, + token_program: None, + }); + Self { instruction } + } + /// Delegate + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Token account to freeze + #[inline(always)] + pub fn token_account( + &mut self, + token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_account = Some(token_account); + self + } + /// Edition + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Token mint + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token Program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> FreezeDelegatedAccountCpi<'a> { + FreezeDelegatedAccountCpi { + __program: self.instruction.__program, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + token_account: self + .instruction + .token_account + .expect("token_account is not set"), + + edition: self.instruction.edition.expect("edition is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + } + } +} + +struct FreezeDelegatedAccountCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/lock_v1.rs b/clients/rust/src/generated/instructions/lock_v1.rs new file mode 100644 index 00000000..494f1baf --- /dev/null +++ b/clients/rust/src/generated/instructions/lock_v1.rs @@ -0,0 +1,716 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct LockV1 { + /// Delegate or freeze authority + pub authority: solana_program::pubkey::Pubkey, + /// Token owner account + pub token_owner: Option, + /// Token account + pub token: solana_program::pubkey::Pubkey, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Token record account + pub token_record: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// System program + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl LockV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: LockV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(13); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(token_owner) = self.token_owner { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token_owner, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = LockV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct LockV1InstructionData { + discriminator: u8, + lock_v1_discriminator: u8, +} + +impl LockV1InstructionData { + fn new() -> Self { + Self { + discriminator: 46, + lock_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct LockV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct LockV1Builder { + authority: Option, + token_owner: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + token_record: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl LockV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Delegate or freeze authority + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Token owner account + #[inline(always)] + pub fn token_owner(&mut self, token_owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_owner = Some(token_owner); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// System program + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = LockV1 { + authority: self.authority.expect("authority is not set"), + token_owner: self.token_owner, + token: self.token.expect("token is not set"), + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + token_record: self.token_record, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = LockV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `lock_v1` CPI instruction. +pub struct LockV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate or freeze authority + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Token owner account + pub token_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: LockV1InstructionArgs, +} + +impl<'a> LockV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(13); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(token_owner) = self.token_owner { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token_owner.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = LockV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(13 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(token_owner) = self.token_owner { + account_infos.push(token_owner.clone()); + } + account_infos.push(self.token.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `lock_v1` CPI instruction builder. +pub struct LockV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> LockV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(LockV1CpiBuilderInstruction { + __program: program, + authority: None, + token_owner: None, + token: None, + mint: None, + metadata: None, + edition: None, + token_record: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// Delegate or freeze authority + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Token owner account + #[inline(always)] + pub fn token_owner( + &mut self, + token_owner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_owner = Some(token_owner); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// System program + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> LockV1Cpi<'a> { + let args = LockV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + LockV1Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + token_owner: self.instruction.token_owner, + + token: self.instruction.token.expect("token is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + token_record: self.instruction.token_record, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct LockV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/migrate.rs b/clients/rust/src/generated/instructions/migrate.rs new file mode 100644 index 00000000..cf31f2ab --- /dev/null +++ b/clients/rust/src/generated/instructions/migrate.rs @@ -0,0 +1,696 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct Migrate { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: solana_program::pubkey::Pubkey, + /// Token account + pub token: solana_program::pubkey::Pubkey, + /// Token account owner + pub token_owner: solana_program::pubkey::Pubkey, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// Update authority + pub authority: solana_program::pubkey::Pubkey, + /// Collection metadata account + pub collection_metadata: solana_program::pubkey::Pubkey, + /// Delegate record account + pub delegate_record: solana_program::pubkey::Pubkey, + /// Token record account + pub token_record: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instruction sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl Migrate { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(15); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_owner, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate_record, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token_record, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_token_program, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = MigrateInstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct MigrateInstructionData { + discriminator: u8, +} + +impl MigrateInstructionData { + fn new() -> Self { + Self { discriminator: 48 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct MigrateBuilder { + metadata: Option, + edition: Option, + token: Option, + token_owner: Option, + mint: Option, + payer: Option, + authority: Option, + collection_metadata: Option, + delegate_record: Option, + token_record: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl MigrateBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Token account owner + #[inline(always)] + pub fn token_owner(&mut self, token_owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_owner = Some(token_owner); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Update authority + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Collection metadata account + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instruction sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = Migrate { + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition.expect("edition is not set"), + token: self.token.expect("token is not set"), + token_owner: self.token_owner.expect("token_owner is not set"), + mint: self.mint.expect("mint is not set"), + payer: self.payer.expect("payer is not set"), + authority: self.authority.expect("authority is not set"), + collection_metadata: self + .collection_metadata + .expect("collection_metadata is not set"), + delegate_record: self.delegate_record.expect("delegate_record is not set"), + token_record: self.token_record.expect("token_record is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `migrate` CPI instruction. +pub struct MigrateCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account owner + pub token_owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection metadata account + pub collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + /// Token record account + pub token_record: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instruction sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> MigrateCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(15); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_owner.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate_record.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token_record.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_token_program.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = MigrateInstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(15 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.edition.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.token_owner.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.collection_metadata.clone()); + account_infos.push(self.delegate_record.clone()); + account_infos.push(self.token_record.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + account_infos.push(self.spl_token_program.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `migrate` CPI instruction builder. +pub struct MigrateCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> MigrateCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(MigrateCpiBuilderInstruction { + __program: program, + metadata: None, + edition: None, + token: None, + token_owner: None, + mint: None, + payer: None, + authority: None, + collection_metadata: None, + delegate_record: None, + token_record: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Token account owner + #[inline(always)] + pub fn token_owner( + &mut self, + token_owner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_owner = Some(token_owner); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Update authority + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Collection metadata account + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instruction sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> MigrateCpi<'a> { + MigrateCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition.expect("edition is not set"), + + token: self.instruction.token.expect("token is not set"), + + token_owner: self + .instruction + .token_owner + .expect("token_owner is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + collection_metadata: self + .instruction + .collection_metadata + .expect("collection_metadata is not set"), + + delegate_record: self + .instruction + .delegate_record + .expect("delegate_record is not set"), + + token_record: self + .instruction + .token_record + .expect("token_record is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self + .instruction + .spl_token_program + .expect("spl_token_program is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct MigrateCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/mint_new_edition_from_master_edition_via_token.rs b/clients/rust/src/generated/instructions/mint_new_edition_from_master_edition_via_token.rs new file mode 100644 index 00000000..af742b10 --- /dev/null +++ b/clients/rust/src/generated/instructions/mint_new_edition_from_master_edition_via_token.rs @@ -0,0 +1,703 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::MintNewEditionFromMasterEditionViaTokenArgs; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct MintNewEditionFromMasterEditionViaToken { + /// New Metadata key (pda of ['metadata', program id, mint id]) + pub new_metadata: solana_program::pubkey::Pubkey, + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + pub new_edition: solana_program::pubkey::Pubkey, + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) + pub master_edition: solana_program::pubkey::Pubkey, + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub new_mint: solana_program::pubkey::Pubkey, + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + pub edition_mark_pda: solana_program::pubkey::Pubkey, + /// Mint authority of new mint + pub new_mint_authority: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// owner of token account containing master token (#8) + pub token_account_owner: solana_program::pubkey::Pubkey, + /// token account containing token from master metadata mint + pub token_account: solana_program::pubkey::Pubkey, + /// Update authority info for new metadata + pub new_metadata_update_authority: solana_program::pubkey::Pubkey, + /// Master record metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Token program + pub token_program: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Rent info + pub rent: Option, +} + +impl MintNewEditionFromMasterEditionViaToken { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: MintNewEditionFromMasterEditionViaTokenInstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + accounts.push(solana_program::instruction::AccountMeta::new( + self.new_metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.new_edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.master_edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.new_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition_mark_pda, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.new_mint_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_account_owner, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.new_metadata_update_authority, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + rent, false, + )); + } + let mut data = MintNewEditionFromMasterEditionViaTokenInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct MintNewEditionFromMasterEditionViaTokenInstructionData { + discriminator: u8, +} + +impl MintNewEditionFromMasterEditionViaTokenInstructionData { + fn new() -> Self { + Self { discriminator: 11 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct MintNewEditionFromMasterEditionViaTokenInstructionArgs { + pub mint_new_edition_from_master_edition_via_token_args: + MintNewEditionFromMasterEditionViaTokenArgs, +} + +/// Instruction builder. +#[derive(Default)] +pub struct MintNewEditionFromMasterEditionViaTokenBuilder { + new_metadata: Option, + new_edition: Option, + master_edition: Option, + new_mint: Option, + edition_mark_pda: Option, + new_mint_authority: Option, + payer: Option, + token_account_owner: Option, + token_account: Option, + new_metadata_update_authority: Option, + metadata: Option, + token_program: Option, + system_program: Option, + rent: Option, + mint_new_edition_from_master_edition_via_token_args: + Option, +} + +impl MintNewEditionFromMasterEditionViaTokenBuilder { + pub fn new() -> Self { + Self::default() + } + /// New Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn new_metadata(&mut self, new_metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.new_metadata = Some(new_metadata); + self + } + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + #[inline(always)] + pub fn new_edition(&mut self, new_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.new_edition = Some(new_edition); + self + } + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn new_mint(&mut self, new_mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.new_mint = Some(new_mint); + self + } + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + #[inline(always)] + pub fn edition_mark_pda( + &mut self, + edition_mark_pda: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.edition_mark_pda = Some(edition_mark_pda); + self + } + /// Mint authority of new mint + #[inline(always)] + pub fn new_mint_authority( + &mut self, + new_mint_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.new_mint_authority = Some(new_mint_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// owner of token account containing master token (#8) + #[inline(always)] + pub fn token_account_owner( + &mut self, + token_account_owner: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.token_account_owner = Some(token_account_owner); + self + } + /// token account containing token from master metadata mint + #[inline(always)] + pub fn token_account(&mut self, token_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_account = Some(token_account); + self + } + /// Update authority info for new metadata + #[inline(always)] + pub fn new_metadata_update_authority( + &mut self, + new_metadata_update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.new_metadata_update_authority = Some(new_metadata_update_authority); + self + } + /// Master record metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self { + self.rent = Some(rent); + self + } + #[inline(always)] + pub fn mint_new_edition_from_master_edition_via_token_args( + &mut self, + mint_new_edition_from_master_edition_via_token_args: MintNewEditionFromMasterEditionViaTokenArgs, + ) -> &mut Self { + self.mint_new_edition_from_master_edition_via_token_args = + Some(mint_new_edition_from_master_edition_via_token_args); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = MintNewEditionFromMasterEditionViaToken { + new_metadata: self.new_metadata.expect("new_metadata is not set"), + new_edition: self.new_edition.expect("new_edition is not set"), + master_edition: self.master_edition.expect("master_edition is not set"), + new_mint: self.new_mint.expect("new_mint is not set"), + edition_mark_pda: self.edition_mark_pda.expect("edition_mark_pda is not set"), + new_mint_authority: self + .new_mint_authority + .expect("new_mint_authority is not set"), + payer: self.payer.expect("payer is not set"), + token_account_owner: self + .token_account_owner + .expect("token_account_owner is not set"), + token_account: self.token_account.expect("token_account is not set"), + new_metadata_update_authority: self + .new_metadata_update_authority + .expect("new_metadata_update_authority is not set"), + metadata: self.metadata.expect("metadata is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + rent: self.rent, + }; + let args = MintNewEditionFromMasterEditionViaTokenInstructionArgs { + mint_new_edition_from_master_edition_via_token_args: self + .mint_new_edition_from_master_edition_via_token_args + .clone() + .expect("mint_new_edition_from_master_edition_via_token_args is not set"), + }; + + accounts.instruction(args) + } +} + +/// `mint_new_edition_from_master_edition_via_token` CPI instruction. +pub struct MintNewEditionFromMasterEditionViaTokenCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// New Metadata key (pda of ['metadata', program id, mint id]) + pub new_metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + pub new_edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) + pub master_edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub new_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + pub edition_mark_pda: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint authority of new mint + pub new_mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// owner of token account containing master token (#8) + pub token_account_owner: &'a solana_program::account_info::AccountInfo<'a>, + /// token account containing token from master metadata mint + pub token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority info for new metadata + pub new_metadata_update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Master record metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Token program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Rent info + pub rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: MintNewEditionFromMasterEditionViaTokenInstructionArgs, +} + +impl<'a> MintNewEditionFromMasterEditionViaTokenCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.new_metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.new_edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.master_edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.new_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition_mark_pda.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.new_mint_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_account_owner.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.new_metadata_update_authority.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *rent.key, false, + )); + } + let mut data = MintNewEditionFromMasterEditionViaTokenInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.new_metadata.clone()); + account_infos.push(self.new_edition.clone()); + account_infos.push(self.master_edition.clone()); + account_infos.push(self.new_mint.clone()); + account_infos.push(self.edition_mark_pda.clone()); + account_infos.push(self.new_mint_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.token_account_owner.clone()); + account_infos.push(self.token_account.clone()); + account_infos.push(self.new_metadata_update_authority.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.system_program.clone()); + if let Some(rent) = self.rent { + account_infos.push(rent.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `mint_new_edition_from_master_edition_via_token` CPI instruction builder. +pub struct MintNewEditionFromMasterEditionViaTokenCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> MintNewEditionFromMasterEditionViaTokenCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new( + MintNewEditionFromMasterEditionViaTokenCpiBuilderInstruction { + __program: program, + new_metadata: None, + new_edition: None, + master_edition: None, + new_mint: None, + edition_mark_pda: None, + new_mint_authority: None, + payer: None, + token_account_owner: None, + token_account: None, + new_metadata_update_authority: None, + metadata: None, + token_program: None, + system_program: None, + rent: None, + mint_new_edition_from_master_edition_via_token_args: None, + }, + ); + Self { instruction } + } + /// New Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn new_metadata( + &mut self, + new_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_metadata = Some(new_metadata); + self + } + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + #[inline(always)] + pub fn new_edition( + &mut self, + new_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_edition = Some(new_edition); + self + } + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn new_mint( + &mut self, + new_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_mint = Some(new_mint); + self + } + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + #[inline(always)] + pub fn edition_mark_pda( + &mut self, + edition_mark_pda: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_mark_pda = Some(edition_mark_pda); + self + } + /// Mint authority of new mint + #[inline(always)] + pub fn new_mint_authority( + &mut self, + new_mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_mint_authority = Some(new_mint_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// owner of token account containing master token (#8) + #[inline(always)] + pub fn token_account_owner( + &mut self, + token_account_owner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_account_owner = Some(token_account_owner); + self + } + /// token account containing token from master metadata mint + #[inline(always)] + pub fn token_account( + &mut self, + token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_account = Some(token_account); + self + } + /// Update authority info for new metadata + #[inline(always)] + pub fn new_metadata_update_authority( + &mut self, + new_metadata_update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_metadata_update_authority = Some(new_metadata_update_authority); + self + } + /// Master record metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.rent = Some(rent); + self + } + #[inline(always)] + pub fn mint_new_edition_from_master_edition_via_token_args( + &mut self, + mint_new_edition_from_master_edition_via_token_args: MintNewEditionFromMasterEditionViaTokenArgs, + ) -> &mut Self { + self.instruction + .mint_new_edition_from_master_edition_via_token_args = + Some(mint_new_edition_from_master_edition_via_token_args); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> MintNewEditionFromMasterEditionViaTokenCpi<'a> { + let args = MintNewEditionFromMasterEditionViaTokenInstructionArgs { + mint_new_edition_from_master_edition_via_token_args: self + .instruction + .mint_new_edition_from_master_edition_via_token_args + .clone() + .expect("mint_new_edition_from_master_edition_via_token_args is not set"), + }; + + MintNewEditionFromMasterEditionViaTokenCpi { + __program: self.instruction.__program, + + new_metadata: self + .instruction + .new_metadata + .expect("new_metadata is not set"), + + new_edition: self + .instruction + .new_edition + .expect("new_edition is not set"), + + master_edition: self + .instruction + .master_edition + .expect("master_edition is not set"), + + new_mint: self.instruction.new_mint.expect("new_mint is not set"), + + edition_mark_pda: self + .instruction + .edition_mark_pda + .expect("edition_mark_pda is not set"), + + new_mint_authority: self + .instruction + .new_mint_authority + .expect("new_mint_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + token_account_owner: self + .instruction + .token_account_owner + .expect("token_account_owner is not set"), + + token_account: self + .instruction + .token_account + .expect("token_account is not set"), + + new_metadata_update_authority: self + .instruction + .new_metadata_update_authority + .expect("new_metadata_update_authority is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + rent: self.instruction.rent, + __args: args, + } + } +} + +struct MintNewEditionFromMasterEditionViaTokenCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + new_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_mark_pda: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_mint_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_account_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_metadata_update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint_new_edition_from_master_edition_via_token_args: + Option, +} diff --git a/clients/rust/src/generated/instructions/mint_new_edition_from_master_edition_via_vault_proxy.rs b/clients/rust/src/generated/instructions/mint_new_edition_from_master_edition_via_vault_proxy.rs new file mode 100644 index 00000000..8e7f29f7 --- /dev/null +++ b/clients/rust/src/generated/instructions/mint_new_edition_from_master_edition_via_vault_proxy.rs @@ -0,0 +1,820 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::MintNewEditionFromMasterEditionViaTokenArgs; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct MintNewEditionFromMasterEditionViaVaultProxy { + /// New Metadata key (pda of ['metadata', program id, mint id]) + pub new_metadata: solana_program::pubkey::Pubkey, + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + pub new_edition: solana_program::pubkey::Pubkey, + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'] + pub master_edition: solana_program::pubkey::Pubkey, + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub new_mint: solana_program::pubkey::Pubkey, + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + pub edition_mark_pda: solana_program::pubkey::Pubkey, + /// Mint authority of new mint + pub new_mint_authority: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// Vault authority + pub vault_authority: solana_program::pubkey::Pubkey, + /// Safety deposit token store account + pub safety_deposit_store: solana_program::pubkey::Pubkey, + /// Safety deposit box + pub safety_deposit_box: solana_program::pubkey::Pubkey, + /// Vault + pub vault: solana_program::pubkey::Pubkey, + /// Update authority info for new metadata + pub new_metadata_update_authority: solana_program::pubkey::Pubkey, + /// Master record metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Token program + pub token_program: solana_program::pubkey::Pubkey, + /// Token vault program + pub token_vault_program: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Rent info + pub rent: Option, +} + +impl MintNewEditionFromMasterEditionViaVaultProxy { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: MintNewEditionFromMasterEditionViaVaultProxyInstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(17); + accounts.push(solana_program::instruction::AccountMeta::new( + self.new_metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.new_edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.master_edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.new_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition_mark_pda, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.new_mint_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.vault_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.safety_deposit_store, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.safety_deposit_box, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.vault, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.new_metadata_update_authority, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_vault_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + rent, false, + )); + } + let mut data = MintNewEditionFromMasterEditionViaVaultProxyInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct MintNewEditionFromMasterEditionViaVaultProxyInstructionData { + discriminator: u8, +} + +impl MintNewEditionFromMasterEditionViaVaultProxyInstructionData { + fn new() -> Self { + Self { discriminator: 13 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct MintNewEditionFromMasterEditionViaVaultProxyInstructionArgs { + pub mint_new_edition_from_master_edition_via_token_args: + MintNewEditionFromMasterEditionViaTokenArgs, +} + +/// Instruction builder. +#[derive(Default)] +pub struct MintNewEditionFromMasterEditionViaVaultProxyBuilder { + new_metadata: Option, + new_edition: Option, + master_edition: Option, + new_mint: Option, + edition_mark_pda: Option, + new_mint_authority: Option, + payer: Option, + vault_authority: Option, + safety_deposit_store: Option, + safety_deposit_box: Option, + vault: Option, + new_metadata_update_authority: Option, + metadata: Option, + token_program: Option, + token_vault_program: Option, + system_program: Option, + rent: Option, + mint_new_edition_from_master_edition_via_token_args: + Option, +} + +impl MintNewEditionFromMasterEditionViaVaultProxyBuilder { + pub fn new() -> Self { + Self::default() + } + /// New Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn new_metadata(&mut self, new_metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.new_metadata = Some(new_metadata); + self + } + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + #[inline(always)] + pub fn new_edition(&mut self, new_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.new_edition = Some(new_edition); + self + } + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'] + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn new_mint(&mut self, new_mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.new_mint = Some(new_mint); + self + } + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + #[inline(always)] + pub fn edition_mark_pda( + &mut self, + edition_mark_pda: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.edition_mark_pda = Some(edition_mark_pda); + self + } + /// Mint authority of new mint + #[inline(always)] + pub fn new_mint_authority( + &mut self, + new_mint_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.new_mint_authority = Some(new_mint_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Vault authority + #[inline(always)] + pub fn vault_authority( + &mut self, + vault_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.vault_authority = Some(vault_authority); + self + } + /// Safety deposit token store account + #[inline(always)] + pub fn safety_deposit_store( + &mut self, + safety_deposit_store: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.safety_deposit_store = Some(safety_deposit_store); + self + } + /// Safety deposit box + #[inline(always)] + pub fn safety_deposit_box( + &mut self, + safety_deposit_box: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.safety_deposit_box = Some(safety_deposit_box); + self + } + /// Vault + #[inline(always)] + pub fn vault(&mut self, vault: solana_program::pubkey::Pubkey) -> &mut Self { + self.vault = Some(vault); + self + } + /// Update authority info for new metadata + #[inline(always)] + pub fn new_metadata_update_authority( + &mut self, + new_metadata_update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.new_metadata_update_authority = Some(new_metadata_update_authority); + self + } + /// Master record metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// Token vault program + #[inline(always)] + pub fn token_vault_program( + &mut self, + token_vault_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.token_vault_program = Some(token_vault_program); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self { + self.rent = Some(rent); + self + } + #[inline(always)] + pub fn mint_new_edition_from_master_edition_via_token_args( + &mut self, + mint_new_edition_from_master_edition_via_token_args: MintNewEditionFromMasterEditionViaTokenArgs, + ) -> &mut Self { + self.mint_new_edition_from_master_edition_via_token_args = + Some(mint_new_edition_from_master_edition_via_token_args); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = MintNewEditionFromMasterEditionViaVaultProxy { + new_metadata: self.new_metadata.expect("new_metadata is not set"), + new_edition: self.new_edition.expect("new_edition is not set"), + master_edition: self.master_edition.expect("master_edition is not set"), + new_mint: self.new_mint.expect("new_mint is not set"), + edition_mark_pda: self.edition_mark_pda.expect("edition_mark_pda is not set"), + new_mint_authority: self + .new_mint_authority + .expect("new_mint_authority is not set"), + payer: self.payer.expect("payer is not set"), + vault_authority: self.vault_authority.expect("vault_authority is not set"), + safety_deposit_store: self + .safety_deposit_store + .expect("safety_deposit_store is not set"), + safety_deposit_box: self + .safety_deposit_box + .expect("safety_deposit_box is not set"), + vault: self.vault.expect("vault is not set"), + new_metadata_update_authority: self + .new_metadata_update_authority + .expect("new_metadata_update_authority is not set"), + metadata: self.metadata.expect("metadata is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + token_vault_program: self + .token_vault_program + .expect("token_vault_program is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + rent: self.rent, + }; + let args = MintNewEditionFromMasterEditionViaVaultProxyInstructionArgs { + mint_new_edition_from_master_edition_via_token_args: self + .mint_new_edition_from_master_edition_via_token_args + .clone() + .expect("mint_new_edition_from_master_edition_via_token_args is not set"), + }; + + accounts.instruction(args) + } +} + +/// `mint_new_edition_from_master_edition_via_vault_proxy` CPI instruction. +pub struct MintNewEditionFromMasterEditionViaVaultProxyCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// New Metadata key (pda of ['metadata', program id, mint id]) + pub new_metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + pub new_edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'] + pub master_edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub new_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + pub edition_mark_pda: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint authority of new mint + pub new_mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Vault authority + pub vault_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Safety deposit token store account + pub safety_deposit_store: &'a solana_program::account_info::AccountInfo<'a>, + /// Safety deposit box + pub safety_deposit_box: &'a solana_program::account_info::AccountInfo<'a>, + /// Vault + pub vault: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority info for new metadata + pub new_metadata_update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Master record metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Token program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token vault program + pub token_vault_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Rent info + pub rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: MintNewEditionFromMasterEditionViaVaultProxyInstructionArgs, +} + +impl<'a> MintNewEditionFromMasterEditionViaVaultProxyCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(17); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.new_metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.new_edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.master_edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.new_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition_mark_pda.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.new_mint_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.vault_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.safety_deposit_store.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.safety_deposit_box.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.vault.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.new_metadata_update_authority.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_vault_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *rent.key, false, + )); + } + let mut data = MintNewEditionFromMasterEditionViaVaultProxyInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(17 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.new_metadata.clone()); + account_infos.push(self.new_edition.clone()); + account_infos.push(self.master_edition.clone()); + account_infos.push(self.new_mint.clone()); + account_infos.push(self.edition_mark_pda.clone()); + account_infos.push(self.new_mint_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.vault_authority.clone()); + account_infos.push(self.safety_deposit_store.clone()); + account_infos.push(self.safety_deposit_box.clone()); + account_infos.push(self.vault.clone()); + account_infos.push(self.new_metadata_update_authority.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.token_vault_program.clone()); + account_infos.push(self.system_program.clone()); + if let Some(rent) = self.rent { + account_infos.push(rent.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `mint_new_edition_from_master_edition_via_vault_proxy` CPI instruction builder. +pub struct MintNewEditionFromMasterEditionViaVaultProxyCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> MintNewEditionFromMasterEditionViaVaultProxyCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new( + MintNewEditionFromMasterEditionViaVaultProxyCpiBuilderInstruction { + __program: program, + new_metadata: None, + new_edition: None, + master_edition: None, + new_mint: None, + edition_mark_pda: None, + new_mint_authority: None, + payer: None, + vault_authority: None, + safety_deposit_store: None, + safety_deposit_box: None, + vault: None, + new_metadata_update_authority: None, + metadata: None, + token_program: None, + token_vault_program: None, + system_program: None, + rent: None, + mint_new_edition_from_master_edition_via_token_args: None, + }, + ); + Self { instruction } + } + /// New Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn new_metadata( + &mut self, + new_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_metadata = Some(new_metadata); + self + } + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + #[inline(always)] + pub fn new_edition( + &mut self, + new_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_edition = Some(new_edition); + self + } + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'] + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn new_mint( + &mut self, + new_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_mint = Some(new_mint); + self + } + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + #[inline(always)] + pub fn edition_mark_pda( + &mut self, + edition_mark_pda: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_mark_pda = Some(edition_mark_pda); + self + } + /// Mint authority of new mint + #[inline(always)] + pub fn new_mint_authority( + &mut self, + new_mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_mint_authority = Some(new_mint_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Vault authority + #[inline(always)] + pub fn vault_authority( + &mut self, + vault_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.vault_authority = Some(vault_authority); + self + } + /// Safety deposit token store account + #[inline(always)] + pub fn safety_deposit_store( + &mut self, + safety_deposit_store: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.safety_deposit_store = Some(safety_deposit_store); + self + } + /// Safety deposit box + #[inline(always)] + pub fn safety_deposit_box( + &mut self, + safety_deposit_box: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.safety_deposit_box = Some(safety_deposit_box); + self + } + /// Vault + #[inline(always)] + pub fn vault(&mut self, vault: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.vault = Some(vault); + self + } + /// Update authority info for new metadata + #[inline(always)] + pub fn new_metadata_update_authority( + &mut self, + new_metadata_update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.new_metadata_update_authority = Some(new_metadata_update_authority); + self + } + /// Master record metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + /// Token vault program + #[inline(always)] + pub fn token_vault_program( + &mut self, + token_vault_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_vault_program = Some(token_vault_program); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.rent = Some(rent); + self + } + #[inline(always)] + pub fn mint_new_edition_from_master_edition_via_token_args( + &mut self, + mint_new_edition_from_master_edition_via_token_args: MintNewEditionFromMasterEditionViaTokenArgs, + ) -> &mut Self { + self.instruction + .mint_new_edition_from_master_edition_via_token_args = + Some(mint_new_edition_from_master_edition_via_token_args); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> MintNewEditionFromMasterEditionViaVaultProxyCpi<'a> { + let args = MintNewEditionFromMasterEditionViaVaultProxyInstructionArgs { + mint_new_edition_from_master_edition_via_token_args: self + .instruction + .mint_new_edition_from_master_edition_via_token_args + .clone() + .expect("mint_new_edition_from_master_edition_via_token_args is not set"), + }; + + MintNewEditionFromMasterEditionViaVaultProxyCpi { + __program: self.instruction.__program, + + new_metadata: self + .instruction + .new_metadata + .expect("new_metadata is not set"), + + new_edition: self + .instruction + .new_edition + .expect("new_edition is not set"), + + master_edition: self + .instruction + .master_edition + .expect("master_edition is not set"), + + new_mint: self.instruction.new_mint.expect("new_mint is not set"), + + edition_mark_pda: self + .instruction + .edition_mark_pda + .expect("edition_mark_pda is not set"), + + new_mint_authority: self + .instruction + .new_mint_authority + .expect("new_mint_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + vault_authority: self + .instruction + .vault_authority + .expect("vault_authority is not set"), + + safety_deposit_store: self + .instruction + .safety_deposit_store + .expect("safety_deposit_store is not set"), + + safety_deposit_box: self + .instruction + .safety_deposit_box + .expect("safety_deposit_box is not set"), + + vault: self.instruction.vault.expect("vault is not set"), + + new_metadata_update_authority: self + .instruction + .new_metadata_update_authority + .expect("new_metadata_update_authority is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + token_vault_program: self + .instruction + .token_vault_program + .expect("token_vault_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + rent: self.instruction.rent, + __args: args, + } + } +} + +struct MintNewEditionFromMasterEditionViaVaultProxyCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + new_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_mark_pda: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_mint_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + vault_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + safety_deposit_store: Option<&'a solana_program::account_info::AccountInfo<'a>>, + safety_deposit_box: Option<&'a solana_program::account_info::AccountInfo<'a>>, + vault: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_metadata_update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_vault_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint_new_edition_from_master_edition_via_token_args: + Option, +} diff --git a/clients/rust/src/generated/instructions/mint_v1.rs b/clients/rust/src/generated/instructions/mint_v1.rs new file mode 100644 index 00000000..4e7acad6 --- /dev/null +++ b/clients/rust/src/generated/instructions/mint_v1.rs @@ -0,0 +1,819 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct MintV1 { + /// Token or Associated Token account + pub token: solana_program::pubkey::Pubkey, + /// Owner of the token account + pub token_owner: Option, + /// Metadata account (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of token asset + pub mint: solana_program::pubkey::Pubkey, + /// (Mint or Update) authority + pub authority: solana_program::pubkey::Pubkey, + /// Metadata delegate record + pub delegate_record: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token program + pub spl_token_program: solana_program::pubkey::Pubkey, + /// SPL Associated Token Account program + pub spl_ata_program: solana_program::pubkey::Pubkey, + /// Token Authorization Rules program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl MintV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: MintV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(15); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + if let Some(token_owner) = self.token_owner { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token_owner, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_ata_program, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = MintV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct MintV1InstructionData { + discriminator: u8, + mint_v1_discriminator: u8, +} + +impl MintV1InstructionData { + fn new() -> Self { + Self { + discriminator: 43, + mint_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct MintV1InstructionArgs { + pub amount: u64, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct MintV1Builder { + token: Option, + token_owner: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + authority: Option, + delegate_record: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + spl_ata_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + amount: Option, + authorization_data: Option, +} + +impl MintV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Token or Associated Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// `[optional account]` + /// Owner of the token account + #[inline(always)] + pub fn token_owner(&mut self, token_owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_owner = Some(token_owner); + self + } + /// Metadata account (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// (Mint or Update) authority + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Metadata delegate record + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// SPL Associated Token Account program + #[inline(always)] + pub fn spl_ata_program( + &mut self, + spl_ata_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_ata_program = Some(spl_ata_program); + self + } + /// `[optional account]` + /// Token Authorization Rules program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = MintV1 { + token: self.token.expect("token is not set"), + token_owner: self.token_owner, + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!( + "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = MintV1InstructionArgs { + amount: self.amount.clone().unwrap_or(1), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `mint_v1` CPI instruction. +pub struct MintV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token or Associated Token account + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Owner of the token account + pub token_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Metadata account (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of token asset + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// (Mint or Update) authority + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata delegate record + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token program + pub spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Associated Token Account program + pub spl_ata_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: MintV1InstructionArgs, +} + +impl<'a> MintV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(15); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + if let Some(token_owner) = self.token_owner { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token_owner.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_ata_program.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = MintV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(15 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.token.clone()); + if let Some(token_owner) = self.token_owner { + account_infos.push(token_owner.clone()); + } + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + account_infos.push(self.spl_token_program.clone()); + account_infos.push(self.spl_ata_program.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `mint_v1` CPI instruction builder. +pub struct MintV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> MintV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(MintV1CpiBuilderInstruction { + __program: program, + token: None, + token_owner: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + authority: None, + delegate_record: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + spl_ata_program: None, + authorization_rules_program: None, + authorization_rules: None, + amount: None, + authorization_data: None, + }); + Self { instruction } + } + /// Token or Associated Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// `[optional account]` + /// Owner of the token account + #[inline(always)] + pub fn token_owner( + &mut self, + token_owner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_owner = Some(token_owner); + self + } + /// Metadata account (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// (Mint or Update) authority + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Metadata delegate record + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// SPL Associated Token Account program + #[inline(always)] + pub fn spl_ata_program( + &mut self, + spl_ata_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_ata_program = Some(spl_ata_program); + self + } + /// `[optional account]` + /// Token Authorization Rules program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> MintV1Cpi<'a> { + let args = MintV1InstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + authorization_data: self.instruction.authorization_data.clone(), + }; + + MintV1Cpi { + __program: self.instruction.__program, + + token: self.instruction.token.expect("token is not set"), + + token_owner: self.instruction.token_owner, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self + .instruction + .spl_token_program + .expect("spl_token_program is not set"), + + spl_ata_program: self + .instruction + .spl_ata_program + .expect("spl_ata_program is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct MintV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_ata_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/mod.rs b/clients/rust/src/generated/instructions/mod.rs new file mode 100644 index 00000000..33965ba6 --- /dev/null +++ b/clients/rust/src/generated/instructions/mod.rs @@ -0,0 +1,172 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +pub mod approve_collection_authority; +pub mod approve_use_authority; +pub mod bubblegum_set_collection_size; +pub mod burn_edition_nft; +pub mod burn_nft; +pub mod burn_v1; +pub mod close_escrow_account; +pub mod collect; +pub mod convert_master_edition_v1_to_v2; +pub mod create_escrow_account; +pub mod create_master_edition_v3; +pub mod create_metadata_account_v3; +pub mod create_v1; +pub mod delegate_authority_item_v1; +pub mod delegate_collection_item_v1; +pub mod delegate_collection_v1; +pub mod delegate_data_item_v1; +pub mod delegate_data_v1; +pub mod delegate_locked_transfer_v1; +pub mod delegate_programmable_config_item_v1; +pub mod delegate_programmable_config_v1; +pub mod delegate_sale_v1; +pub mod delegate_staking_v1; +pub mod delegate_standard_v1; +pub mod delegate_transfer_v1; +pub mod delegate_utility_v1; +pub mod deprecated_mint_new_edition_from_master_edition_via_printing_token; +pub mod freeze_delegated_account; +pub mod lock_v1; +pub mod migrate; +pub mod mint_new_edition_from_master_edition_via_token; +pub mod mint_new_edition_from_master_edition_via_vault_proxy; +pub mod mint_v1; +pub mod print_v1; +pub mod puff_metadata; +pub mod remove_creator_verification; +pub mod revoke_authority_item_v1; +pub mod revoke_collection_authority; +pub mod revoke_collection_item_v1; +pub mod revoke_collection_v1; +pub mod revoke_data_item_v1; +pub mod revoke_data_v1; +pub mod revoke_locked_transfer_v1; +pub mod revoke_migration_v1; +pub mod revoke_programmable_config_item_v1; +pub mod revoke_programmable_config_v1; +pub mod revoke_sale_v1; +pub mod revoke_staking_v1; +pub mod revoke_standard_v1; +pub mod revoke_transfer_v1; +pub mod revoke_use_authority; +pub mod revoke_utility_v1; +pub mod set_and_verify_collection; +pub mod set_and_verify_sized_collection_item; +pub mod set_collection_size; +pub mod set_token_standard; +pub mod sign_metadata; +pub mod thaw_delegated_account; +pub mod transfer_out_of_escrow; +pub mod transfer_v1; +pub mod unlock_v1; +pub mod unverify_collection; +pub mod unverify_collection_v1; +pub mod unverify_creator_v1; +pub mod unverify_sized_collection_item; +pub mod update_as_authority_item_delegate_v2; +pub mod update_as_collection_delegate_v2; +pub mod update_as_collection_item_delegate_v2; +pub mod update_as_data_delegate_v2; +pub mod update_as_data_item_delegate_v2; +pub mod update_as_programmable_config_delegate_v2; +pub mod update_as_programmable_config_item_delegate_v2; +pub mod update_as_update_authority_v2; +pub mod update_metadata_account_v2; +pub mod update_primary_sale_happened_via_token; +pub mod update_v1; +pub mod use_v1; +pub mod utilize; +pub mod verify_collection; +pub mod verify_collection_v1; +pub mod verify_creator_v1; +pub mod verify_sized_collection_item; + +pub use self::approve_collection_authority::*; +pub use self::approve_use_authority::*; +pub use self::bubblegum_set_collection_size::*; +pub use self::burn_edition_nft::*; +pub use self::burn_nft::*; +pub use self::burn_v1::*; +pub use self::close_escrow_account::*; +pub use self::collect::*; +pub use self::convert_master_edition_v1_to_v2::*; +pub use self::create_escrow_account::*; +pub use self::create_master_edition_v3::*; +pub use self::create_metadata_account_v3::*; +pub use self::create_v1::*; +pub use self::delegate_authority_item_v1::*; +pub use self::delegate_collection_item_v1::*; +pub use self::delegate_collection_v1::*; +pub use self::delegate_data_item_v1::*; +pub use self::delegate_data_v1::*; +pub use self::delegate_locked_transfer_v1::*; +pub use self::delegate_programmable_config_item_v1::*; +pub use self::delegate_programmable_config_v1::*; +pub use self::delegate_sale_v1::*; +pub use self::delegate_staking_v1::*; +pub use self::delegate_standard_v1::*; +pub use self::delegate_transfer_v1::*; +pub use self::delegate_utility_v1::*; +pub use self::deprecated_mint_new_edition_from_master_edition_via_printing_token::*; +pub use self::freeze_delegated_account::*; +pub use self::lock_v1::*; +pub use self::migrate::*; +pub use self::mint_new_edition_from_master_edition_via_token::*; +pub use self::mint_new_edition_from_master_edition_via_vault_proxy::*; +pub use self::mint_v1::*; +pub use self::print_v1::*; +pub use self::puff_metadata::*; +pub use self::remove_creator_verification::*; +pub use self::revoke_authority_item_v1::*; +pub use self::revoke_collection_authority::*; +pub use self::revoke_collection_item_v1::*; +pub use self::revoke_collection_v1::*; +pub use self::revoke_data_item_v1::*; +pub use self::revoke_data_v1::*; +pub use self::revoke_locked_transfer_v1::*; +pub use self::revoke_migration_v1::*; +pub use self::revoke_programmable_config_item_v1::*; +pub use self::revoke_programmable_config_v1::*; +pub use self::revoke_sale_v1::*; +pub use self::revoke_staking_v1::*; +pub use self::revoke_standard_v1::*; +pub use self::revoke_transfer_v1::*; +pub use self::revoke_use_authority::*; +pub use self::revoke_utility_v1::*; +pub use self::set_and_verify_collection::*; +pub use self::set_and_verify_sized_collection_item::*; +pub use self::set_collection_size::*; +pub use self::set_token_standard::*; +pub use self::sign_metadata::*; +pub use self::thaw_delegated_account::*; +pub use self::transfer_out_of_escrow::*; +pub use self::transfer_v1::*; +pub use self::unlock_v1::*; +pub use self::unverify_collection::*; +pub use self::unverify_collection_v1::*; +pub use self::unverify_creator_v1::*; +pub use self::unverify_sized_collection_item::*; +pub use self::update_as_authority_item_delegate_v2::*; +pub use self::update_as_collection_delegate_v2::*; +pub use self::update_as_collection_item_delegate_v2::*; +pub use self::update_as_data_delegate_v2::*; +pub use self::update_as_data_item_delegate_v2::*; +pub use self::update_as_programmable_config_delegate_v2::*; +pub use self::update_as_programmable_config_item_delegate_v2::*; +pub use self::update_as_update_authority_v2::*; +pub use self::update_metadata_account_v2::*; +pub use self::update_primary_sale_happened_via_token::*; +pub use self::update_v1::*; +pub use self::use_v1::*; +pub use self::utilize::*; +pub use self::verify_collection::*; +pub use self::verify_collection_v1::*; +pub use self::verify_creator_v1::*; +pub use self::verify_sized_collection_item::*; diff --git a/clients/rust/src/generated/instructions/print_v1.rs b/clients/rust/src/generated/instructions/print_v1.rs new file mode 100644 index 00000000..c8be17ef --- /dev/null +++ b/clients/rust/src/generated/instructions/print_v1.rs @@ -0,0 +1,896 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct PrintV1 { + /// New Metadata key (pda of ['metadata', program id, mint id]) + pub edition_metadata: solana_program::pubkey::Pubkey, + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + pub edition: solana_program::pubkey::Pubkey, + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub edition_mint: (solana_program::pubkey::Pubkey, bool), + /// Owner of the token account of new token + pub edition_token_account_owner: solana_program::pubkey::Pubkey, + /// Token account of new token + pub edition_token_account: solana_program::pubkey::Pubkey, + /// Mint authority of new mint + pub edition_mint_authority: solana_program::pubkey::Pubkey, + /// Token record account + pub edition_token_record: Option, + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) + pub master_edition: solana_program::pubkey::Pubkey, + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + pub edition_marker_pda: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// owner of token account containing master token + pub master_token_account_owner: solana_program::pubkey::Pubkey, + /// token account containing token from master metadata mint + pub master_token_account: solana_program::pubkey::Pubkey, + /// Master record metadata account + pub master_metadata: solana_program::pubkey::Pubkey, + /// The update authority of the master edition. + pub update_authority: solana_program::pubkey::Pubkey, + /// Token program + pub spl_token_program: solana_program::pubkey::Pubkey, + /// SPL Associated Token Account program + pub spl_ata_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, +} + +impl PrintV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: PrintV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(18); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition_metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition_mint.0, + self.edition_mint.1, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.edition_token_account_owner, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition_token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.edition_mint_authority, + true, + )); + if let Some(edition_token_record) = self.edition_token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + edition_token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.master_edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.edition_marker_pda, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.master_token_account_owner, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.master_token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.master_metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.update_authority, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_ata_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + let mut data = PrintV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct PrintV1InstructionData { + discriminator: u8, + print_v1_discriminator: u8, +} + +impl PrintV1InstructionData { + fn new() -> Self { + Self { + discriminator: 55, + print_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct PrintV1InstructionArgs { + pub edition_number: u64, +} + +/// Instruction builder. +#[derive(Default)] +pub struct PrintV1Builder { + edition_metadata: Option, + edition: Option, + edition_mint: Option<(solana_program::pubkey::Pubkey, bool)>, + edition_token_account_owner: Option, + edition_token_account: Option, + edition_mint_authority: Option, + edition_token_record: Option, + master_edition: Option, + edition_marker_pda: Option, + payer: Option, + master_token_account_owner: Option, + master_token_account: Option, + master_metadata: Option, + update_authority: Option, + spl_token_program: Option, + spl_ata_program: Option, + sysvar_instructions: Option, + system_program: Option, + edition_number: Option, +} + +impl PrintV1Builder { + pub fn new() -> Self { + Self::default() + } + /// New Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn edition_metadata( + &mut self, + edition_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.edition_metadata = Some(edition_metadata); + self + } + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn edition_mint( + &mut self, + edition_mint: solana_program::pubkey::Pubkey, + as_signer: bool, + ) -> &mut Self { + self.edition_mint = Some((edition_mint, as_signer)); + self + } + /// Owner of the token account of new token + #[inline(always)] + pub fn edition_token_account_owner( + &mut self, + edition_token_account_owner: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.edition_token_account_owner = Some(edition_token_account_owner); + self + } + /// Token account of new token + #[inline(always)] + pub fn edition_token_account( + &mut self, + edition_token_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.edition_token_account = Some(edition_token_account); + self + } + /// Mint authority of new mint + #[inline(always)] + pub fn edition_mint_authority( + &mut self, + edition_mint_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.edition_mint_authority = Some(edition_mint_authority); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn edition_token_record( + &mut self, + edition_token_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.edition_token_record = Some(edition_token_record); + self + } + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + #[inline(always)] + pub fn edition_marker_pda( + &mut self, + edition_marker_pda: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.edition_marker_pda = Some(edition_marker_pda); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// owner of token account containing master token + #[inline(always)] + pub fn master_token_account_owner( + &mut self, + master_token_account_owner: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_token_account_owner = Some(master_token_account_owner); + self + } + /// token account containing token from master metadata mint + #[inline(always)] + pub fn master_token_account( + &mut self, + master_token_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_token_account = Some(master_token_account); + self + } + /// Master record metadata account + #[inline(always)] + pub fn master_metadata( + &mut self, + master_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.master_metadata = Some(master_metadata); + self + } + /// The update authority of the master edition. + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.update_authority = Some(update_authority); + self + } + /// Token program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// SPL Associated Token Account program + #[inline(always)] + pub fn spl_ata_program( + &mut self, + spl_ata_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_ata_program = Some(spl_ata_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn edition_number(&mut self, edition_number: u64) -> &mut Self { + self.edition_number = Some(edition_number); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = PrintV1 { + edition_metadata: self.edition_metadata.expect("edition_metadata is not set"), + edition: self.edition.expect("edition is not set"), + edition_mint: self.edition_mint.expect("edition_mint is not set"), + edition_token_account_owner: self + .edition_token_account_owner + .expect("edition_token_account_owner is not set"), + edition_token_account: self + .edition_token_account + .expect("edition_token_account is not set"), + edition_mint_authority: self + .edition_mint_authority + .expect("edition_mint_authority is not set"), + edition_token_record: self.edition_token_record, + master_edition: self.master_edition.expect("master_edition is not set"), + edition_marker_pda: self + .edition_marker_pda + .expect("edition_marker_pda is not set"), + payer: self.payer.expect("payer is not set"), + master_token_account_owner: self + .master_token_account_owner + .expect("master_token_account_owner is not set"), + master_token_account: self + .master_token_account + .expect("master_token_account is not set"), + master_metadata: self.master_metadata.expect("master_metadata is not set"), + update_authority: self.update_authority.expect("update_authority is not set"), + spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!( + "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + )), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + }; + let args = PrintV1InstructionArgs { + edition_number: self + .edition_number + .clone() + .expect("edition_number is not set"), + }; + + accounts.instruction(args) + } +} + +/// `print_v1` CPI instruction. +pub struct PrintV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// New Metadata key (pda of ['metadata', program id, mint id]) + pub edition_metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + pub edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + pub edition_mint: (&'a solana_program::account_info::AccountInfo<'a>, bool), + /// Owner of the token account of new token + pub edition_token_account_owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of new token + pub edition_token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint authority of new mint + pub edition_mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Token record account + pub edition_token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) + pub master_edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + pub edition_marker_pda: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// owner of token account containing master token + pub master_token_account_owner: &'a solana_program::account_info::AccountInfo<'a>, + /// token account containing token from master metadata mint + pub master_token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Master record metadata account + pub master_metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// The update authority of the master edition. + pub update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Token program + pub spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Associated Token Account program + pub spl_ata_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: PrintV1InstructionArgs, +} + +impl<'a> PrintV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(18); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition_metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition_mint.0.key, + self.edition_mint.1, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.edition_token_account_owner.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition_token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.edition_mint_authority.key, + true, + )); + if let Some(edition_token_record) = self.edition_token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *edition_token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.master_edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.edition_marker_pda.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.master_token_account_owner.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.master_token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.master_metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.update_authority.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_ata_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + let mut data = PrintV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(18 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.edition_metadata.clone()); + account_infos.push(self.edition.clone()); + account_infos.push(self.edition_mint.0.clone()); + account_infos.push(self.edition_token_account_owner.clone()); + account_infos.push(self.edition_token_account.clone()); + account_infos.push(self.edition_mint_authority.clone()); + if let Some(edition_token_record) = self.edition_token_record { + account_infos.push(edition_token_record.clone()); + } + account_infos.push(self.master_edition.clone()); + account_infos.push(self.edition_marker_pda.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.master_token_account_owner.clone()); + account_infos.push(self.master_token_account.clone()); + account_infos.push(self.master_metadata.clone()); + account_infos.push(self.update_authority.clone()); + account_infos.push(self.spl_token_program.clone()); + account_infos.push(self.spl_ata_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + account_infos.push(self.system_program.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `print_v1` CPI instruction builder. +pub struct PrintV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> PrintV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(PrintV1CpiBuilderInstruction { + __program: program, + edition_metadata: None, + edition: None, + edition_mint: None, + edition_token_account_owner: None, + edition_token_account: None, + edition_mint_authority: None, + edition_token_record: None, + master_edition: None, + edition_marker_pda: None, + payer: None, + master_token_account_owner: None, + master_token_account: None, + master_metadata: None, + update_authority: None, + spl_token_program: None, + spl_ata_program: None, + sysvar_instructions: None, + system_program: None, + edition_number: None, + }); + Self { instruction } + } + /// New Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn edition_metadata( + &mut self, + edition_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_metadata = Some(edition_metadata); + self + } + /// New Edition (pda of ['metadata', program id, mint id, 'edition']) + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY + #[inline(always)] + pub fn edition_mint( + &mut self, + edition_mint: &'a solana_program::account_info::AccountInfo<'a>, + as_signer: bool, + ) -> &mut Self { + self.instruction.edition_mint = Some((edition_mint, as_signer)); + self + } + /// Owner of the token account of new token + #[inline(always)] + pub fn edition_token_account_owner( + &mut self, + edition_token_account_owner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_token_account_owner = Some(edition_token_account_owner); + self + } + /// Token account of new token + #[inline(always)] + pub fn edition_token_account( + &mut self, + edition_token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_token_account = Some(edition_token_account); + self + } + /// Mint authority of new mint + #[inline(always)] + pub fn edition_mint_authority( + &mut self, + edition_mint_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_mint_authority = Some(edition_mint_authority); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn edition_token_record( + &mut self, + edition_token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_token_record = Some(edition_token_record); + self + } + /// Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). + #[inline(always)] + pub fn edition_marker_pda( + &mut self, + edition_marker_pda: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition_marker_pda = Some(edition_marker_pda); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// owner of token account containing master token + #[inline(always)] + pub fn master_token_account_owner( + &mut self, + master_token_account_owner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_token_account_owner = Some(master_token_account_owner); + self + } + /// token account containing token from master metadata mint + #[inline(always)] + pub fn master_token_account( + &mut self, + master_token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_token_account = Some(master_token_account); + self + } + /// Master record metadata account + #[inline(always)] + pub fn master_metadata( + &mut self, + master_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_metadata = Some(master_metadata); + self + } + /// The update authority of the master edition. + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.update_authority = Some(update_authority); + self + } + /// Token program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// SPL Associated Token Account program + #[inline(always)] + pub fn spl_ata_program( + &mut self, + spl_ata_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_ata_program = Some(spl_ata_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn edition_number(&mut self, edition_number: u64) -> &mut Self { + self.instruction.edition_number = Some(edition_number); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> PrintV1Cpi<'a> { + let args = PrintV1InstructionArgs { + edition_number: self + .instruction + .edition_number + .clone() + .expect("edition_number is not set"), + }; + + PrintV1Cpi { + __program: self.instruction.__program, + + edition_metadata: self + .instruction + .edition_metadata + .expect("edition_metadata is not set"), + + edition: self.instruction.edition.expect("edition is not set"), + + edition_mint: self + .instruction + .edition_mint + .expect("edition_mint is not set"), + + edition_token_account_owner: self + .instruction + .edition_token_account_owner + .expect("edition_token_account_owner is not set"), + + edition_token_account: self + .instruction + .edition_token_account + .expect("edition_token_account is not set"), + + edition_mint_authority: self + .instruction + .edition_mint_authority + .expect("edition_mint_authority is not set"), + + edition_token_record: self.instruction.edition_token_record, + + master_edition: self + .instruction + .master_edition + .expect("master_edition is not set"), + + edition_marker_pda: self + .instruction + .edition_marker_pda + .expect("edition_marker_pda is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + master_token_account_owner: self + .instruction + .master_token_account_owner + .expect("master_token_account_owner is not set"), + + master_token_account: self + .instruction + .master_token_account + .expect("master_token_account is not set"), + + master_metadata: self + .instruction + .master_metadata + .expect("master_metadata is not set"), + + update_authority: self + .instruction + .update_authority + .expect("update_authority is not set"), + + spl_token_program: self + .instruction + .spl_token_program + .expect("spl_token_program is not set"), + + spl_ata_program: self + .instruction + .spl_ata_program + .expect("spl_ata_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + __args: args, + } + } +} + +struct PrintV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + edition_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_mint: Option<(&'a solana_program::account_info::AccountInfo<'a>, bool)>, + edition_token_account_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_mint_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_marker_pda: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_token_account_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_ata_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition_number: Option, +} diff --git a/clients/rust/src/generated/instructions/puff_metadata.rs b/clients/rust/src/generated/instructions/puff_metadata.rs new file mode 100644 index 00000000..84c62d4e --- /dev/null +++ b/clients/rust/src/generated/instructions/puff_metadata.rs @@ -0,0 +1,149 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct PuffMetadata { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, +} + +impl PuffMetadata { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(1); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + let data = PuffMetadataInstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct PuffMetadataInstructionData { + discriminator: u8, +} + +impl PuffMetadataInstructionData { + fn new() -> Self { + Self { discriminator: 14 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct PuffMetadataBuilder { + metadata: Option, +} + +impl PuffMetadataBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = PuffMetadata { + metadata: self.metadata.expect("metadata is not set"), + }; + + accounts.instruction() + } +} + +/// `puff_metadata` CPI instruction. +pub struct PuffMetadataCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> PuffMetadataCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(1); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + let data = PuffMetadataInstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(1 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `puff_metadata` CPI instruction builder. +pub struct PuffMetadataCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> PuffMetadataCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(PuffMetadataCpiBuilderInstruction { + __program: program, + metadata: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> PuffMetadataCpi<'a> { + PuffMetadataCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + } + } +} + +struct PuffMetadataCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/remove_creator_verification.rs b/clients/rust/src/generated/instructions/remove_creator_verification.rs new file mode 100644 index 00000000..d3acc793 --- /dev/null +++ b/clients/rust/src/generated/instructions/remove_creator_verification.rs @@ -0,0 +1,187 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RemoveCreatorVerification { + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// Creator + pub creator: solana_program::pubkey::Pubkey, +} + +impl RemoveCreatorVerification { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(2); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.creator, + true, + )); + let data = RemoveCreatorVerificationInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RemoveCreatorVerificationInstructionData { + discriminator: u8, +} + +impl RemoveCreatorVerificationInstructionData { + fn new() -> Self { + Self { discriminator: 28 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RemoveCreatorVerificationBuilder { + metadata: Option, + creator: Option, +} + +impl RemoveCreatorVerificationBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Creator + #[inline(always)] + pub fn creator(&mut self, creator: solana_program::pubkey::Pubkey) -> &mut Self { + self.creator = Some(creator); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RemoveCreatorVerification { + metadata: self.metadata.expect("metadata is not set"), + creator: self.creator.expect("creator is not set"), + }; + + accounts.instruction() + } +} + +/// `remove_creator_verification` CPI instruction. +pub struct RemoveCreatorVerificationCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Creator + pub creator: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> RemoveCreatorVerificationCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(2); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.creator.key, + true, + )); + let data = RemoveCreatorVerificationInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(2 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.creator.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `remove_creator_verification` CPI instruction builder. +pub struct RemoveCreatorVerificationCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RemoveCreatorVerificationCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RemoveCreatorVerificationCpiBuilderInstruction { + __program: program, + metadata: None, + creator: None, + }); + Self { instruction } + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Creator + #[inline(always)] + pub fn creator( + &mut self, + creator: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.creator = Some(creator); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RemoveCreatorVerificationCpi<'a> { + RemoveCreatorVerificationCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + creator: self.instruction.creator.expect("creator is not set"), + } + } +} + +struct RemoveCreatorVerificationCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + creator: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_authority_item_v1.rs b/clients/rust/src/generated/instructions/revoke_authority_item_v1.rs new file mode 100644 index 00000000..11b75b34 --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_authority_item_v1.rs @@ -0,0 +1,735 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeAuthorityItemV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeAuthorityItemV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeAuthorityItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeAuthorityItemV1InstructionData { + discriminator: u8, + revoke_authority_item_v1_discriminator: u8, +} + +impl RevokeAuthorityItemV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_authority_item_v1_discriminator: 10, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeAuthorityItemV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeAuthorityItemV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeAuthorityItemV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_authority_item_v1` CPI instruction. +pub struct RevokeAuthorityItemV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeAuthorityItemV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeAuthorityItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_authority_item_v1` CPI instruction builder. +pub struct RevokeAuthorityItemV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeAuthorityItemV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeAuthorityItemV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeAuthorityItemV1Cpi<'a> { + RevokeAuthorityItemV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeAuthorityItemV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_collection_authority.rs b/clients/rust/src/generated/instructions/revoke_collection_authority.rs new file mode 100644 index 00000000..7c62381f --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_collection_authority.rs @@ -0,0 +1,307 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeCollectionAuthority { + /// Collection Authority Record PDA + pub collection_authority_record: solana_program::pubkey::Pubkey, + /// Delegated Collection Authority + pub delegate_authority: solana_program::pubkey::Pubkey, + /// Update Authority, or Delegated Authority, of Collection NFT + pub revoke_authority: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Mint of Metadata + pub mint: solana_program::pubkey::Pubkey, +} + +impl RevokeCollectionAuthority { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(5); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_authority_record, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.delegate_authority, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.revoke_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + let data = RevokeCollectionAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeCollectionAuthorityInstructionData { + discriminator: u8, +} + +impl RevokeCollectionAuthorityInstructionData { + fn new() -> Self { + Self { discriminator: 24 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeCollectionAuthorityBuilder { + collection_authority_record: Option, + delegate_authority: Option, + revoke_authority: Option, + metadata: Option, + mint: Option, +} + +impl RevokeCollectionAuthorityBuilder { + pub fn new() -> Self { + Self::default() + } + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + /// Delegated Collection Authority + #[inline(always)] + pub fn delegate_authority( + &mut self, + delegate_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_authority = Some(delegate_authority); + self + } + /// Update Authority, or Delegated Authority, of Collection NFT + #[inline(always)] + pub fn revoke_authority( + &mut self, + revoke_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.revoke_authority = Some(revoke_authority); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Mint of Metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeCollectionAuthority { + collection_authority_record: self + .collection_authority_record + .expect("collection_authority_record is not set"), + delegate_authority: self + .delegate_authority + .expect("delegate_authority is not set"), + revoke_authority: self.revoke_authority.expect("revoke_authority is not set"), + metadata: self.metadata.expect("metadata is not set"), + mint: self.mint.expect("mint is not set"), + }; + + accounts.instruction() + } +} + +/// `revoke_collection_authority` CPI instruction. +pub struct RevokeCollectionAuthorityCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegated Collection Authority + pub delegate_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Update Authority, or Delegated Authority, of Collection NFT + pub revoke_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of Metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> RevokeCollectionAuthorityCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(5); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_authority_record.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.delegate_authority.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.revoke_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + let data = RevokeCollectionAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.collection_authority_record.clone()); + account_infos.push(self.delegate_authority.clone()); + account_infos.push(self.revoke_authority.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.mint.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_collection_authority` CPI instruction builder. +pub struct RevokeCollectionAuthorityCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeCollectionAuthorityCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeCollectionAuthorityCpiBuilderInstruction { + __program: program, + collection_authority_record: None, + delegate_authority: None, + revoke_authority: None, + metadata: None, + mint: None, + }); + Self { instruction } + } + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + /// Delegated Collection Authority + #[inline(always)] + pub fn delegate_authority( + &mut self, + delegate_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_authority = Some(delegate_authority); + self + } + /// Update Authority, or Delegated Authority, of Collection NFT + #[inline(always)] + pub fn revoke_authority( + &mut self, + revoke_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.revoke_authority = Some(revoke_authority); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Mint of Metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeCollectionAuthorityCpi<'a> { + RevokeCollectionAuthorityCpi { + __program: self.instruction.__program, + + collection_authority_record: self + .instruction + .collection_authority_record + .expect("collection_authority_record is not set"), + + delegate_authority: self + .instruction + .delegate_authority + .expect("delegate_authority is not set"), + + revoke_authority: self + .instruction + .revoke_authority + .expect("revoke_authority is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + } + } +} + +struct RevokeCollectionAuthorityCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + revoke_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_collection_item_v1.rs b/clients/rust/src/generated/instructions/revoke_collection_item_v1.rs new file mode 100644 index 00000000..4685d667 --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_collection_item_v1.rs @@ -0,0 +1,735 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeCollectionItemV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeCollectionItemV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeCollectionItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeCollectionItemV1InstructionData { + discriminator: u8, + revoke_collection_item_v1_discriminator: u8, +} + +impl RevokeCollectionItemV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_collection_item_v1_discriminator: 12, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeCollectionItemV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeCollectionItemV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeCollectionItemV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_collection_item_v1` CPI instruction. +pub struct RevokeCollectionItemV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeCollectionItemV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeCollectionItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_collection_item_v1` CPI instruction builder. +pub struct RevokeCollectionItemV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeCollectionItemV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeCollectionItemV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeCollectionItemV1Cpi<'a> { + RevokeCollectionItemV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeCollectionItemV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_collection_v1.rs b/clients/rust/src/generated/instructions/revoke_collection_v1.rs new file mode 100644 index 00000000..596210e8 --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_collection_v1.rs @@ -0,0 +1,735 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeCollectionV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeCollectionV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeCollectionV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeCollectionV1InstructionData { + discriminator: u8, + revoke_collection_v1_discriminator: u8, +} + +impl RevokeCollectionV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_collection_v1_discriminator: 0, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeCollectionV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeCollectionV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeCollectionV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_collection_v1` CPI instruction. +pub struct RevokeCollectionV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeCollectionV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeCollectionV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_collection_v1` CPI instruction builder. +pub struct RevokeCollectionV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeCollectionV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeCollectionV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeCollectionV1Cpi<'a> { + RevokeCollectionV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeCollectionV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_data_item_v1.rs b/clients/rust/src/generated/instructions/revoke_data_item_v1.rs new file mode 100644 index 00000000..269b3fbd --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_data_item_v1.rs @@ -0,0 +1,731 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeDataItemV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeDataItemV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeDataItemV1InstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeDataItemV1InstructionData { + discriminator: u8, + revoke_data_item_v1_discriminator: u8, +} + +impl RevokeDataItemV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_data_item_v1_discriminator: 11, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeDataItemV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeDataItemV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeDataItemV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_data_item_v1` CPI instruction. +pub struct RevokeDataItemV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeDataItemV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeDataItemV1InstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_data_item_v1` CPI instruction builder. +pub struct RevokeDataItemV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeDataItemV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeDataItemV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeDataItemV1Cpi<'a> { + RevokeDataItemV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeDataItemV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_data_v1.rs b/clients/rust/src/generated/instructions/revoke_data_v1.rs new file mode 100644 index 00000000..85ebbd23 --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_data_v1.rs @@ -0,0 +1,731 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeDataV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeDataV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeDataV1InstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeDataV1InstructionData { + discriminator: u8, + revoke_data_v1_discriminator: u8, +} + +impl RevokeDataV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_data_v1_discriminator: 3, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeDataV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeDataV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeDataV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_data_v1` CPI instruction. +pub struct RevokeDataV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeDataV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeDataV1InstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_data_v1` CPI instruction builder. +pub struct RevokeDataV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeDataV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeDataV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeDataV1Cpi<'a> { + RevokeDataV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeDataV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_locked_transfer_v1.rs b/clients/rust/src/generated/instructions/revoke_locked_transfer_v1.rs new file mode 100644 index 00000000..65c062af --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_locked_transfer_v1.rs @@ -0,0 +1,720 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeLockedTransferV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeLockedTransferV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeLockedTransferV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeLockedTransferV1InstructionData { + discriminator: u8, + revoke_locked_transfer_v1_discriminator: u8, +} + +impl RevokeLockedTransferV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_locked_transfer_v1_discriminator: 7, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeLockedTransferV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeLockedTransferV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeLockedTransferV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_locked_transfer_v1` CPI instruction. +pub struct RevokeLockedTransferV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeLockedTransferV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeLockedTransferV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_locked_transfer_v1` CPI instruction builder. +pub struct RevokeLockedTransferV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeLockedTransferV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeLockedTransferV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeLockedTransferV1Cpi<'a> { + RevokeLockedTransferV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeLockedTransferV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_migration_v1.rs b/clients/rust/src/generated/instructions/revoke_migration_v1.rs new file mode 100644 index 00000000..eb40149f --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_migration_v1.rs @@ -0,0 +1,720 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeMigrationV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeMigrationV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeMigrationV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeMigrationV1InstructionData { + discriminator: u8, + revoke_migration_v1_discriminator: u8, +} + +impl RevokeMigrationV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_migration_v1_discriminator: 9, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeMigrationV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeMigrationV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeMigrationV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_migration_v1` CPI instruction. +pub struct RevokeMigrationV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeMigrationV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeMigrationV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_migration_v1` CPI instruction builder. +pub struct RevokeMigrationV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeMigrationV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeMigrationV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeMigrationV1Cpi<'a> { + RevokeMigrationV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeMigrationV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_programmable_config_item_v1.rs b/clients/rust/src/generated/instructions/revoke_programmable_config_item_v1.rs new file mode 100644 index 00000000..ac85c71f --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_programmable_config_item_v1.rs @@ -0,0 +1,735 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeProgrammableConfigItemV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeProgrammableConfigItemV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeProgrammableConfigItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeProgrammableConfigItemV1InstructionData { + discriminator: u8, + revoke_programmable_config_item_v1_discriminator: u8, +} + +impl RevokeProgrammableConfigItemV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_programmable_config_item_v1_discriminator: 13, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeProgrammableConfigItemV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeProgrammableConfigItemV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeProgrammableConfigItemV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_programmable_config_item_v1` CPI instruction. +pub struct RevokeProgrammableConfigItemV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeProgrammableConfigItemV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeProgrammableConfigItemV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_programmable_config_item_v1` CPI instruction builder. +pub struct RevokeProgrammableConfigItemV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeProgrammableConfigItemV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeProgrammableConfigItemV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeProgrammableConfigItemV1Cpi<'a> { + RevokeProgrammableConfigItemV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeProgrammableConfigItemV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_programmable_config_v1.rs b/clients/rust/src/generated/instructions/revoke_programmable_config_v1.rs new file mode 100644 index 00000000..4539704b --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_programmable_config_v1.rs @@ -0,0 +1,735 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeProgrammableConfigV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: Option, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeProgrammableConfigV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeProgrammableConfigV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeProgrammableConfigV1InstructionData { + discriminator: u8, + revoke_programmable_config_v1_discriminator: u8, +} + +impl RevokeProgrammableConfigV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_programmable_config_v1_discriminator: 8, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeProgrammableConfigV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeProgrammableConfigV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeProgrammableConfigV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_programmable_config_v1` CPI instruction. +pub struct RevokeProgrammableConfigV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeProgrammableConfigV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeProgrammableConfigV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_programmable_config_v1` CPI instruction builder. +pub struct RevokeProgrammableConfigV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeProgrammableConfigV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeProgrammableConfigV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeProgrammableConfigV1Cpi<'a> { + RevokeProgrammableConfigV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeProgrammableConfigV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_sale_v1.rs b/clients/rust/src/generated/instructions/revoke_sale_v1.rs new file mode 100644 index 00000000..8c917e73 --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_sale_v1.rs @@ -0,0 +1,716 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeSaleV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeSaleV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeSaleV1InstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeSaleV1InstructionData { + discriminator: u8, + revoke_sale_v1_discriminator: u8, +} + +impl RevokeSaleV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_sale_v1_discriminator: 1, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeSaleV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeSaleV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeSaleV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_sale_v1` CPI instruction. +pub struct RevokeSaleV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeSaleV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeSaleV1InstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_sale_v1` CPI instruction builder. +pub struct RevokeSaleV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeSaleV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeSaleV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeSaleV1Cpi<'a> { + RevokeSaleV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeSaleV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_staking_v1.rs b/clients/rust/src/generated/instructions/revoke_staking_v1.rs new file mode 100644 index 00000000..803c22a5 --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_staking_v1.rs @@ -0,0 +1,716 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeStakingV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeStakingV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeStakingV1InstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeStakingV1InstructionData { + discriminator: u8, + revoke_staking_v1_discriminator: u8, +} + +impl RevokeStakingV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_staking_v1_discriminator: 5, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeStakingV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeStakingV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeStakingV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_staking_v1` CPI instruction. +pub struct RevokeStakingV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeStakingV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeStakingV1InstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_staking_v1` CPI instruction builder. +pub struct RevokeStakingV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeStakingV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeStakingV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeStakingV1Cpi<'a> { + RevokeStakingV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeStakingV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_standard_v1.rs b/clients/rust/src/generated/instructions/revoke_standard_v1.rs new file mode 100644 index 00000000..34f468ee --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_standard_v1.rs @@ -0,0 +1,716 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeStandardV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeStandardV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeStandardV1InstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeStandardV1InstructionData { + discriminator: u8, + revoke_standard_v1_discriminator: u8, +} + +impl RevokeStandardV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_standard_v1_discriminator: 6, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeStandardV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeStandardV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeStandardV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_standard_v1` CPI instruction. +pub struct RevokeStandardV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeStandardV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeStandardV1InstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_standard_v1` CPI instruction builder. +pub struct RevokeStandardV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeStandardV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeStandardV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeStandardV1Cpi<'a> { + RevokeStandardV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeStandardV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_transfer_v1.rs b/clients/rust/src/generated/instructions/revoke_transfer_v1.rs new file mode 100644 index 00000000..7b763235 --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_transfer_v1.rs @@ -0,0 +1,716 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeTransferV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeTransferV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeTransferV1InstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeTransferV1InstructionData { + discriminator: u8, + revoke_transfer_v1_discriminator: u8, +} + +impl RevokeTransferV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_transfer_v1_discriminator: 2, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeTransferV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeTransferV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeTransferV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_transfer_v1` CPI instruction. +pub struct RevokeTransferV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeTransferV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeTransferV1InstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_transfer_v1` CPI instruction builder. +pub struct RevokeTransferV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeTransferV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeTransferV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeTransferV1Cpi<'a> { + RevokeTransferV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeTransferV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_use_authority.rs b/clients/rust/src/generated/instructions/revoke_use_authority.rs new file mode 100644 index 00000000..ff891144 --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_use_authority.rs @@ -0,0 +1,442 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeUseAuthority { + /// Use Authority Record PDA + pub use_authority_record: solana_program::pubkey::Pubkey, + /// Owner + pub owner: solana_program::pubkey::Pubkey, + /// A Use Authority + pub user: solana_program::pubkey::Pubkey, + /// Owned Token Account Of Mint + pub owner_token_account: solana_program::pubkey::Pubkey, + /// Mint of Metadata + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Token program + pub token_program: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Rent info + pub rent: Option, +} + +impl RevokeUseAuthority { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(9); + accounts.push(solana_program::instruction::AccountMeta::new( + self.use_authority_record, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.owner, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.user, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.owner_token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + rent, false, + )); + } + let data = RevokeUseAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeUseAuthorityInstructionData { + discriminator: u8, +} + +impl RevokeUseAuthorityInstructionData { + fn new() -> Self { + Self { discriminator: 21 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeUseAuthorityBuilder { + use_authority_record: Option, + owner: Option, + user: Option, + owner_token_account: Option, + mint: Option, + metadata: Option, + token_program: Option, + system_program: Option, + rent: Option, +} + +impl RevokeUseAuthorityBuilder { + pub fn new() -> Self { + Self::default() + } + /// Use Authority Record PDA + #[inline(always)] + pub fn use_authority_record( + &mut self, + use_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.use_authority_record = Some(use_authority_record); + self + } + /// Owner + #[inline(always)] + pub fn owner(&mut self, owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.owner = Some(owner); + self + } + /// A Use Authority + #[inline(always)] + pub fn user(&mut self, user: solana_program::pubkey::Pubkey) -> &mut Self { + self.user = Some(user); + self + } + /// Owned Token Account Of Mint + #[inline(always)] + pub fn owner_token_account( + &mut self, + owner_token_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.owner_token_account = Some(owner_token_account); + self + } + /// Mint of Metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self { + self.rent = Some(rent); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeUseAuthority { + use_authority_record: self + .use_authority_record + .expect("use_authority_record is not set"), + owner: self.owner.expect("owner is not set"), + user: self.user.expect("user is not set"), + owner_token_account: self + .owner_token_account + .expect("owner_token_account is not set"), + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + rent: self.rent, + }; + + accounts.instruction() + } +} + +/// `revoke_use_authority` CPI instruction. +pub struct RevokeUseAuthorityCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Use Authority Record PDA + pub use_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + /// Owner + pub owner: &'a solana_program::account_info::AccountInfo<'a>, + /// A Use Authority + pub user: &'a solana_program::account_info::AccountInfo<'a>, + /// Owned Token Account Of Mint + pub owner_token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of Metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Token program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Rent info + pub rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeUseAuthorityCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(9); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.use_authority_record.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.owner.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.user.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.owner_token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(rent) = self.rent { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *rent.key, false, + )); + } + let data = RevokeUseAuthorityInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(9 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.use_authority_record.clone()); + account_infos.push(self.owner.clone()); + account_infos.push(self.user.clone()); + account_infos.push(self.owner_token_account.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.system_program.clone()); + if let Some(rent) = self.rent { + account_infos.push(rent.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_use_authority` CPI instruction builder. +pub struct RevokeUseAuthorityCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeUseAuthorityCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeUseAuthorityCpiBuilderInstruction { + __program: program, + use_authority_record: None, + owner: None, + user: None, + owner_token_account: None, + mint: None, + metadata: None, + token_program: None, + system_program: None, + rent: None, + }); + Self { instruction } + } + /// Use Authority Record PDA + #[inline(always)] + pub fn use_authority_record( + &mut self, + use_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.use_authority_record = Some(use_authority_record); + self + } + /// Owner + #[inline(always)] + pub fn owner(&mut self, owner: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.owner = Some(owner); + self + } + /// A Use Authority + #[inline(always)] + pub fn user(&mut self, user: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.user = Some(user); + self + } + /// Owned Token Account Of Mint + #[inline(always)] + pub fn owner_token_account( + &mut self, + owner_token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.owner_token_account = Some(owner_token_account); + self + } + /// Mint of Metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Token program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.rent = Some(rent); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeUseAuthorityCpi<'a> { + RevokeUseAuthorityCpi { + __program: self.instruction.__program, + + use_authority_record: self + .instruction + .use_authority_record + .expect("use_authority_record is not set"), + + owner: self.instruction.owner.expect("owner is not set"), + + user: self.instruction.user.expect("user is not set"), + + owner_token_account: self + .instruction + .owner_token_account + .expect("owner_token_account is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + rent: self.instruction.rent, + } + } +} + +struct RevokeUseAuthorityCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + use_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + user: Option<&'a solana_program::account_info::AccountInfo<'a>>, + owner_token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/revoke_utility_v1.rs b/clients/rust/src/generated/instructions/revoke_utility_v1.rs new file mode 100644 index 00000000..01d87bf1 --- /dev/null +++ b/clients/rust/src/generated/instructions/revoke_utility_v1.rs @@ -0,0 +1,716 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct RevokeUtilityV1 { + /// Delegate record account + pub delegate_record: Option, + /// Owner of the delegated account + pub delegate: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Master Edition account + pub master_edition: Option, + /// Token record account + pub token_record: Option, + /// Mint of metadata + pub mint: solana_program::pubkey::Pubkey, + /// Token account of mint + pub token: solana_program::pubkey::Pubkey, + /// Update authority or token owner + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl RevokeUtilityV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeUtilityV1InstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct RevokeUtilityV1InstructionData { + discriminator: u8, + revoke_utility_v1_discriminator: u8, +} + +impl RevokeUtilityV1InstructionData { + fn new() -> Self { + Self { + discriminator: 45, + revoke_utility_v1_discriminator: 4, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct RevokeUtilityV1Builder { + delegate_record: Option, + delegate: Option, + metadata: Option, + master_edition: Option, + token_record: Option, + mint: Option, + token: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, +} + +impl RevokeUtilityV1Builder { + pub fn new() -> Self { + Self::default() + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition(&mut self, master_edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = RevokeUtilityV1 { + delegate_record: self.delegate_record, + delegate: self.delegate.expect("delegate is not set"), + metadata: self.metadata.expect("metadata is not set"), + master_edition: self.master_edition, + token_record: self.token_record, + mint: self.mint.expect("mint is not set"), + token: self.token.expect("token is not set"), + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + + accounts.instruction() + } +} + +/// `revoke_utility_v1` CPI instruction. +pub struct RevokeUtilityV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record account + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner of the delegated account + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Master Edition account + pub master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint of metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account of mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or token owner + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> RevokeUtilityV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(14); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(master_edition) = self.master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let data = RevokeUtilityV1InstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(14 + 1); + account_infos.push(self.__program.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.delegate.clone()); + account_infos.push(self.metadata.clone()); + if let Some(master_edition) = self.master_edition { + account_infos.push(master_edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `revoke_utility_v1` CPI instruction builder. +pub struct RevokeUtilityV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> RevokeUtilityV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(RevokeUtilityV1CpiBuilderInstruction { + __program: program, + delegate_record: None, + delegate: None, + metadata: None, + master_edition: None, + token_record: None, + mint: None, + token: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + }); + Self { instruction } + } + /// `[optional account]` + /// Delegate record account + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Owner of the delegated account + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Master Edition account + #[inline(always)] + pub fn master_edition( + &mut self, + master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.master_edition = Some(master_edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Mint of metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token account of mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Update authority or token owner + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> RevokeUtilityV1Cpi<'a> { + RevokeUtilityV1Cpi { + __program: self.instruction.__program, + + delegate_record: self.instruction.delegate_record, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + master_edition: self.instruction.master_edition, + + token_record: self.instruction.token_record, + + mint: self.instruction.mint.expect("mint is not set"), + + token: self.instruction.token.expect("token is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + } + } +} + +struct RevokeUtilityV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/set_and_verify_collection.rs b/clients/rust/src/generated/instructions/set_and_verify_collection.rs new file mode 100644 index 00000000..df987ba5 --- /dev/null +++ b/clients/rust/src/generated/instructions/set_and_verify_collection.rs @@ -0,0 +1,427 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct SetAndVerifyCollection { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Collection Update authority + pub collection_authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// Update Authority of Collection NFT and NFT + pub update_authority: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Metadata Account of the Collection + pub collection: solana_program::pubkey::Pubkey, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: solana_program::pubkey::Pubkey, + /// Collection Authority Record PDA + pub collection_authority_record: Option, +} + +impl SetAndVerifyCollection { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.update_authority, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_master_edition_account, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_authority_record, + false, + )); + } + let data = SetAndVerifyCollectionInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct SetAndVerifyCollectionInstructionData { + discriminator: u8, +} + +impl SetAndVerifyCollectionInstructionData { + fn new() -> Self { + Self { discriminator: 25 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct SetAndVerifyCollectionBuilder { + metadata: Option, + collection_authority: Option, + payer: Option, + update_authority: Option, + collection_mint: Option, + collection: Option, + collection_master_edition_account: Option, + collection_authority_record: Option, +} + +impl SetAndVerifyCollectionBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority = Some(collection_authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Update Authority of Collection NFT and NFT + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.update_authority = Some(update_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { + self.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_master_edition_account = Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = SetAndVerifyCollection { + metadata: self.metadata.expect("metadata is not set"), + collection_authority: self + .collection_authority + .expect("collection_authority is not set"), + payer: self.payer.expect("payer is not set"), + update_authority: self.update_authority.expect("update_authority is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection: self.collection.expect("collection is not set"), + collection_master_edition_account: self + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + collection_authority_record: self.collection_authority_record, + }; + + accounts.instruction() + } +} + +/// `set_and_verify_collection` CPI instruction. +pub struct SetAndVerifyCollectionCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Update authority + pub collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Update Authority of Collection NFT and NFT + pub update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata Account of the Collection + pub collection: &'a solana_program::account_info::AccountInfo<'a>, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> SetAndVerifyCollectionCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.update_authority.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_master_edition_account.key, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_authority_record.key, + false, + )); + } + let data = SetAndVerifyCollectionInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(8 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.collection_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.update_authority.clone()); + account_infos.push(self.collection_mint.clone()); + account_infos.push(self.collection.clone()); + account_infos.push(self.collection_master_edition_account.clone()); + if let Some(collection_authority_record) = self.collection_authority_record { + account_infos.push(collection_authority_record.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `set_and_verify_collection` CPI instruction builder. +pub struct SetAndVerifyCollectionCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> SetAndVerifyCollectionCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(SetAndVerifyCollectionCpiBuilderInstruction { + __program: program, + metadata: None, + collection_authority: None, + payer: None, + update_authority: None, + collection_mint: None, + collection: None, + collection_master_edition_account: None, + collection_authority_record: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority = Some(collection_authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Update Authority of Collection NFT and NFT + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.update_authority = Some(update_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection( + &mut self, + collection: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_master_edition_account = + Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> SetAndVerifyCollectionCpi<'a> { + SetAndVerifyCollectionCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_authority: self + .instruction + .collection_authority + .expect("collection_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + update_authority: self + .instruction + .update_authority + .expect("update_authority is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection: self.instruction.collection.expect("collection is not set"), + + collection_master_edition_account: self + .instruction + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + + collection_authority_record: self.instruction.collection_authority_record, + } + } +} + +struct SetAndVerifyCollectionCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_master_edition_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/set_and_verify_sized_collection_item.rs b/clients/rust/src/generated/instructions/set_and_verify_sized_collection_item.rs new file mode 100644 index 00000000..7bd3efe4 --- /dev/null +++ b/clients/rust/src/generated/instructions/set_and_verify_sized_collection_item.rs @@ -0,0 +1,427 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct SetAndVerifySizedCollectionItem { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Collection Update authority + pub collection_authority: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// Update Authority of Collection NFT and NFT + pub update_authority: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Metadata Account of the Collection + pub collection: solana_program::pubkey::Pubkey, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: solana_program::pubkey::Pubkey, + /// Collection Authority Record PDA + pub collection_authority_record: Option, +} + +impl SetAndVerifySizedCollectionItem { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.update_authority, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_master_edition_account, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_authority_record, + false, + )); + } + let data = SetAndVerifySizedCollectionItemInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct SetAndVerifySizedCollectionItemInstructionData { + discriminator: u8, +} + +impl SetAndVerifySizedCollectionItemInstructionData { + fn new() -> Self { + Self { discriminator: 32 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct SetAndVerifySizedCollectionItemBuilder { + metadata: Option, + collection_authority: Option, + payer: Option, + update_authority: Option, + collection_mint: Option, + collection: Option, + collection_master_edition_account: Option, + collection_authority_record: Option, +} + +impl SetAndVerifySizedCollectionItemBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority = Some(collection_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Update Authority of Collection NFT and NFT + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.update_authority = Some(update_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { + self.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_master_edition_account = Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = SetAndVerifySizedCollectionItem { + metadata: self.metadata.expect("metadata is not set"), + collection_authority: self + .collection_authority + .expect("collection_authority is not set"), + payer: self.payer.expect("payer is not set"), + update_authority: self.update_authority.expect("update_authority is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection: self.collection.expect("collection is not set"), + collection_master_edition_account: self + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + collection_authority_record: self.collection_authority_record, + }; + + accounts.instruction() + } +} + +/// `set_and_verify_sized_collection_item` CPI instruction. +pub struct SetAndVerifySizedCollectionItemCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Update authority + pub collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Update Authority of Collection NFT and NFT + pub update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata Account of the Collection + pub collection: &'a solana_program::account_info::AccountInfo<'a>, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> SetAndVerifySizedCollectionItemCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.update_authority.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_master_edition_account.key, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_authority_record.key, + false, + )); + } + let data = SetAndVerifySizedCollectionItemInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(8 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.collection_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.update_authority.clone()); + account_infos.push(self.collection_mint.clone()); + account_infos.push(self.collection.clone()); + account_infos.push(self.collection_master_edition_account.clone()); + if let Some(collection_authority_record) = self.collection_authority_record { + account_infos.push(collection_authority_record.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `set_and_verify_sized_collection_item` CPI instruction builder. +pub struct SetAndVerifySizedCollectionItemCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> SetAndVerifySizedCollectionItemCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(SetAndVerifySizedCollectionItemCpiBuilderInstruction { + __program: program, + metadata: None, + collection_authority: None, + payer: None, + update_authority: None, + collection_mint: None, + collection: None, + collection_master_edition_account: None, + collection_authority_record: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority = Some(collection_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Update Authority of Collection NFT and NFT + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.update_authority = Some(update_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection( + &mut self, + collection: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_master_edition_account = + Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> SetAndVerifySizedCollectionItemCpi<'a> { + SetAndVerifySizedCollectionItemCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_authority: self + .instruction + .collection_authority + .expect("collection_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + update_authority: self + .instruction + .update_authority + .expect("update_authority is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection: self.instruction.collection.expect("collection is not set"), + + collection_master_edition_account: self + .instruction + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + + collection_authority_record: self.instruction.collection_authority_record, + } + } +} + +struct SetAndVerifySizedCollectionItemCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_master_edition_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/set_collection_size.rs b/clients/rust/src/generated/instructions/set_collection_size.rs new file mode 100644 index 00000000..5288be0f --- /dev/null +++ b/clients/rust/src/generated/instructions/set_collection_size.rs @@ -0,0 +1,337 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::SetCollectionSizeArgs; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct SetCollectionSize { + /// Collection Metadata account + pub collection_metadata: solana_program::pubkey::Pubkey, + /// Collection Update authority + pub collection_authority: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Collection Authority Record PDA + pub collection_authority_record: Option, +} + +impl SetCollectionSize { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: SetCollectionSizeInstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(4); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_authority_record, + false, + )); + } + let mut data = SetCollectionSizeInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct SetCollectionSizeInstructionData { + discriminator: u8, +} + +impl SetCollectionSizeInstructionData { + fn new() -> Self { + Self { discriminator: 34 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct SetCollectionSizeInstructionArgs { + pub set_collection_size_args: SetCollectionSizeArgs, +} + +/// Instruction builder. +#[derive(Default)] +pub struct SetCollectionSizeBuilder { + collection_metadata: Option, + collection_authority: Option, + collection_mint: Option, + collection_authority_record: Option, + set_collection_size_args: Option, +} + +impl SetCollectionSizeBuilder { + pub fn new() -> Self { + Self::default() + } + /// Collection Metadata account + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority = Some(collection_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + #[inline(always)] + pub fn set_collection_size_args( + &mut self, + set_collection_size_args: SetCollectionSizeArgs, + ) -> &mut Self { + self.set_collection_size_args = Some(set_collection_size_args); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = SetCollectionSize { + collection_metadata: self + .collection_metadata + .expect("collection_metadata is not set"), + collection_authority: self + .collection_authority + .expect("collection_authority is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection_authority_record: self.collection_authority_record, + }; + let args = SetCollectionSizeInstructionArgs { + set_collection_size_args: self + .set_collection_size_args + .clone() + .expect("set_collection_size_args is not set"), + }; + + accounts.instruction(args) + } +} + +/// `set_collection_size` CPI instruction. +pub struct SetCollectionSizeCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Metadata account + pub collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Update authority + pub collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: SetCollectionSizeInstructionArgs, +} + +impl<'a> SetCollectionSizeCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(4); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_authority_record.key, + false, + )); + } + let mut data = SetCollectionSizeInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(4 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.collection_metadata.clone()); + account_infos.push(self.collection_authority.clone()); + account_infos.push(self.collection_mint.clone()); + if let Some(collection_authority_record) = self.collection_authority_record { + account_infos.push(collection_authority_record.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `set_collection_size` CPI instruction builder. +pub struct SetCollectionSizeCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> SetCollectionSizeCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(SetCollectionSizeCpiBuilderInstruction { + __program: program, + collection_metadata: None, + collection_authority: None, + collection_mint: None, + collection_authority_record: None, + set_collection_size_args: None, + }); + Self { instruction } + } + /// Collection Metadata account + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority = Some(collection_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + #[inline(always)] + pub fn set_collection_size_args( + &mut self, + set_collection_size_args: SetCollectionSizeArgs, + ) -> &mut Self { + self.instruction.set_collection_size_args = Some(set_collection_size_args); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> SetCollectionSizeCpi<'a> { + let args = SetCollectionSizeInstructionArgs { + set_collection_size_args: self + .instruction + .set_collection_size_args + .clone() + .expect("set_collection_size_args is not set"), + }; + + SetCollectionSizeCpi { + __program: self.instruction.__program, + + collection_metadata: self + .instruction + .collection_metadata + .expect("collection_metadata is not set"), + + collection_authority: self + .instruction + .collection_authority + .expect("collection_authority is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection_authority_record: self.instruction.collection_authority_record, + __args: args, + } + } +} + +struct SetCollectionSizeCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + set_collection_size_args: Option, +} diff --git a/clients/rust/src/generated/instructions/set_token_standard.rs b/clients/rust/src/generated/instructions/set_token_standard.rs new file mode 100644 index 00000000..9be7820a --- /dev/null +++ b/clients/rust/src/generated/instructions/set_token_standard.rs @@ -0,0 +1,260 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct SetTokenStandard { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Metadata update authority + pub update_authority: solana_program::pubkey::Pubkey, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, +} + +impl SetTokenStandard { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(4); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.update_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } + let data = SetTokenStandardInstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct SetTokenStandardInstructionData { + discriminator: u8, +} + +impl SetTokenStandardInstructionData { + fn new() -> Self { + Self { discriminator: 35 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct SetTokenStandardBuilder { + metadata: Option, + update_authority: Option, + mint: Option, + edition: Option, +} + +impl SetTokenStandardBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Metadata update authority + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.update_authority = Some(update_authority); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = SetTokenStandard { + metadata: self.metadata.expect("metadata is not set"), + update_authority: self.update_authority.expect("update_authority is not set"), + mint: self.mint.expect("mint is not set"), + edition: self.edition, + }; + + accounts.instruction() + } +} + +/// `set_token_standard` CPI instruction. +pub struct SetTokenStandardCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata update authority + pub update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> SetTokenStandardCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(4); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.update_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } + let data = SetTokenStandardInstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(4 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.update_authority.clone()); + account_infos.push(self.mint.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `set_token_standard` CPI instruction builder. +pub struct SetTokenStandardCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> SetTokenStandardCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(SetTokenStandardCpiBuilderInstruction { + __program: program, + metadata: None, + update_authority: None, + mint: None, + edition: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Metadata update authority + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.update_authority = Some(update_authority); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> SetTokenStandardCpi<'a> { + SetTokenStandardCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + update_authority: self + .instruction + .update_authority + .expect("update_authority is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + edition: self.instruction.edition, + } + } +} + +struct SetTokenStandardCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/sign_metadata.rs b/clients/rust/src/generated/instructions/sign_metadata.rs new file mode 100644 index 00000000..05d00f69 --- /dev/null +++ b/clients/rust/src/generated/instructions/sign_metadata.rs @@ -0,0 +1,183 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct SignMetadata { + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// Creator + pub creator: solana_program::pubkey::Pubkey, +} + +impl SignMetadata { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(2); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.creator, + true, + )); + let data = SignMetadataInstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct SignMetadataInstructionData { + discriminator: u8, +} + +impl SignMetadataInstructionData { + fn new() -> Self { + Self { discriminator: 7 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct SignMetadataBuilder { + metadata: Option, + creator: Option, +} + +impl SignMetadataBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Creator + #[inline(always)] + pub fn creator(&mut self, creator: solana_program::pubkey::Pubkey) -> &mut Self { + self.creator = Some(creator); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = SignMetadata { + metadata: self.metadata.expect("metadata is not set"), + creator: self.creator.expect("creator is not set"), + }; + + accounts.instruction() + } +} + +/// `sign_metadata` CPI instruction. +pub struct SignMetadataCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Creator + pub creator: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> SignMetadataCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(2); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.creator.key, + true, + )); + let data = SignMetadataInstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(2 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.creator.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `sign_metadata` CPI instruction builder. +pub struct SignMetadataCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> SignMetadataCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(SignMetadataCpiBuilderInstruction { + __program: program, + metadata: None, + creator: None, + }); + Self { instruction } + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Creator + #[inline(always)] + pub fn creator( + &mut self, + creator: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.creator = Some(creator); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> SignMetadataCpi<'a> { + SignMetadataCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + creator: self.instruction.creator.expect("creator is not set"), + } + } +} + +struct SignMetadataCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + creator: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/thaw_delegated_account.rs b/clients/rust/src/generated/instructions/thaw_delegated_account.rs new file mode 100644 index 00000000..e322f6a8 --- /dev/null +++ b/clients/rust/src/generated/instructions/thaw_delegated_account.rs @@ -0,0 +1,293 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct ThawDelegatedAccount { + /// Delegate + pub delegate: solana_program::pubkey::Pubkey, + /// Token account to thaw + pub token_account: solana_program::pubkey::Pubkey, + /// Edition + pub edition: solana_program::pubkey::Pubkey, + /// Token mint + pub mint: solana_program::pubkey::Pubkey, + /// Token Program + pub token_program: solana_program::pubkey::Pubkey, +} + +impl ThawDelegatedAccount { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(5); + accounts.push(solana_program::instruction::AccountMeta::new( + self.delegate, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + let data = ThawDelegatedAccountInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct ThawDelegatedAccountInstructionData { + discriminator: u8, +} + +impl ThawDelegatedAccountInstructionData { + fn new() -> Self { + Self { discriminator: 27 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct ThawDelegatedAccountBuilder { + delegate: Option, + token_account: Option, + edition: Option, + mint: Option, + token_program: Option, +} + +impl ThawDelegatedAccountBuilder { + pub fn new() -> Self { + Self::default() + } + /// Delegate + #[inline(always)] + pub fn delegate(&mut self, delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.delegate = Some(delegate); + self + } + /// Token account to thaw + #[inline(always)] + pub fn token_account(&mut self, token_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_account = Some(token_account); + self + } + /// Edition + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Token mint + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Token Program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = ThawDelegatedAccount { + delegate: self.delegate.expect("delegate is not set"), + token_account: self.token_account.expect("token_account is not set"), + edition: self.edition.expect("edition is not set"), + mint: self.mint.expect("mint is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + }; + + accounts.instruction() + } +} + +/// `thaw_delegated_account` CPI instruction. +pub struct ThawDelegatedAccountCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate + pub delegate: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account to thaw + pub token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition + pub edition: &'a solana_program::account_info::AccountInfo<'a>, + /// Token mint + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> ThawDelegatedAccountCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(5); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.delegate.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + let data = ThawDelegatedAccountInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.delegate.clone()); + account_infos.push(self.token_account.clone()); + account_infos.push(self.edition.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.token_program.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `thaw_delegated_account` CPI instruction builder. +pub struct ThawDelegatedAccountCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> ThawDelegatedAccountCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ThawDelegatedAccountCpiBuilderInstruction { + __program: program, + delegate: None, + token_account: None, + edition: None, + mint: None, + token_program: None, + }); + Self { instruction } + } + /// Delegate + #[inline(always)] + pub fn delegate( + &mut self, + delegate: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate = Some(delegate); + self + } + /// Token account to thaw + #[inline(always)] + pub fn token_account( + &mut self, + token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_account = Some(token_account); + self + } + /// Edition + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Token mint + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Token Program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> ThawDelegatedAccountCpi<'a> { + ThawDelegatedAccountCpi { + __program: self.instruction.__program, + + delegate: self.instruction.delegate.expect("delegate is not set"), + + token_account: self + .instruction + .token_account + .expect("token_account is not set"), + + edition: self.instruction.edition.expect("edition is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + } + } +} + +struct ThawDelegatedAccountCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + delegate: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/transfer_out_of_escrow.rs b/clients/rust/src/generated/instructions/transfer_out_of_escrow.rs new file mode 100644 index 00000000..f642b00e --- /dev/null +++ b/clients/rust/src/generated/instructions/transfer_out_of_escrow.rs @@ -0,0 +1,639 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct TransferOutOfEscrow { + /// Escrow account + pub escrow: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Wallet paying for the transaction and new account + pub payer: solana_program::pubkey::Pubkey, + /// Mint account for the new attribute + pub attribute_mint: solana_program::pubkey::Pubkey, + /// Token account source for the new attribute + pub attribute_src: solana_program::pubkey::Pubkey, + /// Token account, owned by TM, destination for the new attribute + pub attribute_dst: solana_program::pubkey::Pubkey, + /// Mint account that the escrow is attached + pub escrow_mint: solana_program::pubkey::Pubkey, + /// Token account that holds the token the escrow is attached to + pub escrow_account: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Associated Token program + pub ata_program: solana_program::pubkey::Pubkey, + /// Token program + pub token_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Authority/creator of the escrow account + pub authority: Option, +} + +impl TransferOutOfEscrow { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: TransferOutOfEscrowInstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(13); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.escrow, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.attribute_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.attribute_src, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.attribute_dst, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.escrow_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.escrow_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.ata_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authority, true, + )); + } + let mut data = TransferOutOfEscrowInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct TransferOutOfEscrowInstructionData { + discriminator: u8, +} + +impl TransferOutOfEscrowInstructionData { + fn new() -> Self { + Self { discriminator: 40 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct TransferOutOfEscrowInstructionArgs { + pub amount: u64, +} + +/// Instruction builder. +#[derive(Default)] +pub struct TransferOutOfEscrowBuilder { + escrow: Option, + metadata: Option, + payer: Option, + attribute_mint: Option, + attribute_src: Option, + attribute_dst: Option, + escrow_mint: Option, + escrow_account: Option, + system_program: Option, + ata_program: Option, + token_program: Option, + sysvar_instructions: Option, + authority: Option, + amount: Option, +} + +impl TransferOutOfEscrowBuilder { + pub fn new() -> Self { + Self::default() + } + /// Escrow account + #[inline(always)] + pub fn escrow(&mut self, escrow: solana_program::pubkey::Pubkey) -> &mut Self { + self.escrow = Some(escrow); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Wallet paying for the transaction and new account + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Mint account for the new attribute + #[inline(always)] + pub fn attribute_mint(&mut self, attribute_mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.attribute_mint = Some(attribute_mint); + self + } + /// Token account source for the new attribute + #[inline(always)] + pub fn attribute_src(&mut self, attribute_src: solana_program::pubkey::Pubkey) -> &mut Self { + self.attribute_src = Some(attribute_src); + self + } + /// Token account, owned by TM, destination for the new attribute + #[inline(always)] + pub fn attribute_dst(&mut self, attribute_dst: solana_program::pubkey::Pubkey) -> &mut Self { + self.attribute_dst = Some(attribute_dst); + self + } + /// Mint account that the escrow is attached + #[inline(always)] + pub fn escrow_mint(&mut self, escrow_mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.escrow_mint = Some(escrow_mint); + self + } + /// Token account that holds the token the escrow is attached to + #[inline(always)] + pub fn escrow_account(&mut self, escrow_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.escrow_account = Some(escrow_account); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Associated Token program + #[inline(always)] + pub fn ata_program(&mut self, ata_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.ata_program = Some(ata_program); + self + } + /// Token program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Authority/creator of the escrow account + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = TransferOutOfEscrow { + escrow: self.escrow.expect("escrow is not set"), + metadata: self.metadata.expect("metadata is not set"), + payer: self.payer.expect("payer is not set"), + attribute_mint: self.attribute_mint.expect("attribute_mint is not set"), + attribute_src: self.attribute_src.expect("attribute_src is not set"), + attribute_dst: self.attribute_dst.expect("attribute_dst is not set"), + escrow_mint: self.escrow_mint.expect("escrow_mint is not set"), + escrow_account: self.escrow_account.expect("escrow_account is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + ata_program: self.ata_program.unwrap_or(solana_program::pubkey!( + "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + )), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authority: self.authority, + }; + let args = TransferOutOfEscrowInstructionArgs { + amount: self.amount.clone().unwrap_or(1), + }; + + accounts.instruction(args) + } +} + +/// `transfer_out_of_escrow` CPI instruction. +pub struct TransferOutOfEscrowCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Escrow account + pub escrow: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Wallet paying for the transaction and new account + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account for the new attribute + pub attribute_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account source for the new attribute + pub attribute_src: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account, owned by TM, destination for the new attribute + pub attribute_dst: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account that the escrow is attached + pub escrow_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account that holds the token the escrow is attached to + pub escrow_account: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Associated Token program + pub ata_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Authority/creator of the escrow account + pub authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: TransferOutOfEscrowInstructionArgs, +} + +impl<'a> TransferOutOfEscrowCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(13); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.escrow.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.attribute_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.attribute_src.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.attribute_dst.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.escrow_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.escrow_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.ata_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authority.key, + true, + )); + } + let mut data = TransferOutOfEscrowInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(13 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.escrow.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.attribute_mint.clone()); + account_infos.push(self.attribute_src.clone()); + account_infos.push(self.attribute_dst.clone()); + account_infos.push(self.escrow_mint.clone()); + account_infos.push(self.escrow_account.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.ata_program.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authority) = self.authority { + account_infos.push(authority.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `transfer_out_of_escrow` CPI instruction builder. +pub struct TransferOutOfEscrowCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> TransferOutOfEscrowCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(TransferOutOfEscrowCpiBuilderInstruction { + __program: program, + escrow: None, + metadata: None, + payer: None, + attribute_mint: None, + attribute_src: None, + attribute_dst: None, + escrow_mint: None, + escrow_account: None, + system_program: None, + ata_program: None, + token_program: None, + sysvar_instructions: None, + authority: None, + amount: None, + }); + Self { instruction } + } + /// Escrow account + #[inline(always)] + pub fn escrow( + &mut self, + escrow: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.escrow = Some(escrow); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Wallet paying for the transaction and new account + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Mint account for the new attribute + #[inline(always)] + pub fn attribute_mint( + &mut self, + attribute_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.attribute_mint = Some(attribute_mint); + self + } + /// Token account source for the new attribute + #[inline(always)] + pub fn attribute_src( + &mut self, + attribute_src: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.attribute_src = Some(attribute_src); + self + } + /// Token account, owned by TM, destination for the new attribute + #[inline(always)] + pub fn attribute_dst( + &mut self, + attribute_dst: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.attribute_dst = Some(attribute_dst); + self + } + /// Mint account that the escrow is attached + #[inline(always)] + pub fn escrow_mint( + &mut self, + escrow_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.escrow_mint = Some(escrow_mint); + self + } + /// Token account that holds the token the escrow is attached to + #[inline(always)] + pub fn escrow_account( + &mut self, + escrow_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.escrow_account = Some(escrow_account); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Associated Token program + #[inline(always)] + pub fn ata_program( + &mut self, + ata_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.ata_program = Some(ata_program); + self + } + /// Token program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Authority/creator of the escrow account + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> TransferOutOfEscrowCpi<'a> { + let args = TransferOutOfEscrowInstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + }; + + TransferOutOfEscrowCpi { + __program: self.instruction.__program, + + escrow: self.instruction.escrow.expect("escrow is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + attribute_mint: self + .instruction + .attribute_mint + .expect("attribute_mint is not set"), + + attribute_src: self + .instruction + .attribute_src + .expect("attribute_src is not set"), + + attribute_dst: self + .instruction + .attribute_dst + .expect("attribute_dst is not set"), + + escrow_mint: self + .instruction + .escrow_mint + .expect("escrow_mint is not set"), + + escrow_account: self + .instruction + .escrow_account + .expect("escrow_account is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + ata_program: self + .instruction + .ata_program + .expect("ata_program is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authority: self.instruction.authority, + __args: args, + } + } +} + +struct TransferOutOfEscrowCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + escrow: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + attribute_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + attribute_src: Option<&'a solana_program::account_info::AccountInfo<'a>>, + attribute_dst: Option<&'a solana_program::account_info::AccountInfo<'a>>, + escrow_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + escrow_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + ata_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, +} diff --git a/clients/rust/src/generated/instructions/transfer_v1.rs b/clients/rust/src/generated/instructions/transfer_v1.rs new file mode 100644 index 00000000..2256c740 --- /dev/null +++ b/clients/rust/src/generated/instructions/transfer_v1.rs @@ -0,0 +1,887 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct TransferV1 { + /// Token account + pub token: solana_program::pubkey::Pubkey, + /// Token account owner + pub token_owner: solana_program::pubkey::Pubkey, + /// Destination token account + pub destination_token: solana_program::pubkey::Pubkey, + /// Destination token account owner + pub destination_owner: solana_program::pubkey::Pubkey, + /// Mint of token asset + pub mint: solana_program::pubkey::Pubkey, + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// Edition of token asset + pub edition: Option, + /// Owner token record account + pub token_record: Option, + /// Destination token record account + pub destination_token_record: Option, + /// Transfer authority (token owner or delegate) + pub authority: solana_program::pubkey::Pubkey, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System Program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: solana_program::pubkey::Pubkey, + /// SPL Associated Token Account program + pub spl_ata_program: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl TransferV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: TransferV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(17); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_owner, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.destination_token, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.destination_owner, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(destination_token_record) = self.destination_token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + destination_token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.spl_ata_program, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = TransferV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct TransferV1InstructionData { + discriminator: u8, + transfer_v1_discriminator: u8, +} + +impl TransferV1InstructionData { + fn new() -> Self { + Self { + discriminator: 49, + transfer_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct TransferV1InstructionArgs { + pub amount: u64, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct TransferV1Builder { + token: Option, + token_owner: Option, + destination_token: Option, + destination_owner: Option, + mint: Option, + metadata: Option, + edition: Option, + token_record: Option, + destination_token_record: Option, + authority: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + spl_ata_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + amount: Option, + authorization_data: Option, +} + +impl TransferV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Token account owner + #[inline(always)] + pub fn token_owner(&mut self, token_owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_owner = Some(token_owner); + self + } + /// Destination token account + #[inline(always)] + pub fn destination_token( + &mut self, + destination_token: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.destination_token = Some(destination_token); + self + } + /// Destination token account owner + #[inline(always)] + pub fn destination_owner( + &mut self, + destination_owner: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.destination_owner = Some(destination_owner); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition of token asset + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// `[optional account]` + /// Owner token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// `[optional account]` + /// Destination token record account + #[inline(always)] + pub fn destination_token_record( + &mut self, + destination_token_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.destination_token_record = Some(destination_token_record); + self + } + /// Transfer authority (token owner or delegate) + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// SPL Associated Token Account program + #[inline(always)] + pub fn spl_ata_program( + &mut self, + spl_ata_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_ata_program = Some(spl_ata_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = TransferV1 { + token: self.token.expect("token is not set"), + token_owner: self.token_owner.expect("token_owner is not set"), + destination_token: self + .destination_token + .expect("destination_token is not set"), + destination_owner: self + .destination_owner + .expect("destination_owner is not set"), + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + token_record: self.token_record, + destination_token_record: self.destination_token_record, + authority: self.authority.expect("authority is not set"), + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + spl_ata_program: self.spl_ata_program.unwrap_or(solana_program::pubkey!( + "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = TransferV1InstructionArgs { + amount: self.amount.clone().unwrap_or(1), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `transfer_v1` CPI instruction. +pub struct TransferV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Token account owner + pub token_owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Destination token account + pub destination_token: &'a solana_program::account_info::AccountInfo<'a>, + /// Destination token account owner + pub destination_owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of token asset + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition of token asset + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Owner token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Destination token record account + pub destination_token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Transfer authority (token owner or delegate) + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System Program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Associated Token Account program + pub spl_ata_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: TransferV1InstructionArgs, +} + +impl<'a> TransferV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(17); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_owner.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.destination_token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.destination_owner.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(destination_token_record) = self.destination_token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *destination_token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.spl_ata_program.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = TransferV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(17 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.token.clone()); + account_infos.push(self.token_owner.clone()); + account_infos.push(self.destination_token.clone()); + account_infos.push(self.destination_owner.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + if let Some(destination_token_record) = self.destination_token_record { + account_infos.push(destination_token_record.clone()); + } + account_infos.push(self.authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + account_infos.push(self.spl_token_program.clone()); + account_infos.push(self.spl_ata_program.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `transfer_v1` CPI instruction builder. +pub struct TransferV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> TransferV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(TransferV1CpiBuilderInstruction { + __program: program, + token: None, + token_owner: None, + destination_token: None, + destination_owner: None, + mint: None, + metadata: None, + edition: None, + token_record: None, + destination_token_record: None, + authority: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + spl_ata_program: None, + authorization_rules_program: None, + authorization_rules: None, + amount: None, + authorization_data: None, + }); + Self { instruction } + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Token account owner + #[inline(always)] + pub fn token_owner( + &mut self, + token_owner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_owner = Some(token_owner); + self + } + /// Destination token account + #[inline(always)] + pub fn destination_token( + &mut self, + destination_token: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.destination_token = Some(destination_token); + self + } + /// Destination token account owner + #[inline(always)] + pub fn destination_owner( + &mut self, + destination_owner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.destination_owner = Some(destination_owner); + self + } + /// Mint of token asset + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition of token asset + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// `[optional account]` + /// Owner token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// `[optional account]` + /// Destination token record account + #[inline(always)] + pub fn destination_token_record( + &mut self, + destination_token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.destination_token_record = Some(destination_token_record); + self + } + /// Transfer authority (token owner or delegate) + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System Program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// SPL Associated Token Account program + #[inline(always)] + pub fn spl_ata_program( + &mut self, + spl_ata_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_ata_program = Some(spl_ata_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to '1']` + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> TransferV1Cpi<'a> { + let args = TransferV1InstructionArgs { + amount: self.instruction.amount.clone().unwrap_or(1), + authorization_data: self.instruction.authorization_data.clone(), + }; + + TransferV1Cpi { + __program: self.instruction.__program, + + token: self.instruction.token.expect("token is not set"), + + token_owner: self + .instruction + .token_owner + .expect("token_owner is not set"), + + destination_token: self + .instruction + .destination_token + .expect("destination_token is not set"), + + destination_owner: self + .instruction + .destination_owner + .expect("destination_owner is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + token_record: self.instruction.token_record, + + destination_token_record: self.instruction.destination_token_record, + + authority: self.instruction.authority.expect("authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self + .instruction + .spl_token_program + .expect("spl_token_program is not set"), + + spl_ata_program: self + .instruction + .spl_ata_program + .expect("spl_ata_program is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct TransferV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + destination_token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + destination_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + destination_token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_ata_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + amount: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/unlock_v1.rs b/clients/rust/src/generated/instructions/unlock_v1.rs new file mode 100644 index 00000000..c48e2440 --- /dev/null +++ b/clients/rust/src/generated/instructions/unlock_v1.rs @@ -0,0 +1,716 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UnlockV1 { + /// Delegate or freeze authority + pub authority: solana_program::pubkey::Pubkey, + /// Token owner account + pub token_owner: Option, + /// Token account + pub token: solana_program::pubkey::Pubkey, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Token record account + pub token_record: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// System program + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UnlockV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UnlockV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(13); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(token_owner) = self.token_owner { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token_owner, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + token_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UnlockV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UnlockV1InstructionData { + discriminator: u8, + unlock_v1_discriminator: u8, +} + +impl UnlockV1InstructionData { + fn new() -> Self { + Self { + discriminator: 47, + unlock_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UnlockV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UnlockV1Builder { + authority: Option, + token_owner: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + token_record: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl UnlockV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Delegate or freeze authority + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Token owner account + #[inline(always)] + pub fn token_owner(&mut self, token_owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_owner = Some(token_owner); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record(&mut self, token_record: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_record = Some(token_record); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// System program + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UnlockV1 { + authority: self.authority.expect("authority is not set"), + token_owner: self.token_owner, + token: self.token.expect("token is not set"), + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + token_record: self.token_record, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UnlockV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `unlock_v1` CPI instruction. +pub struct UnlockV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate or freeze authority + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Token owner account + pub token_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token record account + pub token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UnlockV1InstructionArgs, +} + +impl<'a> UnlockV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(13); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(token_owner) = self.token_owner { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token_owner.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token_record) = self.token_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *token_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UnlockV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(13 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(token_owner) = self.token_owner { + account_infos.push(token_owner.clone()); + } + account_infos.push(self.token.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + if let Some(token_record) = self.token_record { + account_infos.push(token_record.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `unlock_v1` CPI instruction builder. +pub struct UnlockV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UnlockV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UnlockV1CpiBuilderInstruction { + __program: program, + authority: None, + token_owner: None, + token: None, + mint: None, + metadata: None, + edition: None, + token_record: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// Delegate or freeze authority + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Token owner account + #[inline(always)] + pub fn token_owner( + &mut self, + token_owner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_owner = Some(token_owner); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// `[optional account]` + /// Token record account + #[inline(always)] + pub fn token_record( + &mut self, + token_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_record = Some(token_record); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// System program + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UnlockV1Cpi<'a> { + let args = UnlockV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + UnlockV1Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + token_owner: self.instruction.token_owner, + + token: self.instruction.token.expect("token is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + token_record: self.instruction.token_record, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UnlockV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/unverify_collection.rs b/clients/rust/src/generated/instructions/unverify_collection.rs new file mode 100644 index 00000000..822c79e8 --- /dev/null +++ b/clients/rust/src/generated/instructions/unverify_collection.rs @@ -0,0 +1,357 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UnverifyCollection { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Collection Authority + pub collection_authority: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Metadata Account of the Collection + pub collection: solana_program::pubkey::Pubkey, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: solana_program::pubkey::Pubkey, + /// Collection Authority Record PDA + pub collection_authority_record: Option, +} + +impl UnverifyCollection { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(6); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_master_edition_account, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_authority_record, + false, + )); + } + let data = UnverifyCollectionInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UnverifyCollectionInstructionData { + discriminator: u8, +} + +impl UnverifyCollectionInstructionData { + fn new() -> Self { + Self { discriminator: 22 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct UnverifyCollectionBuilder { + metadata: Option, + collection_authority: Option, + collection_mint: Option, + collection: Option, + collection_master_edition_account: Option, + collection_authority_record: Option, +} + +impl UnverifyCollectionBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Collection Authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority = Some(collection_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { + self.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_master_edition_account = Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UnverifyCollection { + metadata: self.metadata.expect("metadata is not set"), + collection_authority: self + .collection_authority + .expect("collection_authority is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection: self.collection.expect("collection is not set"), + collection_master_edition_account: self + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + collection_authority_record: self.collection_authority_record, + }; + + accounts.instruction() + } +} + +/// `unverify_collection` CPI instruction. +pub struct UnverifyCollectionCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority + pub collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata Account of the Collection + pub collection: &'a solana_program::account_info::AccountInfo<'a>, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> UnverifyCollectionCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(6); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_master_edition_account.key, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_authority_record.key, + false, + )); + } + let data = UnverifyCollectionInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(6 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.collection_authority.clone()); + account_infos.push(self.collection_mint.clone()); + account_infos.push(self.collection.clone()); + account_infos.push(self.collection_master_edition_account.clone()); + if let Some(collection_authority_record) = self.collection_authority_record { + account_infos.push(collection_authority_record.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `unverify_collection` CPI instruction builder. +pub struct UnverifyCollectionCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UnverifyCollectionCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UnverifyCollectionCpiBuilderInstruction { + __program: program, + metadata: None, + collection_authority: None, + collection_mint: None, + collection: None, + collection_master_edition_account: None, + collection_authority_record: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Collection Authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority = Some(collection_authority); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection( + &mut self, + collection: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_master_edition_account = + Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UnverifyCollectionCpi<'a> { + UnverifyCollectionCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_authority: self + .instruction + .collection_authority + .expect("collection_authority is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection: self.instruction.collection.expect("collection is not set"), + + collection_master_edition_account: self + .instruction + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + + collection_authority_record: self.instruction.collection_authority_record, + } + } +} + +struct UnverifyCollectionCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_master_edition_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/unverify_collection_v1.rs b/clients/rust/src/generated/instructions/unverify_collection_v1.rs new file mode 100644 index 00000000..6711c6ef --- /dev/null +++ b/clients/rust/src/generated/instructions/unverify_collection_v1.rs @@ -0,0 +1,422 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UnverifyCollectionV1 { + /// Creator to verify, collection (or metadata if parent burned) update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Metadata Account of the Collection + pub collection_metadata: Option, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, +} + +impl UnverifyCollectionV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + collection_metadata, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + let data = UnverifyCollectionV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UnverifyCollectionV1InstructionData { + discriminator: u8, + unverify_collection_v1_discriminator: u8, +} + +impl UnverifyCollectionV1InstructionData { + fn new() -> Self { + Self { + discriminator: 53, + unverify_collection_v1_discriminator: 1, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct UnverifyCollectionV1Builder { + authority: Option, + delegate_record: Option, + metadata: Option, + collection_mint: Option, + collection_metadata: Option, + system_program: Option, + sysvar_instructions: Option, +} + +impl UnverifyCollectionV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Creator to verify, collection (or metadata if parent burned) update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UnverifyCollectionV1 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + metadata: self.metadata.expect("metadata is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection_metadata: self.collection_metadata, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + }; + + accounts.instruction() + } +} + +/// `unverify_collection_v1` CPI instruction. +pub struct UnverifyCollectionV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Creator to verify, collection (or metadata if parent burned) update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata Account of the Collection + pub collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> UnverifyCollectionV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + *collection_metadata.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + let data = UnverifyCollectionV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.metadata.clone()); + account_infos.push(self.collection_mint.clone()); + if let Some(collection_metadata) = self.collection_metadata { + account_infos.push(collection_metadata.clone()); + } + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `unverify_collection_v1` CPI instruction builder. +pub struct UnverifyCollectionV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UnverifyCollectionV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UnverifyCollectionV1CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + metadata: None, + collection_mint: None, + collection_metadata: None, + system_program: None, + sysvar_instructions: None, + }); + Self { instruction } + } + /// Creator to verify, collection (or metadata if parent burned) update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UnverifyCollectionV1Cpi<'a> { + UnverifyCollectionV1Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection_metadata: self.instruction.collection_metadata, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + } + } +} + +struct UnverifyCollectionV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/unverify_creator_v1.rs b/clients/rust/src/generated/instructions/unverify_creator_v1.rs new file mode 100644 index 00000000..89469179 --- /dev/null +++ b/clients/rust/src/generated/instructions/unverify_creator_v1.rs @@ -0,0 +1,437 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UnverifyCreatorV1 { + /// Creator to verify, collection (or metadata if parent burned) update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: Option, + /// Metadata Account of the Collection + pub collection_metadata: Option, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, +} + +impl UnverifyCreatorV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(collection_mint) = self.collection_mint { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_mint, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + collection_metadata, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + let data = UnverifyCreatorV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UnverifyCreatorV1InstructionData { + discriminator: u8, + unverify_creator_v1_discriminator: u8, +} + +impl UnverifyCreatorV1InstructionData { + fn new() -> Self { + Self { + discriminator: 53, + unverify_creator_v1_discriminator: 0, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct UnverifyCreatorV1Builder { + authority: Option, + delegate_record: Option, + metadata: Option, + collection_mint: Option, + collection_metadata: Option, + system_program: Option, + sysvar_instructions: Option, +} + +impl UnverifyCreatorV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Creator to verify, collection (or metadata if parent burned) update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UnverifyCreatorV1 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + metadata: self.metadata.expect("metadata is not set"), + collection_mint: self.collection_mint, + collection_metadata: self.collection_metadata, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + }; + + accounts.instruction() + } +} + +/// `unverify_creator_v1` CPI instruction. +pub struct UnverifyCreatorV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Creator to verify, collection (or metadata if parent burned) update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Metadata Account of the Collection + pub collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> UnverifyCreatorV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(collection_mint) = self.collection_mint { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_mint.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + *collection_metadata.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + let data = UnverifyCreatorV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.metadata.clone()); + if let Some(collection_mint) = self.collection_mint { + account_infos.push(collection_mint.clone()); + } + if let Some(collection_metadata) = self.collection_metadata { + account_infos.push(collection_metadata.clone()); + } + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `unverify_creator_v1` CPI instruction builder. +pub struct UnverifyCreatorV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UnverifyCreatorV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UnverifyCreatorV1CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + metadata: None, + collection_mint: None, + collection_metadata: None, + system_program: None, + sysvar_instructions: None, + }); + Self { instruction } + } + /// Creator to verify, collection (or metadata if parent burned) update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UnverifyCreatorV1Cpi<'a> { + UnverifyCreatorV1Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_mint: self.instruction.collection_mint, + + collection_metadata: self.instruction.collection_metadata, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + } + } +} + +struct UnverifyCreatorV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/unverify_sized_collection_item.rs b/clients/rust/src/generated/instructions/unverify_sized_collection_item.rs new file mode 100644 index 00000000..1b237d05 --- /dev/null +++ b/clients/rust/src/generated/instructions/unverify_sized_collection_item.rs @@ -0,0 +1,387 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UnverifySizedCollectionItem { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Collection Authority + pub collection_authority: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Metadata Account of the Collection + pub collection: solana_program::pubkey::Pubkey, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: solana_program::pubkey::Pubkey, + /// Collection Authority Record PDA + pub collection_authority_record: Option, +} + +impl UnverifySizedCollectionItem { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_master_edition_account, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_authority_record, + false, + )); + } + let data = UnverifySizedCollectionItemInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UnverifySizedCollectionItemInstructionData { + discriminator: u8, +} + +impl UnverifySizedCollectionItemInstructionData { + fn new() -> Self { + Self { discriminator: 31 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct UnverifySizedCollectionItemBuilder { + metadata: Option, + collection_authority: Option, + payer: Option, + collection_mint: Option, + collection: Option, + collection_master_edition_account: Option, + collection_authority_record: Option, +} + +impl UnverifySizedCollectionItemBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Collection Authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority = Some(collection_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { + self.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_master_edition_account = Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UnverifySizedCollectionItem { + metadata: self.metadata.expect("metadata is not set"), + collection_authority: self + .collection_authority + .expect("collection_authority is not set"), + payer: self.payer.expect("payer is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection: self.collection.expect("collection is not set"), + collection_master_edition_account: self + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + collection_authority_record: self.collection_authority_record, + }; + + accounts.instruction() + } +} + +/// `unverify_sized_collection_item` CPI instruction. +pub struct UnverifySizedCollectionItemCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority + pub collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata Account of the Collection + pub collection: &'a solana_program::account_info::AccountInfo<'a>, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> UnverifySizedCollectionItemCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_master_edition_account.key, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_authority_record.key, + false, + )); + } + let data = UnverifySizedCollectionItemInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.collection_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.collection_mint.clone()); + account_infos.push(self.collection.clone()); + account_infos.push(self.collection_master_edition_account.clone()); + if let Some(collection_authority_record) = self.collection_authority_record { + account_infos.push(collection_authority_record.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `unverify_sized_collection_item` CPI instruction builder. +pub struct UnverifySizedCollectionItemCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UnverifySizedCollectionItemCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UnverifySizedCollectionItemCpiBuilderInstruction { + __program: program, + metadata: None, + collection_authority: None, + payer: None, + collection_mint: None, + collection: None, + collection_master_edition_account: None, + collection_authority_record: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Collection Authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority = Some(collection_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection( + &mut self, + collection: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_master_edition_account = + Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UnverifySizedCollectionItemCpi<'a> { + UnverifySizedCollectionItemCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_authority: self + .instruction + .collection_authority + .expect("collection_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection: self.instruction.collection.expect("collection is not set"), + + collection_master_edition_account: self + .instruction + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + + collection_authority_record: self.instruction.collection_authority_record, + } + } +} + +struct UnverifySizedCollectionItemCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_master_edition_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/update_as_authority_item_delegate_v2.rs b/clients/rust/src/generated/instructions/update_as_authority_item_delegate_v2.rs new file mode 100644 index 00000000..2858d93b --- /dev/null +++ b/clients/rust/src/generated/instructions/update_as_authority_item_delegate_v2.rs @@ -0,0 +1,707 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::TokenStandard; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +/// Accounts. +pub struct UpdateAsAuthorityItemDelegateV2 { + /// Update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: Option, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UpdateAsAuthorityItemDelegateV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateAsAuthorityItemDelegateV2InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsAuthorityItemDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateAsAuthorityItemDelegateV2InstructionData { + discriminator: u8, + update_as_authority_item_delegate_v2_discriminator: u8, +} + +impl UpdateAsAuthorityItemDelegateV2InstructionData { + fn new() -> Self { + Self { + discriminator: 50, + update_as_authority_item_delegate_v2_discriminator: 2, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateAsAuthorityItemDelegateV2InstructionArgs { + pub new_update_authority: Option, + pub primary_sale_happened: Option, + pub is_mutable: Option, + pub token_standard: Option, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateAsAuthorityItemDelegateV2Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authorization_rules_program: Option, + authorization_rules: Option, + new_update_authority: Option, + primary_sale_happened: Option, + is_mutable: Option, + token_standard: Option, + authorization_data: Option, +} + +impl UpdateAsAuthorityItemDelegateV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_update_authority(&mut self, new_update_authority: Pubkey) -> &mut Self { + self.new_update_authority = Some(new_update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.is_mutable = Some(is_mutable); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self { + self.token_standard = Some(token_standard); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateAsAuthorityItemDelegateV2 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token, + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UpdateAsAuthorityItemDelegateV2InstructionArgs { + new_update_authority: self.new_update_authority.clone(), + primary_sale_happened: self.primary_sale_happened.clone(), + is_mutable: self.is_mutable.clone(), + token_standard: self.token_standard.clone(), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_as_authority_item_delegate_v2` CPI instruction. +pub struct UpdateAsAuthorityItemDelegateV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UpdateAsAuthorityItemDelegateV2InstructionArgs, +} + +impl<'a> UpdateAsAuthorityItemDelegateV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsAuthorityItemDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_as_authority_item_delegate_v2` CPI instruction builder. +pub struct UpdateAsAuthorityItemDelegateV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateAsAuthorityItemDelegateV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateAsAuthorityItemDelegateV2CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authorization_rules_program: None, + authorization_rules: None, + new_update_authority: None, + primary_sale_happened: None, + is_mutable: None, + token_standard: None, + authorization_data: None, + }); + Self { instruction } + } + /// Update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_update_authority(&mut self, new_update_authority: Pubkey) -> &mut Self { + self.instruction.new_update_authority = Some(new_update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.instruction.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.instruction.is_mutable = Some(is_mutable); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self { + self.instruction.token_standard = Some(token_standard); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateAsAuthorityItemDelegateV2Cpi<'a> { + let args = UpdateAsAuthorityItemDelegateV2InstructionArgs { + new_update_authority: self.instruction.new_update_authority.clone(), + primary_sale_happened: self.instruction.primary_sale_happened.clone(), + is_mutable: self.instruction.is_mutable.clone(), + token_standard: self.instruction.token_standard.clone(), + authorization_data: self.instruction.authorization_data.clone(), + }; + + UpdateAsAuthorityItemDelegateV2Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token, + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UpdateAsAuthorityItemDelegateV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_update_authority: Option, + primary_sale_happened: Option, + is_mutable: Option, + token_standard: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/update_as_collection_delegate_v2.rs b/clients/rust/src/generated/instructions/update_as_collection_delegate_v2.rs new file mode 100644 index 00000000..fbc84643 --- /dev/null +++ b/clients/rust/src/generated/instructions/update_as_collection_delegate_v2.rs @@ -0,0 +1,656 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::CollectionToggle; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UpdateAsCollectionDelegateV2 { + /// Update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: Option, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UpdateAsCollectionDelegateV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateAsCollectionDelegateV2InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsCollectionDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateAsCollectionDelegateV2InstructionData { + discriminator: u8, + update_as_collection_delegate_v2_discriminator: u8, +} + +impl UpdateAsCollectionDelegateV2InstructionData { + fn new() -> Self { + Self { + discriminator: 50, + update_as_collection_delegate_v2_discriminator: 3, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateAsCollectionDelegateV2InstructionArgs { + pub collection: CollectionToggle, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateAsCollectionDelegateV2Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authorization_rules_program: Option, + authorization_rules: Option, + collection: Option, + authorization_data: Option, +} + +impl UpdateAsCollectionDelegateV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to 'CollectionToggle::None']` + #[inline(always)] + pub fn collection(&mut self, collection: CollectionToggle) -> &mut Self { + self.collection = Some(collection); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateAsCollectionDelegateV2 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token, + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UpdateAsCollectionDelegateV2InstructionArgs { + collection: self.collection.clone().unwrap_or(CollectionToggle::None), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_as_collection_delegate_v2` CPI instruction. +pub struct UpdateAsCollectionDelegateV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UpdateAsCollectionDelegateV2InstructionArgs, +} + +impl<'a> UpdateAsCollectionDelegateV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsCollectionDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_as_collection_delegate_v2` CPI instruction builder. +pub struct UpdateAsCollectionDelegateV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateAsCollectionDelegateV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateAsCollectionDelegateV2CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authorization_rules_program: None, + authorization_rules: None, + collection: None, + authorization_data: None, + }); + Self { instruction } + } + /// Update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to 'CollectionToggle::None']` + #[inline(always)] + pub fn collection(&mut self, collection: CollectionToggle) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateAsCollectionDelegateV2Cpi<'a> { + let args = UpdateAsCollectionDelegateV2InstructionArgs { + collection: self + .instruction + .collection + .clone() + .unwrap_or(CollectionToggle::None), + authorization_data: self.instruction.authorization_data.clone(), + }; + + UpdateAsCollectionDelegateV2Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token, + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UpdateAsCollectionDelegateV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/update_as_collection_item_delegate_v2.rs b/clients/rust/src/generated/instructions/update_as_collection_item_delegate_v2.rs new file mode 100644 index 00000000..0015f284 --- /dev/null +++ b/clients/rust/src/generated/instructions/update_as_collection_item_delegate_v2.rs @@ -0,0 +1,656 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::CollectionToggle; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UpdateAsCollectionItemDelegateV2 { + /// Update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: Option, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UpdateAsCollectionItemDelegateV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateAsCollectionItemDelegateV2InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsCollectionItemDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateAsCollectionItemDelegateV2InstructionData { + discriminator: u8, + update_as_collection_item_delegate_v2_discriminator: u8, +} + +impl UpdateAsCollectionItemDelegateV2InstructionData { + fn new() -> Self { + Self { + discriminator: 50, + update_as_collection_item_delegate_v2_discriminator: 7, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateAsCollectionItemDelegateV2InstructionArgs { + pub collection: CollectionToggle, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateAsCollectionItemDelegateV2Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authorization_rules_program: Option, + authorization_rules: Option, + collection: Option, + authorization_data: Option, +} + +impl UpdateAsCollectionItemDelegateV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to 'CollectionToggle::None']` + #[inline(always)] + pub fn collection(&mut self, collection: CollectionToggle) -> &mut Self { + self.collection = Some(collection); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateAsCollectionItemDelegateV2 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token, + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UpdateAsCollectionItemDelegateV2InstructionArgs { + collection: self.collection.clone().unwrap_or(CollectionToggle::None), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_as_collection_item_delegate_v2` CPI instruction. +pub struct UpdateAsCollectionItemDelegateV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UpdateAsCollectionItemDelegateV2InstructionArgs, +} + +impl<'a> UpdateAsCollectionItemDelegateV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsCollectionItemDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_as_collection_item_delegate_v2` CPI instruction builder. +pub struct UpdateAsCollectionItemDelegateV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateAsCollectionItemDelegateV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateAsCollectionItemDelegateV2CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authorization_rules_program: None, + authorization_rules: None, + collection: None, + authorization_data: None, + }); + Self { instruction } + } + /// Update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to 'CollectionToggle::None']` + #[inline(always)] + pub fn collection(&mut self, collection: CollectionToggle) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateAsCollectionItemDelegateV2Cpi<'a> { + let args = UpdateAsCollectionItemDelegateV2InstructionArgs { + collection: self + .instruction + .collection + .clone() + .unwrap_or(CollectionToggle::None), + authorization_data: self.instruction.authorization_data.clone(), + }; + + UpdateAsCollectionItemDelegateV2Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token, + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UpdateAsCollectionItemDelegateV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/update_as_data_delegate_v2.rs b/clients/rust/src/generated/instructions/update_as_data_delegate_v2.rs new file mode 100644 index 00000000..2eb79827 --- /dev/null +++ b/clients/rust/src/generated/instructions/update_as_data_delegate_v2.rs @@ -0,0 +1,661 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::Creator; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UpdateAsDataDelegateV2 { + /// Update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: Option, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UpdateAsDataDelegateV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateAsDataDelegateV2InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsDataDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateAsDataDelegateV2InstructionData { + discriminator: u8, + update_as_data_delegate_v2_discriminator: u8, +} + +impl UpdateAsDataDelegateV2InstructionData { + fn new() -> Self { + Self { + discriminator: 50, + update_as_data_delegate_v2_discriminator: 4, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateAsDataDelegateV2InstructionArgs { + pub data: Option, + pub authorization_data: Option, +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct UpdateAsDataDelegateV2InstructionDataData { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateAsDataDelegateV2Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authorization_rules_program: Option, + authorization_rules: Option, + data: Option, + authorization_data: Option, +} + +impl UpdateAsDataDelegateV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: UpdateAsDataDelegateV2InstructionDataData) -> &mut Self { + self.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateAsDataDelegateV2 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token, + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UpdateAsDataDelegateV2InstructionArgs { + data: self.data.clone(), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_as_data_delegate_v2` CPI instruction. +pub struct UpdateAsDataDelegateV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UpdateAsDataDelegateV2InstructionArgs, +} + +impl<'a> UpdateAsDataDelegateV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsDataDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_as_data_delegate_v2` CPI instruction builder. +pub struct UpdateAsDataDelegateV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateAsDataDelegateV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateAsDataDelegateV2CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authorization_rules_program: None, + authorization_rules: None, + data: None, + authorization_data: None, + }); + Self { instruction } + } + /// Update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: UpdateAsDataDelegateV2InstructionDataData) -> &mut Self { + self.instruction.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateAsDataDelegateV2Cpi<'a> { + let args = UpdateAsDataDelegateV2InstructionArgs { + data: self.instruction.data.clone(), + authorization_data: self.instruction.authorization_data.clone(), + }; + + UpdateAsDataDelegateV2Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token, + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UpdateAsDataDelegateV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + data: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/update_as_data_item_delegate_v2.rs b/clients/rust/src/generated/instructions/update_as_data_item_delegate_v2.rs new file mode 100644 index 00000000..4d7031ba --- /dev/null +++ b/clients/rust/src/generated/instructions/update_as_data_item_delegate_v2.rs @@ -0,0 +1,661 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::Creator; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UpdateAsDataItemDelegateV2 { + /// Update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: Option, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UpdateAsDataItemDelegateV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateAsDataItemDelegateV2InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsDataItemDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateAsDataItemDelegateV2InstructionData { + discriminator: u8, + update_as_data_item_delegate_v2_discriminator: u8, +} + +impl UpdateAsDataItemDelegateV2InstructionData { + fn new() -> Self { + Self { + discriminator: 50, + update_as_data_item_delegate_v2_discriminator: 6, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateAsDataItemDelegateV2InstructionArgs { + pub data: Option, + pub authorization_data: Option, +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct UpdateAsDataItemDelegateV2InstructionDataData { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateAsDataItemDelegateV2Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authorization_rules_program: Option, + authorization_rules: Option, + data: Option, + authorization_data: Option, +} + +impl UpdateAsDataItemDelegateV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: UpdateAsDataItemDelegateV2InstructionDataData) -> &mut Self { + self.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateAsDataItemDelegateV2 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token, + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UpdateAsDataItemDelegateV2InstructionArgs { + data: self.data.clone(), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_as_data_item_delegate_v2` CPI instruction. +pub struct UpdateAsDataItemDelegateV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UpdateAsDataItemDelegateV2InstructionArgs, +} + +impl<'a> UpdateAsDataItemDelegateV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsDataItemDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_as_data_item_delegate_v2` CPI instruction builder. +pub struct UpdateAsDataItemDelegateV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateAsDataItemDelegateV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateAsDataItemDelegateV2CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authorization_rules_program: None, + authorization_rules: None, + data: None, + authorization_data: None, + }); + Self { instruction } + } + /// Update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: UpdateAsDataItemDelegateV2InstructionDataData) -> &mut Self { + self.instruction.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateAsDataItemDelegateV2Cpi<'a> { + let args = UpdateAsDataItemDelegateV2InstructionArgs { + data: self.instruction.data.clone(), + authorization_data: self.instruction.authorization_data.clone(), + }; + + UpdateAsDataItemDelegateV2Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token, + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UpdateAsDataItemDelegateV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + data: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/update_as_programmable_config_delegate_v2.rs b/clients/rust/src/generated/instructions/update_as_programmable_config_delegate_v2.rs new file mode 100644 index 00000000..96cdb19c --- /dev/null +++ b/clients/rust/src/generated/instructions/update_as_programmable_config_delegate_v2.rs @@ -0,0 +1,639 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::RuleSetToggle; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UpdateAsProgrammableConfigDelegateV2 { + /// Update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: solana_program::pubkey::Pubkey, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UpdateAsProgrammableConfigDelegateV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateAsProgrammableConfigDelegateV2InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsProgrammableConfigDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateAsProgrammableConfigDelegateV2InstructionData { + discriminator: u8, + update_as_programmable_config_delegate_v2_discriminator: u8, +} + +impl UpdateAsProgrammableConfigDelegateV2InstructionData { + fn new() -> Self { + Self { + discriminator: 50, + update_as_programmable_config_delegate_v2_discriminator: 5, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateAsProgrammableConfigDelegateV2InstructionArgs { + pub rule_set: RuleSetToggle, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateAsProgrammableConfigDelegateV2Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authorization_rules_program: Option, + authorization_rules: Option, + rule_set: Option, + authorization_data: Option, +} + +impl UpdateAsProgrammableConfigDelegateV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to 'RuleSetToggle::None']` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: RuleSetToggle) -> &mut Self { + self.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateAsProgrammableConfigDelegateV2 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token.expect("token is not set"), + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UpdateAsProgrammableConfigDelegateV2InstructionArgs { + rule_set: self.rule_set.clone().unwrap_or(RuleSetToggle::None), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_as_programmable_config_delegate_v2` CPI instruction. +pub struct UpdateAsProgrammableConfigDelegateV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UpdateAsProgrammableConfigDelegateV2InstructionArgs, +} + +impl<'a> UpdateAsProgrammableConfigDelegateV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsProgrammableConfigDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.token.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_as_programmable_config_delegate_v2` CPI instruction builder. +pub struct UpdateAsProgrammableConfigDelegateV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateAsProgrammableConfigDelegateV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateAsProgrammableConfigDelegateV2CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authorization_rules_program: None, + authorization_rules: None, + rule_set: None, + authorization_data: None, + }); + Self { instruction } + } + /// Update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to 'RuleSetToggle::None']` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: RuleSetToggle) -> &mut Self { + self.instruction.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateAsProgrammableConfigDelegateV2Cpi<'a> { + let args = UpdateAsProgrammableConfigDelegateV2InstructionArgs { + rule_set: self + .instruction + .rule_set + .clone() + .unwrap_or(RuleSetToggle::None), + authorization_data: self.instruction.authorization_data.clone(), + }; + + UpdateAsProgrammableConfigDelegateV2Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token.expect("token is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UpdateAsProgrammableConfigDelegateV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rule_set: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/update_as_programmable_config_item_delegate_v2.rs b/clients/rust/src/generated/instructions/update_as_programmable_config_item_delegate_v2.rs new file mode 100644 index 00000000..0c5c2c03 --- /dev/null +++ b/clients/rust/src/generated/instructions/update_as_programmable_config_item_delegate_v2.rs @@ -0,0 +1,641 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::RuleSetToggle; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UpdateAsProgrammableConfigItemDelegateV2 { + /// Update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: solana_program::pubkey::Pubkey, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UpdateAsProgrammableConfigItemDelegateV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateAsProgrammableConfigItemDelegateV2InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsProgrammableConfigItemDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateAsProgrammableConfigItemDelegateV2InstructionData { + discriminator: u8, + update_as_programmable_config_item_delegate_v2_discriminator: u8, +} + +impl UpdateAsProgrammableConfigItemDelegateV2InstructionData { + fn new() -> Self { + Self { + discriminator: 50, + update_as_programmable_config_item_delegate_v2_discriminator: 8, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateAsProgrammableConfigItemDelegateV2InstructionArgs { + pub rule_set: RuleSetToggle, + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateAsProgrammableConfigItemDelegateV2Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authorization_rules_program: Option, + authorization_rules: Option, + rule_set: Option, + authorization_data: Option, +} + +impl UpdateAsProgrammableConfigItemDelegateV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to 'RuleSetToggle::None']` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: RuleSetToggle) -> &mut Self { + self.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateAsProgrammableConfigItemDelegateV2 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token.expect("token is not set"), + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UpdateAsProgrammableConfigItemDelegateV2InstructionArgs { + rule_set: self.rule_set.clone().unwrap_or(RuleSetToggle::None), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_as_programmable_config_item_delegate_v2` CPI instruction. +pub struct UpdateAsProgrammableConfigItemDelegateV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UpdateAsProgrammableConfigItemDelegateV2InstructionArgs, +} + +impl<'a> UpdateAsProgrammableConfigItemDelegateV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsProgrammableConfigItemDelegateV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.token.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_as_programmable_config_item_delegate_v2` CPI instruction builder. +pub struct UpdateAsProgrammableConfigItemDelegateV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateAsProgrammableConfigItemDelegateV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new( + UpdateAsProgrammableConfigItemDelegateV2CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authorization_rules_program: None, + authorization_rules: None, + rule_set: None, + authorization_data: None, + }, + ); + Self { instruction } + } + /// Update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument, defaults to 'RuleSetToggle::None']` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: RuleSetToggle) -> &mut Self { + self.instruction.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateAsProgrammableConfigItemDelegateV2Cpi<'a> { + let args = UpdateAsProgrammableConfigItemDelegateV2InstructionArgs { + rule_set: self + .instruction + .rule_set + .clone() + .unwrap_or(RuleSetToggle::None), + authorization_data: self.instruction.authorization_data.clone(), + }; + + UpdateAsProgrammableConfigItemDelegateV2Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token.expect("token is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UpdateAsProgrammableConfigItemDelegateV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rule_set: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/update_as_update_authority_v2.rs b/clients/rust/src/generated/instructions/update_as_update_authority_v2.rs new file mode 100644 index 00000000..3c025ae9 --- /dev/null +++ b/clients/rust/src/generated/instructions/update_as_update_authority_v2.rs @@ -0,0 +1,826 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::CollectionDetailsToggle; +use crate::generated::types::CollectionToggle; +use crate::generated::types::Creator; +use crate::generated::types::RuleSetToggle; +use crate::generated::types::TokenStandard; +use crate::generated::types::UsesToggle; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +/// Accounts. +pub struct UpdateAsUpdateAuthorityV2 { + /// Update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: Option, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UpdateAsUpdateAuthorityV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateAsUpdateAuthorityV2InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsUpdateAuthorityV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateAsUpdateAuthorityV2InstructionData { + discriminator: u8, + update_as_update_authority_v2_discriminator: u8, +} + +impl UpdateAsUpdateAuthorityV2InstructionData { + fn new() -> Self { + Self { + discriminator: 50, + update_as_update_authority_v2_discriminator: 1, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateAsUpdateAuthorityV2InstructionArgs { + pub new_update_authority: Option, + pub data: Option, + pub primary_sale_happened: Option, + pub is_mutable: Option, + pub collection: CollectionToggle, + pub collection_details: CollectionDetailsToggle, + pub uses: UsesToggle, + pub rule_set: RuleSetToggle, + pub token_standard: Option, + pub authorization_data: Option, +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct UpdateAsUpdateAuthorityV2InstructionDataData { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateAsUpdateAuthorityV2Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authorization_rules_program: Option, + authorization_rules: Option, + new_update_authority: Option, + data: Option, + primary_sale_happened: Option, + is_mutable: Option, + collection: Option, + collection_details: Option, + uses: Option, + rule_set: Option, + token_standard: Option, + authorization_data: Option, +} + +impl UpdateAsUpdateAuthorityV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_update_authority(&mut self, new_update_authority: Pubkey) -> &mut Self { + self.new_update_authority = Some(new_update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: UpdateAsUpdateAuthorityV2InstructionDataData) -> &mut Self { + self.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.is_mutable = Some(is_mutable); + self + } + /// `[optional argument, defaults to 'CollectionToggle::None']` + #[inline(always)] + pub fn collection(&mut self, collection: CollectionToggle) -> &mut Self { + self.collection = Some(collection); + self + } + /// `[optional argument, defaults to 'CollectionDetailsToggle::None']` + #[inline(always)] + pub fn collection_details(&mut self, collection_details: CollectionDetailsToggle) -> &mut Self { + self.collection_details = Some(collection_details); + self + } + /// `[optional argument, defaults to 'UsesToggle::None']` + #[inline(always)] + pub fn uses(&mut self, uses: UsesToggle) -> &mut Self { + self.uses = Some(uses); + self + } + /// `[optional argument, defaults to 'RuleSetToggle::None']` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: RuleSetToggle) -> &mut Self { + self.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self { + self.token_standard = Some(token_standard); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateAsUpdateAuthorityV2 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token, + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UpdateAsUpdateAuthorityV2InstructionArgs { + new_update_authority: self.new_update_authority.clone(), + data: self.data.clone(), + primary_sale_happened: self.primary_sale_happened.clone(), + is_mutable: self.is_mutable.clone(), + collection: self.collection.clone().unwrap_or(CollectionToggle::None), + collection_details: self + .collection_details + .clone() + .unwrap_or(CollectionDetailsToggle::None), + uses: self.uses.clone().unwrap_or(UsesToggle::None), + rule_set: self.rule_set.clone().unwrap_or(RuleSetToggle::None), + token_standard: self.token_standard.clone(), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_as_update_authority_v2` CPI instruction. +pub struct UpdateAsUpdateAuthorityV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UpdateAsUpdateAuthorityV2InstructionArgs, +} + +impl<'a> UpdateAsUpdateAuthorityV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateAsUpdateAuthorityV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_as_update_authority_v2` CPI instruction builder. +pub struct UpdateAsUpdateAuthorityV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateAsUpdateAuthorityV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateAsUpdateAuthorityV2CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authorization_rules_program: None, + authorization_rules: None, + new_update_authority: None, + data: None, + primary_sale_happened: None, + is_mutable: None, + collection: None, + collection_details: None, + uses: None, + rule_set: None, + token_standard: None, + authorization_data: None, + }); + Self { instruction } + } + /// Update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_update_authority(&mut self, new_update_authority: Pubkey) -> &mut Self { + self.instruction.new_update_authority = Some(new_update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: UpdateAsUpdateAuthorityV2InstructionDataData) -> &mut Self { + self.instruction.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.instruction.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.instruction.is_mutable = Some(is_mutable); + self + } + /// `[optional argument, defaults to 'CollectionToggle::None']` + #[inline(always)] + pub fn collection(&mut self, collection: CollectionToggle) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// `[optional argument, defaults to 'CollectionDetailsToggle::None']` + #[inline(always)] + pub fn collection_details(&mut self, collection_details: CollectionDetailsToggle) -> &mut Self { + self.instruction.collection_details = Some(collection_details); + self + } + /// `[optional argument, defaults to 'UsesToggle::None']` + #[inline(always)] + pub fn uses(&mut self, uses: UsesToggle) -> &mut Self { + self.instruction.uses = Some(uses); + self + } + /// `[optional argument, defaults to 'RuleSetToggle::None']` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: RuleSetToggle) -> &mut Self { + self.instruction.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self { + self.instruction.token_standard = Some(token_standard); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateAsUpdateAuthorityV2Cpi<'a> { + let args = UpdateAsUpdateAuthorityV2InstructionArgs { + new_update_authority: self.instruction.new_update_authority.clone(), + data: self.instruction.data.clone(), + primary_sale_happened: self.instruction.primary_sale_happened.clone(), + is_mutable: self.instruction.is_mutable.clone(), + collection: self + .instruction + .collection + .clone() + .unwrap_or(CollectionToggle::None), + collection_details: self + .instruction + .collection_details + .clone() + .unwrap_or(CollectionDetailsToggle::None), + uses: self.instruction.uses.clone().unwrap_or(UsesToggle::None), + rule_set: self + .instruction + .rule_set + .clone() + .unwrap_or(RuleSetToggle::None), + token_standard: self.instruction.token_standard.clone(), + authorization_data: self.instruction.authorization_data.clone(), + }; + + UpdateAsUpdateAuthorityV2Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token, + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UpdateAsUpdateAuthorityV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_update_authority: Option, + data: Option, + primary_sale_happened: Option, + is_mutable: Option, + collection: Option, + collection_details: Option, + uses: Option, + rule_set: Option, + token_standard: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/update_metadata_account_v2.rs b/clients/rust/src/generated/instructions/update_metadata_account_v2.rs new file mode 100644 index 00000000..6fb291ea --- /dev/null +++ b/clients/rust/src/generated/instructions/update_metadata_account_v2.rs @@ -0,0 +1,286 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::DataV2; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +/// Accounts. +pub struct UpdateMetadataAccountV2 { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Update authority key + pub update_authority: solana_program::pubkey::Pubkey, +} + +impl UpdateMetadataAccountV2 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateMetadataAccountV2InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(2); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.update_authority, + true, + )); + let mut data = UpdateMetadataAccountV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateMetadataAccountV2InstructionData { + discriminator: u8, +} + +impl UpdateMetadataAccountV2InstructionData { + fn new() -> Self { + Self { discriminator: 15 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateMetadataAccountV2InstructionArgs { + pub data: Option, + pub new_update_authority: Option, + pub primary_sale_happened: Option, + pub is_mutable: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateMetadataAccountV2Builder { + metadata: Option, + update_authority: Option, + data: Option, + new_update_authority: Option, + primary_sale_happened: Option, + is_mutable: Option, +} + +impl UpdateMetadataAccountV2Builder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Update authority key + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.update_authority = Some(update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: DataV2) -> &mut Self { + self.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_update_authority(&mut self, new_update_authority: Pubkey) -> &mut Self { + self.new_update_authority = Some(new_update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.is_mutable = Some(is_mutable); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateMetadataAccountV2 { + metadata: self.metadata.expect("metadata is not set"), + update_authority: self.update_authority.expect("update_authority is not set"), + }; + let args = UpdateMetadataAccountV2InstructionArgs { + data: self.data.clone(), + new_update_authority: self.new_update_authority.clone(), + primary_sale_happened: self.primary_sale_happened.clone(), + is_mutable: self.is_mutable.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_metadata_account_v2` CPI instruction. +pub struct UpdateMetadataAccountV2Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority key + pub update_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: UpdateMetadataAccountV2InstructionArgs, +} + +impl<'a> UpdateMetadataAccountV2Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(2); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.update_authority.key, + true, + )); + let mut data = UpdateMetadataAccountV2InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(2 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.update_authority.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_metadata_account_v2` CPI instruction builder. +pub struct UpdateMetadataAccountV2CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateMetadataAccountV2CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateMetadataAccountV2CpiBuilderInstruction { + __program: program, + metadata: None, + update_authority: None, + data: None, + new_update_authority: None, + primary_sale_happened: None, + is_mutable: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Update authority key + #[inline(always)] + pub fn update_authority( + &mut self, + update_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.update_authority = Some(update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: DataV2) -> &mut Self { + self.instruction.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_update_authority(&mut self, new_update_authority: Pubkey) -> &mut Self { + self.instruction.new_update_authority = Some(new_update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.instruction.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.instruction.is_mutable = Some(is_mutable); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateMetadataAccountV2Cpi<'a> { + let args = UpdateMetadataAccountV2InstructionArgs { + data: self.instruction.data.clone(), + new_update_authority: self.instruction.new_update_authority.clone(), + primary_sale_happened: self.instruction.primary_sale_happened.clone(), + is_mutable: self.instruction.is_mutable.clone(), + }; + + UpdateMetadataAccountV2Cpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + update_authority: self + .instruction + .update_authority + .expect("update_authority is not set"), + __args: args, + } + } +} + +struct UpdateMetadataAccountV2CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + update_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + data: Option, + new_update_authority: Option, + primary_sale_happened: Option, + is_mutable: Option, +} diff --git a/clients/rust/src/generated/instructions/update_primary_sale_happened_via_token.rs b/clients/rust/src/generated/instructions/update_primary_sale_happened_via_token.rs new file mode 100644 index 00000000..10554170 --- /dev/null +++ b/clients/rust/src/generated/instructions/update_primary_sale_happened_via_token.rs @@ -0,0 +1,213 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UpdatePrimarySaleHappenedViaToken { + /// Metadata key (pda of ['metadata', program id, mint id]) + pub metadata: solana_program::pubkey::Pubkey, + /// Owner on the token account + pub owner: solana_program::pubkey::Pubkey, + /// Account containing tokens from the metadata's mint + pub token: solana_program::pubkey::Pubkey, +} + +impl UpdatePrimarySaleHappenedViaToken { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(3); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.owner, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token, false, + )); + let data = UpdatePrimarySaleHappenedViaTokenInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdatePrimarySaleHappenedViaTokenInstructionData { + discriminator: u8, +} + +impl UpdatePrimarySaleHappenedViaTokenInstructionData { + fn new() -> Self { + Self { discriminator: 4 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdatePrimarySaleHappenedViaTokenBuilder { + metadata: Option, + owner: Option, + token: Option, +} + +impl UpdatePrimarySaleHappenedViaTokenBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Owner on the token account + #[inline(always)] + pub fn owner(&mut self, owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.owner = Some(owner); + self + } + /// Account containing tokens from the metadata's mint + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdatePrimarySaleHappenedViaToken { + metadata: self.metadata.expect("metadata is not set"), + owner: self.owner.expect("owner is not set"), + token: self.token.expect("token is not set"), + }; + + accounts.instruction() + } +} + +/// `update_primary_sale_happened_via_token` CPI instruction. +pub struct UpdatePrimarySaleHappenedViaTokenCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata key (pda of ['metadata', program id, mint id]) + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Owner on the token account + pub owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Account containing tokens from the metadata's mint + pub token: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> UpdatePrimarySaleHappenedViaTokenCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(3); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.owner.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token.key, + false, + )); + let data = UpdatePrimarySaleHappenedViaTokenInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(3 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.owner.clone()); + account_infos.push(self.token.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_primary_sale_happened_via_token` CPI instruction builder. +pub struct UpdatePrimarySaleHappenedViaTokenCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdatePrimarySaleHappenedViaTokenCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdatePrimarySaleHappenedViaTokenCpiBuilderInstruction { + __program: program, + metadata: None, + owner: None, + token: None, + }); + Self { instruction } + } + /// Metadata key (pda of ['metadata', program id, mint id]) + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Owner on the token account + #[inline(always)] + pub fn owner(&mut self, owner: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.owner = Some(owner); + self + } + /// Account containing tokens from the metadata's mint + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdatePrimarySaleHappenedViaTokenCpi<'a> { + UpdatePrimarySaleHappenedViaTokenCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + owner: self.instruction.owner.expect("owner is not set"), + + token: self.instruction.token.expect("token is not set"), + } + } +} + +struct UpdatePrimarySaleHappenedViaTokenCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/update_v1.rs b/clients/rust/src/generated/instructions/update_v1.rs new file mode 100644 index 00000000..49bad8ab --- /dev/null +++ b/clients/rust/src/generated/instructions/update_v1.rs @@ -0,0 +1,803 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::CollectionDetailsToggle; +use crate::generated::types::CollectionToggle; +use crate::generated::types::Creator; +use crate::generated::types::RuleSetToggle; +use crate::generated::types::UsesToggle; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +/// Accounts. +pub struct UpdateV1 { + /// Update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: Option, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UpdateV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UpdateV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + token, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UpdateV1InstructionData { + discriminator: u8, + update_v1_discriminator: u8, +} + +impl UpdateV1InstructionData { + fn new() -> Self { + Self { + discriminator: 50, + update_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UpdateV1InstructionArgs { + pub new_update_authority: Option, + pub data: Option, + pub primary_sale_happened: Option, + pub is_mutable: Option, + pub collection: CollectionToggle, + pub collection_details: CollectionDetailsToggle, + pub uses: UsesToggle, + pub rule_set: RuleSetToggle, + pub authorization_data: Option, +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct UpdateV1InstructionDataData { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UpdateV1Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + authorization_rules_program: Option, + authorization_rules: Option, + new_update_authority: Option, + data: Option, + primary_sale_happened: Option, + is_mutable: Option, + collection: Option, + collection_details: Option, + uses: Option, + rule_set: Option, + authorization_data: Option, +} + +impl UpdateV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_update_authority(&mut self, new_update_authority: Pubkey) -> &mut Self { + self.new_update_authority = Some(new_update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: UpdateV1InstructionDataData) -> &mut Self { + self.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.is_mutable = Some(is_mutable); + self + } + /// `[optional argument, defaults to 'CollectionToggle::None']` + #[inline(always)] + pub fn collection(&mut self, collection: CollectionToggle) -> &mut Self { + self.collection = Some(collection); + self + } + /// `[optional argument, defaults to 'CollectionDetailsToggle::None']` + #[inline(always)] + pub fn collection_details(&mut self, collection_details: CollectionDetailsToggle) -> &mut Self { + self.collection_details = Some(collection_details); + self + } + /// `[optional argument, defaults to 'UsesToggle::None']` + #[inline(always)] + pub fn uses(&mut self, uses: UsesToggle) -> &mut Self { + self.uses = Some(uses); + self + } + /// `[optional argument, defaults to 'RuleSetToggle::None']` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: RuleSetToggle) -> &mut Self { + self.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateV1 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token, + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UpdateV1InstructionArgs { + new_update_authority: self.new_update_authority.clone(), + data: self.data.clone(), + primary_sale_happened: self.primary_sale_happened.clone(), + is_mutable: self.is_mutable.clone(), + collection: self.collection.clone().unwrap_or(CollectionToggle::None), + collection_details: self + .collection_details + .clone() + .unwrap_or(CollectionDetailsToggle::None), + uses: self.uses.clone().unwrap_or(UsesToggle::None), + rule_set: self.rule_set.clone().unwrap_or(RuleSetToggle::None), + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `update_v1` CPI instruction. +pub struct UpdateV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UpdateV1InstructionArgs, +} + +impl<'a> UpdateV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UpdateV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `update_v1` CPI instruction builder. +pub struct UpdateV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UpdateV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateV1CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + authorization_rules_program: None, + authorization_rules: None, + new_update_authority: None, + data: None, + primary_sale_happened: None, + is_mutable: None, + collection: None, + collection_details: None, + uses: None, + rule_set: None, + authorization_data: None, + }); + Self { instruction } + } + /// Update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_update_authority(&mut self, new_update_authority: Pubkey) -> &mut Self { + self.instruction.new_update_authority = Some(new_update_authority); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn data(&mut self, data: UpdateV1InstructionDataData) -> &mut Self { + self.instruction.data = Some(data); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn primary_sale_happened(&mut self, primary_sale_happened: bool) -> &mut Self { + self.instruction.primary_sale_happened = Some(primary_sale_happened); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn is_mutable(&mut self, is_mutable: bool) -> &mut Self { + self.instruction.is_mutable = Some(is_mutable); + self + } + /// `[optional argument, defaults to 'CollectionToggle::None']` + #[inline(always)] + pub fn collection(&mut self, collection: CollectionToggle) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// `[optional argument, defaults to 'CollectionDetailsToggle::None']` + #[inline(always)] + pub fn collection_details(&mut self, collection_details: CollectionDetailsToggle) -> &mut Self { + self.instruction.collection_details = Some(collection_details); + self + } + /// `[optional argument, defaults to 'UsesToggle::None']` + #[inline(always)] + pub fn uses(&mut self, uses: UsesToggle) -> &mut Self { + self.instruction.uses = Some(uses); + self + } + /// `[optional argument, defaults to 'RuleSetToggle::None']` + #[inline(always)] + pub fn rule_set(&mut self, rule_set: RuleSetToggle) -> &mut Self { + self.instruction.rule_set = Some(rule_set); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UpdateV1Cpi<'a> { + let args = UpdateV1InstructionArgs { + new_update_authority: self.instruction.new_update_authority.clone(), + data: self.instruction.data.clone(), + primary_sale_happened: self.instruction.primary_sale_happened.clone(), + is_mutable: self.instruction.is_mutable.clone(), + collection: self + .instruction + .collection + .clone() + .unwrap_or(CollectionToggle::None), + collection_details: self + .instruction + .collection_details + .clone() + .unwrap_or(CollectionDetailsToggle::None), + uses: self.instruction.uses.clone().unwrap_or(UsesToggle::None), + rule_set: self + .instruction + .rule_set + .clone() + .unwrap_or(RuleSetToggle::None), + authorization_data: self.instruction.authorization_data.clone(), + }; + + UpdateV1Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token, + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UpdateV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + new_update_authority: Option, + data: Option, + primary_sale_happened: Option, + is_mutable: Option, + collection: Option, + collection_details: Option, + uses: Option, + rule_set: Option, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/use_v1.rs b/clients/rust/src/generated/instructions/use_v1.rs new file mode 100644 index 00000000..709466ca --- /dev/null +++ b/clients/rust/src/generated/instructions/use_v1.rs @@ -0,0 +1,682 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct UseV1 { + /// Token owner or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Token account + pub token: Option, + /// Mint account + pub mint: solana_program::pubkey::Pubkey, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Edition account + pub edition: Option, + /// Payer + pub payer: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// System program + pub sysvar_instructions: solana_program::pubkey::Pubkey, + /// SPL Token Program + pub spl_token_program: Option, + /// Token Authorization Rules Program + pub authorization_rules_program: Option, + /// Token Authorization Rules account + pub authorization_rules: Option, +} + +impl UseV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UseV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(12); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new(token, false)); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new( + edition, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + spl_token_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules_program, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authorization_rules, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UseV1InstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UseV1InstructionData { + discriminator: u8, + use_v1_discriminator: u8, +} + +impl UseV1InstructionData { + fn new() -> Self { + Self { + discriminator: 51, + use_v1_discriminator: 0, + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UseV1InstructionArgs { + pub authorization_data: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UseV1Builder { + authority: Option, + delegate_record: Option, + token: Option, + mint: Option, + metadata: Option, + edition: Option, + payer: Option, + system_program: Option, + sysvar_instructions: Option, + spl_token_program: Option, + authorization_rules_program: Option, + authorization_rules: Option, + authorization_data: Option, +} + +impl UseV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Token owner or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: solana_program::pubkey::Pubkey) -> &mut Self { + self.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition(&mut self, edition: solana_program::pubkey::Pubkey) -> &mut Self { + self.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// System program + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = UseV1 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + token: self.token, + mint: self.mint.expect("mint is not set"), + metadata: self.metadata.expect("metadata is not set"), + edition: self.edition, + payer: self.payer.expect("payer is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + spl_token_program: self.spl_token_program, + authorization_rules_program: self.authorization_rules_program, + authorization_rules: self.authorization_rules, + }; + let args = UseV1InstructionArgs { + authorization_data: self.authorization_data.clone(), + }; + + accounts.instruction(args) + } +} + +/// `use_v1` CPI instruction. +pub struct UseV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Token owner or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token account + pub token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Mint account + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Edition account + pub edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + /// SPL Token Program + pub spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules Program + pub authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Token Authorization Rules account + pub authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UseV1InstructionArgs, +} + +impl<'a> UseV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(12); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(token) = self.token { + accounts.push(solana_program::instruction::AccountMeta::new( + *token.key, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(edition) = self.edition { + accounts.push(solana_program::instruction::AccountMeta::new( + *edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + if let Some(spl_token_program) = self.spl_token_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *spl_token_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules_program.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(authorization_rules) = self.authorization_rules { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authorization_rules.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + let mut data = UseV1InstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(12 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + if let Some(token) = self.token { + account_infos.push(token.clone()); + } + account_infos.push(self.mint.clone()); + account_infos.push(self.metadata.clone()); + if let Some(edition) = self.edition { + account_infos.push(edition.clone()); + } + account_infos.push(self.payer.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + if let Some(spl_token_program) = self.spl_token_program { + account_infos.push(spl_token_program.clone()); + } + if let Some(authorization_rules_program) = self.authorization_rules_program { + account_infos.push(authorization_rules_program.clone()); + } + if let Some(authorization_rules) = self.authorization_rules { + account_infos.push(authorization_rules.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `use_v1` CPI instruction builder. +pub struct UseV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UseV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UseV1CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + token: None, + mint: None, + metadata: None, + edition: None, + payer: None, + system_program: None, + sysvar_instructions: None, + spl_token_program: None, + authorization_rules_program: None, + authorization_rules: None, + authorization_data: None, + }); + Self { instruction } + } + /// Token owner or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// `[optional account]` + /// Token account + #[inline(always)] + pub fn token(&mut self, token: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.token = Some(token); + self + } + /// Mint account + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Edition account + #[inline(always)] + pub fn edition( + &mut self, + edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.edition = Some(edition); + self + } + /// Payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// System program + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + /// `[optional account]` + /// SPL Token Program + #[inline(always)] + pub fn spl_token_program( + &mut self, + spl_token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.spl_token_program = Some(spl_token_program); + self + } + /// `[optional account]` + /// Token Authorization Rules Program + #[inline(always)] + pub fn authorization_rules_program( + &mut self, + authorization_rules_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules_program = Some(authorization_rules_program); + self + } + /// `[optional account]` + /// Token Authorization Rules account + #[inline(always)] + pub fn authorization_rules( + &mut self, + authorization_rules: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authorization_rules = Some(authorization_rules); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn authorization_data(&mut self, authorization_data: AuthorizationData) -> &mut Self { + self.instruction.authorization_data = Some(authorization_data); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UseV1Cpi<'a> { + let args = UseV1InstructionArgs { + authorization_data: self.instruction.authorization_data.clone(), + }; + + UseV1Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + token: self.instruction.token, + + mint: self.instruction.mint.expect("mint is not set"), + + metadata: self.instruction.metadata.expect("metadata is not set"), + + edition: self.instruction.edition, + + payer: self.instruction.payer.expect("payer is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + + spl_token_program: self.instruction.spl_token_program, + + authorization_rules_program: self.instruction.authorization_rules_program, + + authorization_rules: self.instruction.authorization_rules, + __args: args, + } + } +} + +struct UseV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, + spl_token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_rules: Option<&'a solana_program::account_info::AccountInfo<'a>>, + authorization_data: Option, +} diff --git a/clients/rust/src/generated/instructions/utilize.rs b/clients/rust/src/generated/instructions/utilize.rs new file mode 100644 index 00000000..c14c1973 --- /dev/null +++ b/clients/rust/src/generated/instructions/utilize.rs @@ -0,0 +1,560 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct Utilize { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Token Account Of NFT + pub token_account: solana_program::pubkey::Pubkey, + /// Mint of the Metadata + pub mint: solana_program::pubkey::Pubkey, + /// A Use Authority / Can be the current Owner of the NFT + pub use_authority: solana_program::pubkey::Pubkey, + /// Owner + pub owner: solana_program::pubkey::Pubkey, + /// Token program + pub token_program: solana_program::pubkey::Pubkey, + /// Associated Token program + pub ata_program: solana_program::pubkey::Pubkey, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Rent info + pub rent: solana_program::pubkey::Pubkey, + /// Use Authority Record PDA If present the program Assumes a delegated use authority + pub use_authority_record: Option, + /// Program As Signer (Burner) + pub burner: Option, +} + +impl Utilize { + #[allow(clippy::vec_init_then_push)] + pub fn instruction( + &self, + args: UtilizeInstructionArgs, + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.use_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.owner, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.ata_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.rent, false, + )); + if let Some(use_authority_record) = self.use_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new( + use_authority_record, + false, + )); + } + if let Some(burner) = self.burner { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + burner, false, + )); + } + let mut data = UtilizeInstructionData::new().try_to_vec().unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct UtilizeInstructionData { + discriminator: u8, +} + +impl UtilizeInstructionData { + fn new() -> Self { + Self { discriminator: 19 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Debug)] +pub struct UtilizeInstructionArgs { + pub number_of_uses: u64, +} + +/// Instruction builder. +#[derive(Default)] +pub struct UtilizeBuilder { + metadata: Option, + token_account: Option, + mint: Option, + use_authority: Option, + owner: Option, + token_program: Option, + ata_program: Option, + system_program: Option, + rent: Option, + use_authority_record: Option, + burner: Option, + number_of_uses: Option, +} + +impl UtilizeBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Token Account Of NFT + #[inline(always)] + pub fn token_account(&mut self, token_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_account = Some(token_account); + self + } + /// Mint of the Metadata + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + /// A Use Authority / Can be the current Owner of the NFT + #[inline(always)] + pub fn use_authority(&mut self, use_authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.use_authority = Some(use_authority); + self + } + /// Owner + #[inline(always)] + pub fn owner(&mut self, owner: solana_program::pubkey::Pubkey) -> &mut Self { + self.owner = Some(owner); + self + } + /// Token program + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// Associated Token program + #[inline(always)] + pub fn ata_program(&mut self, ata_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.ata_program = Some(ata_program); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: solana_program::pubkey::Pubkey) -> &mut Self { + self.rent = Some(rent); + self + } + /// `[optional account]` + /// Use Authority Record PDA If present the program Assumes a delegated use authority + #[inline(always)] + pub fn use_authority_record( + &mut self, + use_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.use_authority_record = Some(use_authority_record); + self + } + /// `[optional account]` + /// Program As Signer (Burner) + #[inline(always)] + pub fn burner(&mut self, burner: solana_program::pubkey::Pubkey) -> &mut Self { + self.burner = Some(burner); + self + } + #[inline(always)] + pub fn number_of_uses(&mut self, number_of_uses: u64) -> &mut Self { + self.number_of_uses = Some(number_of_uses); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = Utilize { + metadata: self.metadata.expect("metadata is not set"), + token_account: self.token_account.expect("token_account is not set"), + mint: self.mint.expect("mint is not set"), + use_authority: self.use_authority.expect("use_authority is not set"), + owner: self.owner.expect("owner is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + )), + ata_program: self.ata_program.unwrap_or(solana_program::pubkey!( + "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + rent: self.rent.unwrap_or(solana_program::pubkey!( + "SysvarRent111111111111111111111111111111111" + )), + use_authority_record: self.use_authority_record, + burner: self.burner, + }; + let args = UtilizeInstructionArgs { + number_of_uses: self + .number_of_uses + .clone() + .expect("number_of_uses is not set"), + }; + + accounts.instruction(args) + } +} + +/// `utilize` CPI instruction. +pub struct UtilizeCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Token Account Of NFT + pub token_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Metadata + pub mint: &'a solana_program::account_info::AccountInfo<'a>, + /// A Use Authority / Can be the current Owner of the NFT + pub use_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Owner + pub owner: &'a solana_program::account_info::AccountInfo<'a>, + /// Token program + pub token_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Associated Token program + pub ata_program: &'a solana_program::account_info::AccountInfo<'a>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Rent info + pub rent: &'a solana_program::account_info::AccountInfo<'a>, + /// Use Authority Record PDA If present the program Assumes a delegated use authority + pub use_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Program As Signer (Burner) + pub burner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: UtilizeInstructionArgs, +} + +impl<'a> UtilizeCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(11); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.use_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.owner.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.ata_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.rent.key, + false, + )); + if let Some(use_authority_record) = self.use_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new( + *use_authority_record.key, + false, + )); + } + if let Some(burner) = self.burner { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *burner.key, + false, + )); + } + let mut data = UtilizeInstructionData::new().try_to_vec().unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(11 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.token_account.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.use_authority.clone()); + account_infos.push(self.owner.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.ata_program.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.rent.clone()); + if let Some(use_authority_record) = self.use_authority_record { + account_infos.push(use_authority_record.clone()); + } + if let Some(burner) = self.burner { + account_infos.push(burner.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `utilize` CPI instruction builder. +pub struct UtilizeCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> UtilizeCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UtilizeCpiBuilderInstruction { + __program: program, + metadata: None, + token_account: None, + mint: None, + use_authority: None, + owner: None, + token_program: None, + ata_program: None, + system_program: None, + rent: None, + use_authority_record: None, + burner: None, + number_of_uses: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Token Account Of NFT + #[inline(always)] + pub fn token_account( + &mut self, + token_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_account = Some(token_account); + self + } + /// Mint of the Metadata + #[inline(always)] + pub fn mint(&mut self, mint: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + /// A Use Authority / Can be the current Owner of the NFT + #[inline(always)] + pub fn use_authority( + &mut self, + use_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.use_authority = Some(use_authority); + self + } + /// Owner + #[inline(always)] + pub fn owner(&mut self, owner: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.owner = Some(owner); + self + } + /// Token program + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + /// Associated Token program + #[inline(always)] + pub fn ata_program( + &mut self, + ata_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.ata_program = Some(ata_program); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Rent info + #[inline(always)] + pub fn rent(&mut self, rent: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.rent = Some(rent); + self + } + /// `[optional account]` + /// Use Authority Record PDA If present the program Assumes a delegated use authority + #[inline(always)] + pub fn use_authority_record( + &mut self, + use_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.use_authority_record = Some(use_authority_record); + self + } + /// `[optional account]` + /// Program As Signer (Burner) + #[inline(always)] + pub fn burner( + &mut self, + burner: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.burner = Some(burner); + self + } + #[inline(always)] + pub fn number_of_uses(&mut self, number_of_uses: u64) -> &mut Self { + self.instruction.number_of_uses = Some(number_of_uses); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> UtilizeCpi<'a> { + let args = UtilizeInstructionArgs { + number_of_uses: self + .instruction + .number_of_uses + .clone() + .expect("number_of_uses is not set"), + }; + + UtilizeCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + token_account: self + .instruction + .token_account + .expect("token_account is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + use_authority: self + .instruction + .use_authority + .expect("use_authority is not set"), + + owner: self.instruction.owner.expect("owner is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + ata_program: self + .instruction + .ata_program + .expect("ata_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + rent: self.instruction.rent.expect("rent is not set"), + + use_authority_record: self.instruction.use_authority_record, + + burner: self.instruction.burner, + __args: args, + } + } +} + +struct UtilizeCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + use_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + owner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + ata_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + rent: Option<&'a solana_program::account_info::AccountInfo<'a>>, + use_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + burner: Option<&'a solana_program::account_info::AccountInfo<'a>>, + number_of_uses: Option, +} diff --git a/clients/rust/src/generated/instructions/verify_collection.rs b/clients/rust/src/generated/instructions/verify_collection.rs new file mode 100644 index 00000000..c9a7039e --- /dev/null +++ b/clients/rust/src/generated/instructions/verify_collection.rs @@ -0,0 +1,383 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct VerifyCollection { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Collection Update authority + pub collection_authority: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Metadata Account of the Collection + pub collection: solana_program::pubkey::Pubkey, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: solana_program::pubkey::Pubkey, + /// Collection Authority Record PDA + pub collection_authority_record: Option, +} + +impl VerifyCollection { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_master_edition_account, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_authority_record, + false, + )); + } + let data = VerifyCollectionInstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct VerifyCollectionInstructionData { + discriminator: u8, +} + +impl VerifyCollectionInstructionData { + fn new() -> Self { + Self { discriminator: 18 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct VerifyCollectionBuilder { + metadata: Option, + collection_authority: Option, + payer: Option, + collection_mint: Option, + collection: Option, + collection_master_edition_account: Option, + collection_authority_record: Option, +} + +impl VerifyCollectionBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority = Some(collection_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { + self.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_master_edition_account = Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = VerifyCollection { + metadata: self.metadata.expect("metadata is not set"), + collection_authority: self + .collection_authority + .expect("collection_authority is not set"), + payer: self.payer.expect("payer is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection: self.collection.expect("collection is not set"), + collection_master_edition_account: self + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + collection_authority_record: self.collection_authority_record, + }; + + accounts.instruction() + } +} + +/// `verify_collection` CPI instruction. +pub struct VerifyCollectionCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Update authority + pub collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata Account of the Collection + pub collection: &'a solana_program::account_info::AccountInfo<'a>, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> VerifyCollectionCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_master_edition_account.key, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_authority_record.key, + false, + )); + } + let data = VerifyCollectionInstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.collection_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.collection_mint.clone()); + account_infos.push(self.collection.clone()); + account_infos.push(self.collection_master_edition_account.clone()); + if let Some(collection_authority_record) = self.collection_authority_record { + account_infos.push(collection_authority_record.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `verify_collection` CPI instruction builder. +pub struct VerifyCollectionCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> VerifyCollectionCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(VerifyCollectionCpiBuilderInstruction { + __program: program, + metadata: None, + collection_authority: None, + payer: None, + collection_mint: None, + collection: None, + collection_master_edition_account: None, + collection_authority_record: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority = Some(collection_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection( + &mut self, + collection: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_master_edition_account = + Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> VerifyCollectionCpi<'a> { + VerifyCollectionCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_authority: self + .instruction + .collection_authority + .expect("collection_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection: self.instruction.collection.expect("collection is not set"), + + collection_master_edition_account: self + .instruction + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + + collection_authority_record: self.instruction.collection_authority_record, + } + } +} + +struct VerifyCollectionCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_master_edition_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/verify_collection_v1.rs b/clients/rust/src/generated/instructions/verify_collection_v1.rs new file mode 100644 index 00000000..7076c707 --- /dev/null +++ b/clients/rust/src/generated/instructions/verify_collection_v1.rs @@ -0,0 +1,477 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct VerifyCollectionV1 { + /// Creator to verify, collection update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Metadata Account of the Collection + pub collection_metadata: Option, + /// Master Edition Account of the Collection Token + pub collection_master_edition: Option, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, +} + +impl VerifyCollectionV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + collection_metadata, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(collection_master_edition) = self.collection_master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + let data = VerifyCollectionV1InstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct VerifyCollectionV1InstructionData { + discriminator: u8, + verify_collection_v1_discriminator: u8, +} + +impl VerifyCollectionV1InstructionData { + fn new() -> Self { + Self { + discriminator: 52, + verify_collection_v1_discriminator: 1, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct VerifyCollectionV1Builder { + authority: Option, + delegate_record: Option, + metadata: Option, + collection_mint: Option, + collection_metadata: Option, + collection_master_edition: Option, + system_program: Option, + sysvar_instructions: Option, +} + +impl VerifyCollectionV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Creator to verify, collection update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + /// `[optional account]` + /// Master Edition Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition( + &mut self, + collection_master_edition: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_master_edition = Some(collection_master_edition); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = VerifyCollectionV1 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + metadata: self.metadata.expect("metadata is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection_metadata: self.collection_metadata, + collection_master_edition: self.collection_master_edition, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + }; + + accounts.instruction() + } +} + +/// `verify_collection_v1` CPI instruction. +pub struct VerifyCollectionV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Creator to verify, collection update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata Account of the Collection + pub collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Master Edition Account of the Collection Token + pub collection_master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> VerifyCollectionV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + *collection_metadata.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(collection_master_edition) = self.collection_master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + let data = VerifyCollectionV1InstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(8 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.metadata.clone()); + account_infos.push(self.collection_mint.clone()); + if let Some(collection_metadata) = self.collection_metadata { + account_infos.push(collection_metadata.clone()); + } + if let Some(collection_master_edition) = self.collection_master_edition { + account_infos.push(collection_master_edition.clone()); + } + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `verify_collection_v1` CPI instruction builder. +pub struct VerifyCollectionV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> VerifyCollectionV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(VerifyCollectionV1CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + metadata: None, + collection_mint: None, + collection_metadata: None, + collection_master_edition: None, + system_program: None, + sysvar_instructions: None, + }); + Self { instruction } + } + /// Creator to verify, collection update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + /// `[optional account]` + /// Master Edition Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition( + &mut self, + collection_master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_master_edition = Some(collection_master_edition); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> VerifyCollectionV1Cpi<'a> { + VerifyCollectionV1Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection_metadata: self.instruction.collection_metadata, + + collection_master_edition: self.instruction.collection_master_edition, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + } + } +} + +struct VerifyCollectionV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/verify_creator_v1.rs b/clients/rust/src/generated/instructions/verify_creator_v1.rs new file mode 100644 index 00000000..016cb424 --- /dev/null +++ b/clients/rust/src/generated/instructions/verify_creator_v1.rs @@ -0,0 +1,488 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct VerifyCreatorV1 { + /// Creator to verify, collection update authority or delegate + pub authority: solana_program::pubkey::Pubkey, + /// Delegate record PDA + pub delegate_record: Option, + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: Option, + /// Metadata Account of the Collection + pub collection_metadata: Option, + /// Master Edition Account of the Collection Token + pub collection_master_edition: Option, + /// System program + pub system_program: solana_program::pubkey::Pubkey, + /// Instructions sysvar account + pub sysvar_instructions: solana_program::pubkey::Pubkey, +} + +impl VerifyCreatorV1 { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + delegate_record, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + if let Some(collection_mint) = self.collection_mint { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_mint, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + collection_metadata, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(collection_master_edition) = self.collection_master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_master_edition, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.sysvar_instructions, + false, + )); + let data = VerifyCreatorV1InstructionData::new().try_to_vec().unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct VerifyCreatorV1InstructionData { + discriminator: u8, + verify_creator_v1_discriminator: u8, +} + +impl VerifyCreatorV1InstructionData { + fn new() -> Self { + Self { + discriminator: 52, + verify_creator_v1_discriminator: 0, + } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct VerifyCreatorV1Builder { + authority: Option, + delegate_record: Option, + metadata: Option, + collection_mint: Option, + collection_metadata: Option, + collection_master_edition: Option, + system_program: Option, + sysvar_instructions: Option, +} + +impl VerifyCreatorV1Builder { + pub fn new() -> Self { + Self::default() + } + /// Creator to verify, collection update authority or delegate + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.delegate_record = Some(delegate_record); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + /// `[optional account]` + /// Master Edition Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition( + &mut self, + collection_master_edition: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_master_edition = Some(collection_master_edition); + self + } + /// System program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = VerifyCreatorV1 { + authority: self.authority.expect("authority is not set"), + delegate_record: self.delegate_record, + metadata: self.metadata.expect("metadata is not set"), + collection_mint: self.collection_mint, + collection_metadata: self.collection_metadata, + collection_master_edition: self.collection_master_edition, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!( + "Sysvar1nstructions1111111111111111111111111" + )), + }; + + accounts.instruction() + } +} + +/// `verify_creator_v1` CPI instruction. +pub struct VerifyCreatorV1Cpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Creator to verify, collection update authority or delegate + pub authority: &'a solana_program::account_info::AccountInfo<'a>, + /// Delegate record PDA + pub delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Metadata Account of the Collection + pub collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// Master Edition Account of the Collection Token + pub collection_master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + /// System program + pub system_program: &'a solana_program::account_info::AccountInfo<'a>, + /// Instructions sysvar account + pub sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, +} + +impl<'a> VerifyCreatorV1Cpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(8); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + if let Some(delegate_record) = self.delegate_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *delegate_record.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + if let Some(collection_mint) = self.collection_mint { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_mint.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(collection_metadata) = self.collection_metadata { + accounts.push(solana_program::instruction::AccountMeta::new( + *collection_metadata.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + if let Some(collection_master_edition) = self.collection_master_edition { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_master_edition.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_TOKEN_METADATA_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.sysvar_instructions.key, + false, + )); + let data = VerifyCreatorV1InstructionData::new().try_to_vec().unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(8 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.authority.clone()); + if let Some(delegate_record) = self.delegate_record { + account_infos.push(delegate_record.clone()); + } + account_infos.push(self.metadata.clone()); + if let Some(collection_mint) = self.collection_mint { + account_infos.push(collection_mint.clone()); + } + if let Some(collection_metadata) = self.collection_metadata { + account_infos.push(collection_metadata.clone()); + } + if let Some(collection_master_edition) = self.collection_master_edition { + account_infos.push(collection_master_edition.clone()); + } + account_infos.push(self.system_program.clone()); + account_infos.push(self.sysvar_instructions.clone()); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `verify_creator_v1` CPI instruction builder. +pub struct VerifyCreatorV1CpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> VerifyCreatorV1CpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(VerifyCreatorV1CpiBuilderInstruction { + __program: program, + authority: None, + delegate_record: None, + metadata: None, + collection_mint: None, + collection_metadata: None, + collection_master_edition: None, + system_program: None, + sysvar_instructions: None, + }); + Self { instruction } + } + /// Creator to verify, collection update authority or delegate + #[inline(always)] + pub fn authority( + &mut self, + authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// `[optional account]` + /// Delegate record PDA + #[inline(always)] + pub fn delegate_record( + &mut self, + delegate_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.delegate_record = Some(delegate_record); + self + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// `[optional account]` + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// `[optional account]` + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + /// `[optional account]` + /// Master Edition Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition( + &mut self, + collection_master_edition: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_master_edition = Some(collection_master_edition); + self + } + /// System program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// Instructions sysvar account + #[inline(always)] + pub fn sysvar_instructions( + &mut self, + sysvar_instructions: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.sysvar_instructions = Some(sysvar_instructions); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> VerifyCreatorV1Cpi<'a> { + VerifyCreatorV1Cpi { + __program: self.instruction.__program, + + authority: self.instruction.authority.expect("authority is not set"), + + delegate_record: self.instruction.delegate_record, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_mint: self.instruction.collection_mint, + + collection_metadata: self.instruction.collection_metadata, + + collection_master_edition: self.instruction.collection_master_edition, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + sysvar_instructions: self + .instruction + .sysvar_instructions + .expect("sysvar_instructions is not set"), + } + } +} + +struct VerifyCreatorV1CpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + delegate_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_master_edition: Option<&'a solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'a solana_program::account_info::AccountInfo<'a>>, + sysvar_instructions: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/instructions/verify_sized_collection_item.rs b/clients/rust/src/generated/instructions/verify_sized_collection_item.rs new file mode 100644 index 00000000..74f97809 --- /dev/null +++ b/clients/rust/src/generated/instructions/verify_sized_collection_item.rs @@ -0,0 +1,387 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct VerifySizedCollectionItem { + /// Metadata account + pub metadata: solana_program::pubkey::Pubkey, + /// Collection Update authority + pub collection_authority: solana_program::pubkey::Pubkey, + /// payer + pub payer: solana_program::pubkey::Pubkey, + /// Mint of the Collection + pub collection_mint: solana_program::pubkey::Pubkey, + /// Metadata Account of the Collection + pub collection: solana_program::pubkey::Pubkey, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: solana_program::pubkey::Pubkey, + /// Collection Authority Record PDA + pub collection_authority_record: Option, +} + +impl VerifySizedCollectionItem { + #[allow(clippy::vec_init_then_push)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + self.metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_master_edition_account, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_authority_record, + false, + )); + } + let data = VerifySizedCollectionItemInstructionData::new() + .try_to_vec() + .unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct VerifySizedCollectionItemInstructionData { + discriminator: u8, +} + +impl VerifySizedCollectionItemInstructionData { + fn new() -> Self { + Self { discriminator: 30 } + } +} + +/// Instruction builder. +#[derive(Default)] +pub struct VerifySizedCollectionItemBuilder { + metadata: Option, + collection_authority: Option, + payer: Option, + collection_mint: Option, + collection: Option, + collection_master_edition_account: Option, + collection_authority_record: Option, +} + +impl VerifySizedCollectionItemBuilder { + pub fn new() -> Self { + Self::default() + } + /// Metadata account + #[inline(always)] + pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self { + self.metadata = Some(metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority = Some(collection_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { + self.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_master_edition_account = Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> solana_program::instruction::Instruction { + let accounts = VerifySizedCollectionItem { + metadata: self.metadata.expect("metadata is not set"), + collection_authority: self + .collection_authority + .expect("collection_authority is not set"), + payer: self.payer.expect("payer is not set"), + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection: self.collection.expect("collection is not set"), + collection_master_edition_account: self + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + collection_authority_record: self.collection_authority_record, + }; + + accounts.instruction() + } +} + +/// `verify_sized_collection_item` CPI instruction. +pub struct VerifySizedCollectionItemCpi<'a> { + /// The program to invoke. + pub __program: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata account + pub metadata: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Update authority + pub collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + /// payer + pub payer: &'a solana_program::account_info::AccountInfo<'a>, + /// Mint of the Collection + pub collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + /// Metadata Account of the Collection + pub collection: &'a solana_program::account_info::AccountInfo<'a>, + /// MasterEdition2 Account of the Collection Token + pub collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + /// Collection Authority Record PDA + pub collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} + +impl<'a> VerifySizedCollectionItemCpi<'a> { + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(7); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_master_edition_account.key, + false, + )); + if let Some(collection_authority_record) = self.collection_authority_record { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_authority_record.key, + false, + )); + } + let data = VerifySizedCollectionItemInstructionData::new() + .try_to_vec() + .unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_TOKEN_METADATA_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + 1); + account_infos.push(self.__program.clone()); + account_infos.push(self.metadata.clone()); + account_infos.push(self.collection_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.collection_mint.clone()); + account_infos.push(self.collection.clone()); + account_infos.push(self.collection_master_edition_account.clone()); + if let Some(collection_authority_record) = self.collection_authority_record { + account_infos.push(collection_authority_record.clone()); + } + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// `verify_sized_collection_item` CPI instruction builder. +pub struct VerifySizedCollectionItemCpiBuilder<'a> { + instruction: Box>, +} + +impl<'a> VerifySizedCollectionItemCpiBuilder<'a> { + pub fn new(program: &'a solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(VerifySizedCollectionItemCpiBuilderInstruction { + __program: program, + metadata: None, + collection_authority: None, + payer: None, + collection_mint: None, + collection: None, + collection_master_edition_account: None, + collection_authority_record: None, + }); + Self { instruction } + } + /// Metadata account + #[inline(always)] + pub fn metadata( + &mut self, + metadata: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.metadata = Some(metadata); + self + } + /// Collection Update authority + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority = Some(collection_authority); + self + } + /// payer + #[inline(always)] + pub fn payer(&mut self, payer: &'a solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Mint of the Collection + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + /// Metadata Account of the Collection + #[inline(always)] + pub fn collection( + &mut self, + collection: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// MasterEdition2 Account of the Collection Token + #[inline(always)] + pub fn collection_master_edition_account( + &mut self, + collection_master_edition_account: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_master_edition_account = + Some(collection_master_edition_account); + self + } + /// `[optional account]` + /// Collection Authority Record PDA + #[inline(always)] + pub fn collection_authority_record( + &mut self, + collection_authority_record: &'a solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority_record = Some(collection_authority_record); + self + } + #[allow(clippy::clone_on_copy)] + pub fn build(&self) -> VerifySizedCollectionItemCpi<'a> { + VerifySizedCollectionItemCpi { + __program: self.instruction.__program, + + metadata: self.instruction.metadata.expect("metadata is not set"), + + collection_authority: self + .instruction + .collection_authority + .expect("collection_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection: self.instruction.collection.expect("collection is not set"), + + collection_master_edition_account: self + .instruction + .collection_master_edition_account + .expect("collection_master_edition_account is not set"), + + collection_authority_record: self.instruction.collection_authority_record, + } + } +} + +struct VerifySizedCollectionItemCpiBuilderInstruction<'a> { + __program: &'a solana_program::account_info::AccountInfo<'a>, + metadata: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority: Option<&'a solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_master_edition_account: Option<&'a solana_program::account_info::AccountInfo<'a>>, + collection_authority_record: Option<&'a solana_program::account_info::AccountInfo<'a>>, +} diff --git a/clients/rust/src/generated/mod.rs b/clients/rust/src/generated/mod.rs new file mode 100644 index 00000000..1dc8fd1f --- /dev/null +++ b/clients/rust/src/generated/mod.rs @@ -0,0 +1,14 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +pub mod accounts; +pub mod errors; +pub mod instructions; +pub mod programs; +pub mod types; + +pub(crate) use programs::*; diff --git a/clients/rust/src/generated/programs.rs b/clients/rust/src/generated/programs.rs new file mode 100644 index 00000000..a485a909 --- /dev/null +++ b/clients/rust/src/generated/programs.rs @@ -0,0 +1,11 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use solana_program::{pubkey, pubkey::Pubkey}; + +/// `mpl_token_metadata` program ID. +pub const MPL_TOKEN_METADATA_ID: Pubkey = pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"); diff --git a/clients/rust/src/generated/types/authority_type.rs b/clients/rust/src/generated/types/authority_type.rs new file mode 100644 index 00000000..81fae4a4 --- /dev/null +++ b/clients/rust/src/generated/types/authority_type.rs @@ -0,0 +1,18 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum AuthorityType { + None, + Metadata, + Holder, + MetadataDelegate, + TokenDelegate, +} diff --git a/clients/rust/src/generated/types/authorization_data.rs b/clients/rust/src/generated/types/authorization_data.rs new file mode 100644 index 00000000..abc517cb --- /dev/null +++ b/clients/rust/src/generated/types/authorization_data.rs @@ -0,0 +1,15 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Payload; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct AuthorizationData { + pub payload: Payload, +} diff --git a/clients/rust/src/generated/types/burn_args.rs b/clients/rust/src/generated/types/burn_args.rs new file mode 100644 index 00000000..074c861f --- /dev/null +++ b/clients/rust/src/generated/types/burn_args.rs @@ -0,0 +1,14 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum BurnArgs { + V1 { amount: u64 }, +} diff --git a/clients/rust/src/generated/types/collection.rs b/clients/rust/src/generated/types/collection.rs new file mode 100644 index 00000000..7594da63 --- /dev/null +++ b/clients/rust/src/generated/types/collection.rs @@ -0,0 +1,16 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct Collection { + pub verified: bool, + pub key: Pubkey, +} diff --git a/clients/rust/src/generated/types/collection_details.rs b/clients/rust/src/generated/types/collection_details.rs new file mode 100644 index 00000000..1a059b62 --- /dev/null +++ b/clients/rust/src/generated/types/collection_details.rs @@ -0,0 +1,14 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum CollectionDetails { + V1 { size: u64 }, +} diff --git a/clients/rust/src/generated/types/collection_details_toggle.rs b/clients/rust/src/generated/types/collection_details_toggle.rs new file mode 100644 index 00000000..86ad4733 --- /dev/null +++ b/clients/rust/src/generated/types/collection_details_toggle.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::CollectionDetails; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum CollectionDetailsToggle { + None, + Clear, + Set(CollectionDetails), +} diff --git a/clients/rust/src/generated/types/collection_toggle.rs b/clients/rust/src/generated/types/collection_toggle.rs new file mode 100644 index 00000000..c032e79f --- /dev/null +++ b/clients/rust/src/generated/types/collection_toggle.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Collection; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum CollectionToggle { + None, + Clear, + Set(Collection), +} diff --git a/clients/rust/src/generated/types/create_args.rs b/clients/rust/src/generated/types/create_args.rs new file mode 100644 index 00000000..0c35f5b9 --- /dev/null +++ b/clients/rust/src/generated/types/create_args.rs @@ -0,0 +1,36 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Collection; +use crate::generated::types::CollectionDetails; +use crate::generated::types::Creator; +use crate::generated::types::PrintSupply; +use crate::generated::types::TokenStandard; +use crate::generated::types::Uses; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum CreateArgs { + V1 { + name: String, + symbol: String, + uri: String, + seller_fee_basis_points: u16, + creators: Option>, + primary_sale_happened: bool, + is_mutable: bool, + token_standard: TokenStandard, + collection: Option, + uses: Option, + collection_details: Option, + rule_set: Option, + decimals: Option, + print_supply: Option, + }, +} diff --git a/clients/rust/src/generated/types/creator.rs b/clients/rust/src/generated/types/creator.rs new file mode 100644 index 00000000..7c7eb67a --- /dev/null +++ b/clients/rust/src/generated/types/creator.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct Creator { + pub address: Pubkey, + pub verified: bool, + pub share: u8, +} diff --git a/clients/rust/src/generated/types/data_v2.rs b/clients/rust/src/generated/types/data_v2.rs new file mode 100644 index 00000000..f56842a3 --- /dev/null +++ b/clients/rust/src/generated/types/data_v2.rs @@ -0,0 +1,23 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Collection; +use crate::generated::types::Creator; +use crate::generated::types::Uses; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct DataV2 { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, + pub collection: Option, + pub uses: Option, +} diff --git a/clients/rust/src/generated/types/delegate_args.rs b/clients/rust/src/generated/types/delegate_args.rs new file mode 100644 index 00000000..1f72db30 --- /dev/null +++ b/clients/rust/src/generated/types/delegate_args.rs @@ -0,0 +1,60 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum DelegateArgs { + CollectionV1 { + authorization_data: Option, + }, + SaleV1 { + amount: u64, + authorization_data: Option, + }, + TransferV1 { + amount: u64, + authorization_data: Option, + }, + DataV1 { + authorization_data: Option, + }, + UtilityV1 { + amount: u64, + authorization_data: Option, + }, + StakingV1 { + amount: u64, + authorization_data: Option, + }, + StandardV1 { + amount: u64, + }, + LockedTransferV1 { + amount: u64, + locked_address: Pubkey, + authorization_data: Option, + }, + ProgrammableConfigV1 { + authorization_data: Option, + }, + AuthorityItemV1 { + authorization_data: Option, + }, + DataItemV1 { + authorization_data: Option, + }, + CollectionItemV1 { + authorization_data: Option, + }, + ProgrammableConfigItemV1 { + authorization_data: Option, + }, +} diff --git a/clients/rust/src/generated/types/escrow_authority.rs b/clients/rust/src/generated/types/escrow_authority.rs new file mode 100644 index 00000000..22d11bc8 --- /dev/null +++ b/clients/rust/src/generated/types/escrow_authority.rs @@ -0,0 +1,16 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum EscrowAuthority { + TokenOwner, + Creator(Pubkey), +} diff --git a/clients/rust/src/generated/types/key.rs b/clients/rust/src/generated/types/key.rs new file mode 100644 index 00000000..be3c0150 --- /dev/null +++ b/clients/rust/src/generated/types/key.rs @@ -0,0 +1,27 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum Key { + Uninitialized, + EditionV1, + MasterEditionV1, + ReservationListV1, + MetadataV1, + ReservationListV2, + MasterEditionV2, + EditionMarker, + UseAuthorityRecord, + CollectionAuthorityRecord, + TokenOwnedEscrow, + TokenRecord, + MetadataDelegate, + EditionMarkerV2, +} diff --git a/clients/rust/src/generated/types/leaf_info.rs b/clients/rust/src/generated/types/leaf_info.rs new file mode 100644 index 00000000..a049bf8c --- /dev/null +++ b/clients/rust/src/generated/types/leaf_info.rs @@ -0,0 +1,15 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct LeafInfo { + pub leaf: [u8; 32], + pub proof: Vec<[u8; 32]>, +} diff --git a/clients/rust/src/generated/types/lock_args.rs b/clients/rust/src/generated/types/lock_args.rs new file mode 100644 index 00000000..be307f2e --- /dev/null +++ b/clients/rust/src/generated/types/lock_args.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum LockArgs { + V1 { + authorization_data: Option, + }, +} diff --git a/clients/rust/src/generated/types/metadata_delegate_role.rs b/clients/rust/src/generated/types/metadata_delegate_role.rs new file mode 100644 index 00000000..ff51d00c --- /dev/null +++ b/clients/rust/src/generated/types/metadata_delegate_role.rs @@ -0,0 +1,21 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum MetadataDelegateRole { + AuthorityItem, + Collection, + Use, + Data, + ProgrammableConfig, + DataItem, + CollectionItem, + ProgrammableConfigItem, +} diff --git a/clients/rust/src/generated/types/migration_type.rs b/clients/rust/src/generated/types/migration_type.rs new file mode 100644 index 00000000..f070abaf --- /dev/null +++ b/clients/rust/src/generated/types/migration_type.rs @@ -0,0 +1,15 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum MigrationType { + CollectionV1, + ProgrammableV1, +} diff --git a/clients/rust/src/generated/types/mint_args.rs b/clients/rust/src/generated/types/mint_args.rs new file mode 100644 index 00000000..32a9a1f9 --- /dev/null +++ b/clients/rust/src/generated/types/mint_args.rs @@ -0,0 +1,18 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum MintArgs { + V1 { + amount: u64, + authorization_data: Option, + }, +} diff --git a/clients/rust/src/generated/types/mint_new_edition_from_master_edition_via_token_args.rs b/clients/rust/src/generated/types/mint_new_edition_from_master_edition_via_token_args.rs new file mode 100644 index 00000000..7843f89a --- /dev/null +++ b/clients/rust/src/generated/types/mint_new_edition_from_master_edition_via_token_args.rs @@ -0,0 +1,14 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct MintNewEditionFromMasterEditionViaTokenArgs { + pub edition: u64, +} diff --git a/clients/rust/src/generated/types/mod.rs b/clients/rust/src/generated/types/mod.rs new file mode 100644 index 00000000..b481e047 --- /dev/null +++ b/clients/rust/src/generated/types/mod.rs @@ -0,0 +1,92 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +pub mod authority_type; +pub mod authorization_data; +pub mod burn_args; +pub mod collection; +pub mod collection_details; +pub mod collection_details_toggle; +pub mod collection_toggle; +pub mod create_args; +pub mod creator; +pub mod data_v2; +pub mod delegate_args; +pub mod escrow_authority; +pub mod key; +pub mod leaf_info; +pub mod lock_args; +pub mod metadata_delegate_role; +pub mod migration_type; +pub mod mint_args; +pub mod mint_new_edition_from_master_edition_via_token_args; +pub mod payload; +pub mod payload_key; +pub mod payload_type; +pub mod print_args; +pub mod print_supply; +pub mod programmable_config; +pub mod reservation; +pub mod reservation_v1; +pub mod revoke_args; +pub mod rule_set_toggle; +pub mod seeds_vec; +pub mod set_collection_size_args; +pub mod token_delegate_role; +pub mod token_standard; +pub mod token_state; +pub mod transfer_args; +pub mod unlock_args; +pub mod update_args; +pub mod use_args; +pub mod use_method; +pub mod uses; +pub mod uses_toggle; +pub mod verification_args; + +pub use self::authority_type::*; +pub use self::authorization_data::*; +pub use self::burn_args::*; +pub use self::collection::*; +pub use self::collection_details::*; +pub use self::collection_details_toggle::*; +pub use self::collection_toggle::*; +pub use self::create_args::*; +pub use self::creator::*; +pub use self::data_v2::*; +pub use self::delegate_args::*; +pub use self::escrow_authority::*; +pub use self::key::*; +pub use self::leaf_info::*; +pub use self::lock_args::*; +pub use self::metadata_delegate_role::*; +pub use self::migration_type::*; +pub use self::mint_args::*; +pub use self::mint_new_edition_from_master_edition_via_token_args::*; +pub use self::payload::*; +pub use self::payload_key::*; +pub use self::payload_type::*; +pub use self::print_args::*; +pub use self::print_supply::*; +pub use self::programmable_config::*; +pub use self::reservation::*; +pub use self::reservation_v1::*; +pub use self::revoke_args::*; +pub use self::rule_set_toggle::*; +pub use self::seeds_vec::*; +pub use self::set_collection_size_args::*; +pub use self::token_delegate_role::*; +pub use self::token_standard::*; +pub use self::token_state::*; +pub use self::transfer_args::*; +pub use self::unlock_args::*; +pub use self::update_args::*; +pub use self::use_args::*; +pub use self::use_method::*; +pub use self::uses::*; +pub use self::uses_toggle::*; +pub use self::verification_args::*; diff --git a/clients/rust/src/generated/types/payload.rs b/clients/rust/src/generated/types/payload.rs new file mode 100644 index 00000000..c64092c3 --- /dev/null +++ b/clients/rust/src/generated/types/payload.rs @@ -0,0 +1,16 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::PayloadType; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use std::collections::HashMap; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct Payload { + pub map: HashMap, +} diff --git a/clients/rust/src/generated/types/payload_key.rs b/clients/rust/src/generated/types/payload_key.rs new file mode 100644 index 00000000..7a0e3287 --- /dev/null +++ b/clients/rust/src/generated/types/payload_key.rs @@ -0,0 +1,23 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum PayloadKey { + Amount, + Authority, + AuthoritySeeds, + Delegate, + DelegateSeeds, + Destination, + DestinationSeeds, + Holder, + Source, + SourceSeeds, +} diff --git a/clients/rust/src/generated/types/payload_type.rs b/clients/rust/src/generated/types/payload_type.rs new file mode 100644 index 00000000..ab281ff2 --- /dev/null +++ b/clients/rust/src/generated/types/payload_type.rs @@ -0,0 +1,20 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::LeafInfo; +use crate::generated::types::SeedsVec; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum PayloadType { + Pubkey(Pubkey), + Seeds(SeedsVec), + MerkleProof(LeafInfo), + Number(u64), +} diff --git a/clients/rust/src/generated/types/print_args.rs b/clients/rust/src/generated/types/print_args.rs new file mode 100644 index 00000000..7b013479 --- /dev/null +++ b/clients/rust/src/generated/types/print_args.rs @@ -0,0 +1,14 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum PrintArgs { + V1 { edition: u64 }, +} diff --git a/clients/rust/src/generated/types/print_supply.rs b/clients/rust/src/generated/types/print_supply.rs new file mode 100644 index 00000000..71c85fa2 --- /dev/null +++ b/clients/rust/src/generated/types/print_supply.rs @@ -0,0 +1,16 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum PrintSupply { + Zero, + Limited(u64), + Unlimited, +} diff --git a/clients/rust/src/generated/types/programmable_config.rs b/clients/rust/src/generated/types/programmable_config.rs new file mode 100644 index 00000000..9d2f51ec --- /dev/null +++ b/clients/rust/src/generated/types/programmable_config.rs @@ -0,0 +1,15 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum ProgrammableConfig { + V1 { rule_set: Option }, +} diff --git a/clients/rust/src/generated/types/reservation.rs b/clients/rust/src/generated/types/reservation.rs new file mode 100644 index 00000000..8cdb53e5 --- /dev/null +++ b/clients/rust/src/generated/types/reservation.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct Reservation { + pub address: Pubkey, + pub spots_remaining: u64, + pub total_spots: u64, +} diff --git a/clients/rust/src/generated/types/reservation_v1.rs b/clients/rust/src/generated/types/reservation_v1.rs new file mode 100644 index 00000000..77c4fce5 --- /dev/null +++ b/clients/rust/src/generated/types/reservation_v1.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct ReservationV1 { + pub address: Pubkey, + pub spots_remaining: u8, + pub total_spots: u8, +} diff --git a/clients/rust/src/generated/types/revoke_args.rs b/clients/rust/src/generated/types/revoke_args.rs new file mode 100644 index 00000000..51ff5ee5 --- /dev/null +++ b/clients/rust/src/generated/types/revoke_args.rs @@ -0,0 +1,27 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum RevokeArgs { + CollectionV1, + SaleV1, + TransferV1, + DataV1, + UtilityV1, + StakingV1, + StandardV1, + LockedTransferV1, + ProgrammableConfigV1, + MigrationV1, + AuthorityItemV1, + DataItemV1, + CollectionItemV1, + ProgrammableConfigItemV1, +} diff --git a/clients/rust/src/generated/types/rule_set_toggle.rs b/clients/rust/src/generated/types/rule_set_toggle.rs new file mode 100644 index 00000000..338e0296 --- /dev/null +++ b/clients/rust/src/generated/types/rule_set_toggle.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum RuleSetToggle { + None, + Clear, + Set(Pubkey), +} diff --git a/clients/rust/src/generated/types/seeds_vec.rs b/clients/rust/src/generated/types/seeds_vec.rs new file mode 100644 index 00000000..3fff94e6 --- /dev/null +++ b/clients/rust/src/generated/types/seeds_vec.rs @@ -0,0 +1,14 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct SeedsVec { + pub seeds: Vec>, +} diff --git a/clients/rust/src/generated/types/set_collection_size_args.rs b/clients/rust/src/generated/types/set_collection_size_args.rs new file mode 100644 index 00000000..7e42fdf8 --- /dev/null +++ b/clients/rust/src/generated/types/set_collection_size_args.rs @@ -0,0 +1,14 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct SetCollectionSizeArgs { + pub size: u64, +} diff --git a/clients/rust/src/generated/types/token_delegate_role.rs b/clients/rust/src/generated/types/token_delegate_role.rs new file mode 100644 index 00000000..5bdf99bd --- /dev/null +++ b/clients/rust/src/generated/types/token_delegate_role.rs @@ -0,0 +1,20 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum TokenDelegateRole { + Sale, + Transfer, + Utility, + Staking, + Standard, + LockedTransfer, + Migration, +} diff --git a/clients/rust/src/generated/types/token_standard.rs b/clients/rust/src/generated/types/token_standard.rs new file mode 100644 index 00000000..6846a51d --- /dev/null +++ b/clients/rust/src/generated/types/token_standard.rs @@ -0,0 +1,19 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum TokenStandard { + NonFungible, + FungibleAsset, + Fungible, + NonFungibleEdition, + ProgrammableNonFungible, + ProgrammableNonFungibleEdition, +} diff --git a/clients/rust/src/generated/types/token_state.rs b/clients/rust/src/generated/types/token_state.rs new file mode 100644 index 00000000..8995fb59 --- /dev/null +++ b/clients/rust/src/generated/types/token_state.rs @@ -0,0 +1,16 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum TokenState { + Unlocked, + Locked, + Listed, +} diff --git a/clients/rust/src/generated/types/transfer_args.rs b/clients/rust/src/generated/types/transfer_args.rs new file mode 100644 index 00000000..4f6c17df --- /dev/null +++ b/clients/rust/src/generated/types/transfer_args.rs @@ -0,0 +1,18 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum TransferArgs { + V1 { + amount: u64, + authorization_data: Option, + }, +} diff --git a/clients/rust/src/generated/types/unlock_args.rs b/clients/rust/src/generated/types/unlock_args.rs new file mode 100644 index 00000000..ea911a08 --- /dev/null +++ b/clients/rust/src/generated/types/unlock_args.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum UnlockArgs { + V1 { + authorization_data: Option, + }, +} diff --git a/clients/rust/src/generated/types/update_args.rs b/clients/rust/src/generated/types/update_args.rs new file mode 100644 index 00000000..ddec490b --- /dev/null +++ b/clients/rust/src/generated/types/update_args.rs @@ -0,0 +1,108 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use crate::generated::types::CollectionDetailsToggle; +use crate::generated::types::CollectionToggle; +use crate::generated::types::Creator; +use crate::generated::types::RuleSetToggle; +use crate::generated::types::TokenStandard; +use crate::generated::types::UsesToggle; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum UpdateArgs { + V1 { + new_update_authority: Option, + data: Option, + primary_sale_happened: Option, + is_mutable: Option, + collection: CollectionToggle, + collection_details: CollectionDetailsToggle, + uses: UsesToggle, + rule_set: RuleSetToggle, + authorization_data: Option, + }, + AsUpdateAuthorityV2 { + new_update_authority: Option, + data: Option, + primary_sale_happened: Option, + is_mutable: Option, + collection: CollectionToggle, + collection_details: CollectionDetailsToggle, + uses: UsesToggle, + rule_set: RuleSetToggle, + token_standard: Option, + authorization_data: Option, + }, + AsAuthorityItemDelegateV2 { + new_update_authority: Option, + primary_sale_happened: Option, + is_mutable: Option, + token_standard: Option, + authorization_data: Option, + }, + AsCollectionDelegateV2 { + collection: CollectionToggle, + authorization_data: Option, + }, + AsDataDelegateV2 { + data: Option, + authorization_data: Option, + }, + AsProgrammableConfigDelegateV2 { + rule_set: RuleSetToggle, + authorization_data: Option, + }, + AsDataItemDelegateV2 { + data: Option, + authorization_data: Option, + }, + AsCollectionItemDelegateV2 { + collection: CollectionToggle, + authorization_data: Option, + }, + AsProgrammableConfigItemDelegateV2 { + rule_set: RuleSetToggle, + authorization_data: Option, + }, +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct UpdateArgsV1Data { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, +} +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct UpdateArgsAsUpdateAuthorityV2Data { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, +} +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct UpdateArgsAsDataDelegateV2Data { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, +} +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct UpdateArgsAsDataItemDelegateV2Data { + pub name: String, + pub symbol: String, + pub uri: String, + pub seller_fee_basis_points: u16, + pub creators: Option>, +} diff --git a/clients/rust/src/generated/types/use_args.rs b/clients/rust/src/generated/types/use_args.rs new file mode 100644 index 00000000..0ace0ef9 --- /dev/null +++ b/clients/rust/src/generated/types/use_args.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::AuthorizationData; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum UseArgs { + V1 { + authorization_data: Option, + }, +} diff --git a/clients/rust/src/generated/types/use_method.rs b/clients/rust/src/generated/types/use_method.rs new file mode 100644 index 00000000..9b6abd42 --- /dev/null +++ b/clients/rust/src/generated/types/use_method.rs @@ -0,0 +1,16 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum UseMethod { + Burn, + Multiple, + Single, +} diff --git a/clients/rust/src/generated/types/uses.rs b/clients/rust/src/generated/types/uses.rs new file mode 100644 index 00000000..3f5a8e79 --- /dev/null +++ b/clients/rust/src/generated/types/uses.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::UseMethod; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub struct Uses { + pub use_method: UseMethod, + pub remaining: u64, + pub total: u64, +} diff --git a/clients/rust/src/generated/types/uses_toggle.rs b/clients/rust/src/generated/types/uses_toggle.rs new file mode 100644 index 00000000..f35c7ad8 --- /dev/null +++ b/clients/rust/src/generated/types/uses_toggle.rs @@ -0,0 +1,17 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::Uses; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +pub enum UsesToggle { + None, + Clear, + Set(Uses), +} diff --git a/clients/rust/src/generated/types/verification_args.rs b/clients/rust/src/generated/types/verification_args.rs new file mode 100644 index 00000000..e830b1c2 --- /dev/null +++ b/clients/rust/src/generated/types/verification_args.rs @@ -0,0 +1,15 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +pub enum VerificationArgs { + CreatorV1, + CollectionV1, +} diff --git a/clients/rust/src/hooked/metadata_delegate_role_seed.rs b/clients/rust/src/hooked/metadata_delegate_role_seed.rs new file mode 100644 index 00000000..7524c1fc --- /dev/null +++ b/clients/rust/src/hooked/metadata_delegate_role_seed.rs @@ -0,0 +1,28 @@ +use std::fmt::{Display, Formatter, Result}; + +use crate::types::MetadataDelegateRole; + +pub struct MetadataDelegateRoleSeed(MetadataDelegateRole); + +impl Display for MetadataDelegateRoleSeed { + fn fmt(&self, f: &mut Formatter) -> Result { + let message = match self.0 { + MetadataDelegateRole::AuthorityItem => "authority_item_delegate".to_string(), + MetadataDelegateRole::Collection => "collection_delegate".to_string(), + MetadataDelegateRole::Use => "use_delegate".to_string(), + MetadataDelegateRole::Data => "data_delegate".to_string(), + MetadataDelegateRole::ProgrammableConfig => "programmable_config_delegate".to_string(), + MetadataDelegateRole::DataItem => "data_item_delegate".to_string(), + MetadataDelegateRole::CollectionItem => "collection_item_delegate".to_string(), + MetadataDelegateRole::ProgrammableConfigItem => "prog_config_item_delegate".to_string(), + }; + + write!(f, "{message}") + } +} + +impl From for MetadataDelegateRoleSeed { + fn from(role: MetadataDelegateRole) -> Self { + MetadataDelegateRoleSeed(role) + } +} diff --git a/clients/rust/src/hooked/mod.rs b/clients/rust/src/hooked/mod.rs new file mode 100644 index 00000000..4fdc1a38 --- /dev/null +++ b/clients/rust/src/hooked/mod.rs @@ -0,0 +1,2 @@ +mod metadata_delegate_role_seed; +pub use metadata_delegate_role_seed::MetadataDelegateRoleSeed; diff --git a/clients/rust/src/lib.rs b/clients/rust/src/lib.rs new file mode 100644 index 00000000..e0ec41fc --- /dev/null +++ b/clients/rust/src/lib.rs @@ -0,0 +1,10 @@ +mod generated; +pub mod hooked; + +pub use generated::programs::MPL_TOKEN_METADATA_ID as ID; +pub use generated::*; + +/// Removes all null bytes from a string. +pub fn clean(value: String) -> String { + value.replace('\0', "") +} diff --git a/clients/rust/tests/create.rs b/clients/rust/tests/create.rs new file mode 100644 index 00000000..bad5e1c6 --- /dev/null +++ b/clients/rust/tests/create.rs @@ -0,0 +1,172 @@ +#[cfg(feature = "test-sbf")] +pub mod setup; +use setup::*; + +use solana_program::borsh0_10::try_from_slice_unchecked; +use solana_program::pubkey::Pubkey; +use solana_program::system_program; +use solana_program_test::*; +use solana_sdk::{ + signature::{Keypair, Signer}, + transaction::Transaction, +}; + +use mpl_token_metadata::accounts::MasterEdition; +use mpl_token_metadata::{ + accounts::Metadata, + types::{Key, PrintSupply}, +}; +use mpl_token_metadata::{ + clean, + instructions::{CreateV1, CreateV1InstructionArgs}, +}; +use mpl_token_metadata::{instructions::CreateV1Builder, types::TokenStandard}; + +mod create { + + use super::*; + + #[tokio::test] + async fn create_nonfungible() { + let mut context = program_test().start_with_context().await; + + // given a mint address + + let payer_pubkey = context.payer.pubkey(); + let mint = Keypair::new(); + let mint_pubkey = mint.pubkey(); + + let (metadata, _) = Metadata::find_pda(&mint_pubkey); + let (master_edition, _) = MasterEdition::find_pda(&mint_pubkey); + + // when we create a non-fungible metadata + + let create_ix = CreateV1Builder::new() + .metadata(metadata) + .master_edition(master_edition) + .mint(mint_pubkey, true) + .authority(payer_pubkey) + .payer(payer_pubkey) + .update_authority(payer_pubkey, true) + .is_mutable(true) + .primary_sale_happened(false) + .name(String::from("NonFungible")) + .symbol(String::from("NFT")) + .uri(String::from("http://my.nft")) + .seller_fee_basis_points(500) + .token_standard(TokenStandard::NonFungible) + .print_supply(PrintSupply::Zero) + .build(); + + let tx = Transaction::new_signed_with_payer( + &[create_ix], + Some(&context.payer.pubkey()), + &[&context.payer, &mint], + context.last_blockhash, + ); + + context.banks_client.process_transaction(tx).await.unwrap(); + + // then the metadata is created with the correct values + + let metadata_account = get_account(&mut context, &metadata).await; + let metadata: Metadata = try_from_slice_unchecked(&metadata_account.data).unwrap(); + + assert!(!metadata.primary_sale_happened); + assert!(metadata.is_mutable); + + assert_eq!(metadata.key, Key::MetadataV1); + assert_eq!(clean(metadata.name), String::from("NonFungible")); + assert_eq!(clean(metadata.symbol), String::from("NFT")); + assert_eq!(clean(metadata.uri), String::from("http://my.nft")); + assert_eq!(metadata.seller_fee_basis_points, 500); + assert_eq!(metadata.creators, None); + assert_eq!(metadata.mint, mint_pubkey); + assert_eq!(metadata.update_authority, context.payer.pubkey()); + assert_eq!(metadata.token_standard, Some(TokenStandard::NonFungible)); + } + + #[tokio::test] + async fn create_programmable_nonfungible() { + let mut context = program_test().start_with_context().await; + + // given a mint address + + let payer_pubkey = context.payer.pubkey(); + let mint = Keypair::new(); + let mint_pubkey = mint.pubkey(); + + let metadata_seeds = &[b"metadata", PROGRAM_ID.as_ref(), mint_pubkey.as_ref()]; + let (metadata, _) = Pubkey::find_program_address(metadata_seeds, &PROGRAM_ID); + + let master_edition_seeds = &[ + b"metadata", + PROGRAM_ID.as_ref(), + mint_pubkey.as_ref(), + b"edition", + ]; + let (master_edition, _) = Pubkey::find_program_address(master_edition_seeds, &PROGRAM_ID); + + // when we create a programmable non-fungible metadata + + let args = CreateV1InstructionArgs { + name: String::from("pNFT"), + uri: String::from("http://my.pnft"), + symbol: String::from(""), + seller_fee_basis_points: 500, + primary_sale_happened: false, + is_mutable: true, + creators: None, + token_standard: TokenStandard::ProgrammableNonFungible, + collection: None, + collection_details: None, + decimals: Some(0), + print_supply: Some(PrintSupply::Zero), + rule_set: None, + uses: None, + }; + + let create_ix = CreateV1 { + metadata, + master_edition: Some(master_edition), + mint: (mint_pubkey, true), + authority: payer_pubkey, + update_authority: (payer_pubkey, true), + payer: payer_pubkey, + spl_token_program: spl_token::ID, + system_program: system_program::ID, + sysvar_instructions: solana_program::sysvar::instructions::ID, + } + .instruction(args); + + let tx = Transaction::new_signed_with_payer( + &[create_ix], + Some(&context.payer.pubkey()), + &[&context.payer, &mint], + context.last_blockhash, + ); + + context.banks_client.process_transaction(tx).await.unwrap(); + + // then the metadata is created with the correct values + + let metadata_account = get_account(&mut context, &metadata).await; + let metadata: Metadata = try_from_slice_unchecked(&metadata_account.data).unwrap(); + + assert!(!metadata.primary_sale_happened); + assert!(metadata.is_mutable); + + assert_eq!(metadata.key, Key::MetadataV1); + assert_eq!(clean(metadata.name), String::from("pNFT")); + assert_eq!(clean(metadata.symbol), String::from("")); + assert_eq!(clean(metadata.uri), String::from("http://my.pnft")); + assert_eq!(metadata.seller_fee_basis_points, 500); + assert_eq!(metadata.creators, None); + assert_eq!(metadata.mint, mint_pubkey); + assert_eq!(metadata.update_authority, context.payer.pubkey()); + assert_eq!( + metadata.token_standard, + Some(TokenStandard::ProgrammableNonFungible) + ); + } +} diff --git a/clients/rust/tests/lock.rs b/clients/rust/tests/lock.rs new file mode 100644 index 00000000..d575f6e1 --- /dev/null +++ b/clients/rust/tests/lock.rs @@ -0,0 +1,97 @@ +#[cfg(feature = "test-sbf")] +pub mod setup; +use setup::*; + +use solana_program::program_pack::Pack; +use solana_program_test::*; +use solana_sdk::signature::{Keypair, Signer}; +use solana_sdk::transaction::Transaction; +use spl_token::state::Account; + +use mpl_token_metadata::instructions::DelegateStandardV1Builder; +use mpl_token_metadata::instructions::LockV1Builder; +use mpl_token_metadata::types::TokenStandard; + +mod lock { + + use super::*; + + #[tokio::test] + async fn delegate_lock_nonfungible() { + let mut context = program_test().start_with_context().await; + + // given a non-fungible asset and a token + + let update_authority = Keypair::new(); + let token_owner = Keypair::new(); + let payer = context.payer.dirty_clone(); + + let mut asset = DigitalAsset::default(); + asset + .create_and_mint( + &mut context, + TokenStandard::NonFungible, + &update_authority, + &token_owner.pubkey(), + 1, + &payer, + ) + .await + .unwrap(); + + // and a standard delegate + + let delegate = Keypair::new(); + + let delegate_ix = DelegateStandardV1Builder::new() + .token(asset.token) + .metadata(asset.metadata) + .master_edition(asset.master_edition) + .mint(asset.mint.pubkey()) + .delegate(delegate.pubkey()) + .authority(token_owner.pubkey()) + .spl_token_program(spl_token::ID) + .payer(payer.pubkey()) + .amount(1) + .build(); + + let tx = Transaction::new_signed_with_payer( + &[delegate_ix], + Some(&context.payer.pubkey()), + &[&payer, &token_owner], + context.last_blockhash, + ); + context.banks_client.process_transaction(tx).await.unwrap(); + + // when we lock the token + + let lock_ix = LockV1Builder::new() + .authority(delegate.pubkey()) + .metadata(asset.metadata) + .edition(asset.master_edition) + .mint(asset.mint.pubkey()) + .token(asset.token) + .spl_token_program(spl_token::ID) + .payer(payer.pubkey()) + .build(); + + let tx = Transaction::new_signed_with_payer( + &[lock_ix], + Some(&context.payer.pubkey()), + &[&payer, &delegate], + context.last_blockhash, + ); + context.banks_client.process_transaction(tx).await.unwrap(); + + // then the token is frozen + + let token_account = get_account(&mut context, &asset.token).await; + let token = Account::unpack(&token_account.data).unwrap(); + assert!(token.is_frozen()); + + // and the delegate is set + + assert!(token.delegate.is_some()); + assert_eq!(token.delegate.unwrap(), delegate.pubkey()); + } +} diff --git a/clients/rust/tests/setup/digital_asset.rs b/clients/rust/tests/setup/digital_asset.rs new file mode 100644 index 00000000..cf5ec4c9 --- /dev/null +++ b/clients/rust/tests/setup/digital_asset.rs @@ -0,0 +1,128 @@ +use mpl_token_metadata::{ + accounts::{MasterEdition, Metadata}, + instructions::{CreateV1Builder, MintV1Builder}, + types::{PrintSupply, TokenStandard}, +}; +use solana_program::pubkey::Pubkey; +use solana_program_test::{BanksClientError, ProgramTestContext}; +use solana_sdk::{ + signature::{Keypair, Signer}, + transaction::Transaction, +}; + +pub struct DigitalAsset { + pub mint: Keypair, + pub metadata: Pubkey, + pub master_edition: Pubkey, + pub token: Pubkey, +} + +impl Default for DigitalAsset { + fn default() -> Self { + Self { + mint: Keypair::new(), + metadata: Pubkey::default(), + master_edition: Pubkey::default(), + token: Pubkey::default(), + } + } +} + +impl DigitalAsset { + pub async fn create( + &mut self, + context: &mut ProgramTestContext, + name: String, + uri: String, + token_standard: TokenStandard, + update_authority: &Keypair, + payer: &Keypair, + ) -> Result<(), BanksClientError> { + self.metadata = Metadata::find_pda(&self.mint.pubkey()).0; + self.master_edition = MasterEdition::find_pda(&self.mint.pubkey()).0; + + let create_ix = CreateV1Builder::new() + .metadata(self.metadata) + .master_edition(self.master_edition) + .mint(self.mint.pubkey(), true) + .authority(update_authority.pubkey()) + .payer(payer.pubkey()) + .update_authority(update_authority.pubkey(), true) + .is_mutable(true) + .primary_sale_happened(false) + .seller_fee_basis_points(500) + .print_supply(PrintSupply::Zero) + .name(name) + .uri(uri) + .token_standard(token_standard) + .build(); + + let tx = Transaction::new_signed_with_payer( + &[create_ix], + Some(&context.payer.pubkey()), + &[payer, update_authority, &self.mint], + context.last_blockhash, + ); + context.banks_client.process_transaction(tx).await + } + + pub async fn mint( + &mut self, + context: &mut ProgramTestContext, + token_owner: &Pubkey, + amount: u64, + update_authority: &Keypair, + payer: &Keypair, + ) -> Result<(), BanksClientError> { + self.token = spl_associated_token_account::get_associated_token_address_with_program_id( + token_owner, + &self.mint.pubkey(), + &spl_token::ID, + ); + + let mint_ix = MintV1Builder::new() + .token(self.token) + .token_owner(*token_owner) + .metadata(self.metadata) + .master_edition(self.master_edition) + .mint(self.mint.pubkey()) + .authority(update_authority.pubkey()) + .payer(payer.pubkey()) + .amount(amount) + .build(); + + let tx = Transaction::new_signed_with_payer( + &[mint_ix], + Some(&context.payer.pubkey()), + &[payer, update_authority], + context.last_blockhash, + ); + context.banks_client.process_transaction(tx).await + } + + #[allow(clippy::too_many_arguments)] + pub async fn create_and_mint( + &mut self, + context: &mut ProgramTestContext, + token_standard: TokenStandard, + update_authority: &Keypair, + token_owner: &Pubkey, + amount: u64, + payer: &Keypair, + ) -> Result<(), BanksClientError> { + self.create( + context, + String::from("Digial Asset"), + String::from("https://digital.asset"), + token_standard, + update_authority, + payer, + ) + .await?; + + self.mint(context, token_owner, amount, update_authority, payer) + .await?; + + Ok(()) + } +} diff --git a/clients/rust/tests/setup/dirty_clone.rs b/clients/rust/tests/setup/dirty_clone.rs new file mode 100644 index 00000000..798107d6 --- /dev/null +++ b/clients/rust/tests/setup/dirty_clone.rs @@ -0,0 +1,11 @@ +use solana_sdk::signature::Keypair; + +pub trait DirtyClone { + fn dirty_clone(&self) -> Self; +} + +impl DirtyClone for Keypair { + fn dirty_clone(&self) -> Self { + Keypair::from_bytes(&self.to_bytes()).unwrap() + } +} diff --git a/clients/rust/tests/setup/mod.rs b/clients/rust/tests/setup/mod.rs new file mode 100644 index 00000000..1e2e4804 --- /dev/null +++ b/clients/rust/tests/setup/mod.rs @@ -0,0 +1,24 @@ +mod digital_asset; +mod dirty_clone; + +pub use digital_asset::*; +pub use dirty_clone::*; + +use solana_program::pubkey::Pubkey; +use solana_program_test::{ProgramTest, ProgramTestContext}; +use solana_sdk::account::Account; + +pub const PROGRAM_ID: Pubkey = mpl_token_metadata::ID; + +pub fn program_test() -> ProgramTest { + ProgramTest::new("token_metadata", mpl_token_metadata::ID, None) +} + +pub async fn get_account(context: &mut ProgramTestContext, pubkey: &Pubkey) -> Account { + context + .banks_client + .get_account(*pubkey) + .await + .unwrap() + .expect("account not found") +} diff --git a/configs/client-scripts/test-js-client.sh b/configs/client-scripts/test-js-client.sh new file mode 100755 index 00000000..5c4704aa --- /dev/null +++ b/configs/client-scripts/test-js-client.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +# go to parent folder +cd $(dirname $(dirname $SCRIPT_DIR)) +WORKING_DIR=$(pwd) + +# command-line input +ARGS=$* + +# js client tests folder +cd ${WORKING_DIR}/clients/js + +pnpm install && pnpm build && pnpm test ${ARGS} diff --git a/configs/client-scripts/test-rust-client.sh b/configs/client-scripts/test-rust-client.sh new file mode 100755 index 00000000..2a550424 --- /dev/null +++ b/configs/client-scripts/test-rust-client.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +PROGRAMS_OUTPUT="./programs/.bin" +# go to parent folder +cd $(dirname $(dirname $SCRIPT_DIR)) + +# command-line input +ARGS=$* + +WORKING_DIR=$(pwd) +SOLFMT="solfmt" +export SBF_OUT_DIR="${WORKING_DIR}/${PROGRAMS_OUTPUT}" + +# client SDK tests +cd ${WORKING_DIR}/clients/rust + +if [ ! "$(command -v $SOLFMT)" = "" ]; then + CARGO_TERM_COLOR=always cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${PROGRAMS_OUTPUT} ${ARGS} 2>&1 | ${SOLFMT} +else + cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${PROGRAMS_OUTPUT} ${ARGS} +fi diff --git a/configs/kinobi.cjs b/configs/kinobi.cjs index e3fd0321..f8a54e6d 100755 --- a/configs/kinobi.cjs +++ b/configs/kinobi.cjs @@ -6,7 +6,15 @@ const clientDir = path.join(__dirname, "..", "clients"); const idlDir = path.join(__dirname, "..", "idls"); // Instanciate Kinobi. -const kinobi = k.createFromIdls([path.join(idlDir, "mpl_token_metadata.json")]); +const kinobi = k.createFromIdls([path.join(idlDir, "token_metadata.json")]); + +kinobi.update( + new k.UpdateProgramsVisitor({ + tokenMetadata: { + name: "mplTokenMetadata", + }, + }) +); // Update Accounts. const metadataSeeds = [ @@ -17,11 +25,11 @@ const metadataSeeds = [ kinobi.update( new k.UpdateAccountsVisitor({ metadata: { - size: 679, + size: undefined, seeds: metadataSeeds, }, masterEditionV2: { - size: 282, + size: undefined, name: "masterEdition", seeds: [...metadataSeeds, k.stringConstantSeed("edition")], }, @@ -813,3 +821,13 @@ kinobi.update( const jsDir = path.join(clientDir, "js", "src", "generated"); const prettier = require(path.join(clientDir, "js", ".prettierrc.json")); kinobi.accept(new k.RenderJavaScriptVisitor(jsDir, { prettier })); + +// Render Rust. +const crateDir = path.join(clientDir, "rust"); +const rustDir = path.join(clientDir, "rust", "src", "generated"); +kinobi.accept( + new k.RenderRustVisitor(rustDir, { + formatCode: true, + crateFolder: crateDir, + }) +); diff --git a/configs/program-scripts/build.sh b/configs/program-scripts/build.sh index 68c36535..9597fbef 100755 --- a/configs/program-scripts/build.sh +++ b/configs/program-scripts/build.sh @@ -29,9 +29,9 @@ if [ ! -d ${OUTPUT} ]; then fi WORKING_DIR=$(pwd) -export BPF_OUT_DIR="${WORKING_DIR}/${OUTPUT}" +export SBF_OUT_DIR="${WORKING_DIR}/${OUTPUT}" for p in ${PROGRAMS[@]}; do cd ${WORKING_DIR}/programs/${p} - cargo build-bpf --bpf-out-dir ${WORKING_DIR}/${OUTPUT} $ARGS + cargo build-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} $ARGS done diff --git a/configs/program-scripts/test.sh b/configs/program-scripts/test.sh index d10bdef4..e76d13f4 100755 --- a/configs/program-scripts/test.sh +++ b/configs/program-scripts/test.sh @@ -29,14 +29,14 @@ PROGRAMS=$(echo $PROGRAMS | jq -c '.[]' | sed 's/"//g') WORKING_DIR=$(pwd) SOLFMT="solfmt" -export BPF_OUT_DIR="${WORKING_DIR}/${OUTPUT}" +export SBF_OUT_DIR="${WORKING_DIR}/${OUTPUT}" for p in ${PROGRAMS[@]}; do cd ${WORKING_DIR}/programs/${p} if [ ! "$(command -v $SOLFMT)" = "" ]; then - CARGO_TERM_COLOR=always cargo test-bpf --bpf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} 2>&1 | ${SOLFMT} + CARGO_TERM_COLOR=always cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} 2>&1 | ${SOLFMT} else - cargo test-bpf --bpf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} + cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} fi done diff --git a/configs/shank.cjs b/configs/shank.cjs index 5878561a..2b750a2c 100644 --- a/configs/shank.cjs +++ b/configs/shank.cjs @@ -7,7 +7,7 @@ const programDir = path.join(__dirname, "..", "programs"); generateIdl({ generator: "shank", - programName: "mpl_token_metadata", + programName: "token_metadata", programId: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", idlDir, binaryInstallDir, diff --git a/configs/validator.cjs b/configs/validator.cjs index 14cd3e82..0a51fde9 100755 --- a/configs/validator.cjs +++ b/configs/validator.cjs @@ -13,7 +13,7 @@ module.exports = { { label: "Token Metadata", programId: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", - deployPath: getProgram("mpl_token_metadata.so"), + deployPath: getProgram("token_metadata.so"), }, { label: "Token Auth Rules", diff --git a/idls/mpl_token_metadata.json b/idls/token_metadata.json similarity index 76% rename from idls/mpl_token_metadata.json rename to idls/token_metadata.json index a6ea68c3..b4a47295 100644 --- a/idls/mpl_token_metadata.json +++ b/idls/token_metadata.json @@ -1,6 +1,6 @@ { "version": "1.13.2", - "name": "mpl_token_metadata", + "name": "token_metadata", "instructions": [ { "name": "CreateMetadataAccount", @@ -9,43 +9,57 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of token asset" + "docs": [ + "Mint of token asset" + ] }, { "name": "mintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority" + "docs": [ + "Mint authority" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": false, - "desc": "update authority info" + "docs": [ + "update authority info" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info" + "docs": [ + "Rent info" + ] } ], "args": [], @@ -61,13 +75,17 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": true, - "desc": "Update authority key" + "docs": [ + "Update authority key" + ] } ], "args": [], @@ -83,79 +101,105 @@ "name": "edition", "isMut": true, "isSigner": false, - "desc": "Unallocated edition V1 account with address as pda of ['metadata', program id, mint, 'edition']" + "docs": [ + "Unallocated edition V1 account with address as pda of ['metadata', program id, mint, 'edition']" + ] }, { "name": "mint", "isMut": true, "isSigner": false, - "desc": "Metadata mint" + "docs": [ + "Metadata mint" + ] }, { "name": "printingMint", "isMut": true, "isSigner": false, - "desc": "Printing mint - A mint you control that can mint tokens that can be exchanged for limited editions of your master edition via the MintNewEditionFromMasterEditionViaToken endpoint" + "docs": [ + "Printing mint - A mint you control that can mint tokens that can be exchanged for limited editions of your master edition via the MintNewEditionFromMasterEditionViaToken endpoint" + ] }, { "name": "oneTimePrintingAuthorizationMint", "isMut": true, "isSigner": false, - "desc": "One time authorization printing mint - A mint you control that prints tokens that gives the bearer permission to mint any number of tokens from the printing mint one time via an endpoint with the token-metadata program for your metadata. Also burns the token." + "docs": [ + "One time authorization printing mint - A mint you control that prints tokens that gives the bearer permission to mint any number of tokens from the printing mint one time via an endpoint with the token-metadata program for your metadata. Also burns the token." + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": true, - "desc": "Current Update authority key" + "docs": [ + "Current Update authority key" + ] }, { "name": "printingMintAuthority", "isMut": false, "isSigner": true, - "desc": "Printing mint authority - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY." + "docs": [ + "Printing mint authority - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY." + ] }, { "name": "mintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + "docs": [ + "Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "payer", "isMut": false, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info" + "docs": [ + "Rent info" + ] }, { "name": "oneTimePrintingAuthorizationMintAuthority", "isMut": false, "isSigner": true, - "desc": "One time authorization printing mint authority - must be provided if using max supply. THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY." + "docs": [ + "One time authorization printing mint authority - must be provided if using max supply. THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY." + ] } ], "args": [], @@ -171,101 +215,134 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "New Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "New Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "edition", "isMut": true, "isSigner": false, - "desc": "New Edition V1 (pda of ['metadata', program id, mint id, 'edition'])" + "docs": [ + "New Edition V1 (pda of ['metadata', program id, mint id, 'edition'])" + ] }, { "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition'])" + "docs": [ + "Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition'])" + ] }, { "name": "mint", "isMut": true, "isSigner": false, - "desc": "Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + "docs": [ + "Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + ] }, { "name": "mintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority of new mint" + "docs": [ + "Mint authority of new mint" + ] }, { "name": "printingMint", "isMut": true, "isSigner": false, - "desc": "Printing Mint of master record edition" + "docs": [ + "Printing Mint of master record edition" + ] }, { "name": "masterTokenAccount", "isMut": true, "isSigner": false, - "desc": "Token account containing Printing mint token to be transferred" + "docs": [ + "Token account containing Printing mint token to be transferred" + ] }, { "name": "editionMarker", "isMut": true, "isSigner": false, - "desc": "Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master mint id, edition_number])" + "docs": [ + "Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master mint id, edition_number])" + ] }, { "name": "burnAuthority", "isMut": false, "isSigner": true, - "desc": "Burn authority for this token" + "docs": [ + "Burn authority for this token" + ] }, { "name": "payer", "isMut": false, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "masterUpdateAuthority", "isMut": false, "isSigner": false, - "desc": "update authority info for new metadata account" + "docs": [ + "update authority info for new metadata account" + ] }, { "name": "masterMetadata", "isMut": false, "isSigner": false, - "desc": "Master record metadata account" + "docs": [ + "Master record metadata account" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info" + "docs": [ + "Rent info" + ] }, { "name": "reservationList", "isMut": true, "isSigner": false, - "desc": "Reservation List - If present, and you are on this list, you can get an edition number given by your position on the list.", - "optional": true + "isOptional": true, + "docs": [ + "Reservation List - If present, and you are on this list, you can get an edition number given by your position on the list." + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 3 @@ -278,19 +355,25 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "owner", "isMut": false, "isSigner": true, - "desc": "Owner on the token account" + "docs": [ + "Owner on the token account" + ] }, { "name": "token", "isMut": false, "isSigner": false, - "desc": "Account containing tokens from the metadata's mint" + "docs": [ + "Account containing tokens from the metadata's mint" + ] } ], "args": [], @@ -306,19 +389,25 @@ "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])" + "docs": [ + "Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])" + ] }, { "name": "reservationList", "isMut": true, "isSigner": false, - "desc": "PDA for ReservationList of ['metadata', program id, master edition key, 'reservation', resource-key]" + "docs": [ + "PDA for ReservationList of ['metadata', program id, master edition key, 'reservation', resource-key]" + ] }, { "name": "resource", "isMut": false, "isSigner": true, - "desc": "The resource you tied the reservation list too" + "docs": [ + "The resource you tied the reservation list too" + ] } ], "args": [], @@ -334,49 +423,65 @@ "name": "reservationList", "isMut": true, "isSigner": false, - "desc": "PDA for ReservationList of ['metadata', program id, master edition key, 'reservation', resource-key]" + "docs": [ + "PDA for ReservationList of ['metadata', program id, master edition key, 'reservation', resource-key]" + ] }, { "name": "payer", "isMut": false, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": true, - "desc": "Update authority" + "docs": [ + "Update authority" + ] }, { "name": "masterEdition", "isMut": false, "isSigner": false, - "desc": " Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])" + "docs": [ + " Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])" + ] }, { "name": "resource", "isMut": false, "isSigner": false, - "desc": "A resource you wish to tie the reservation list to. This is so your later visitors who come to redeem can derive your reservation list PDA with something they can easily get at. You choose what this should be." + "docs": [ + "A resource you wish to tie the reservation list to. This is so your later visitors who come to redeem can derive your reservation list PDA with something they can easily get at. You choose what this should be." + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info" + "docs": [ + "Rent info" + ] } ], "args": [], @@ -392,13 +497,17 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata (pda of ['metadata', program id, mint id])" + ] }, { "name": "creator", "isMut": false, "isSigner": true, - "desc": "Creator" + "docs": [ + "Creator" + ] } ], "args": [], @@ -414,55 +523,73 @@ "name": "destination", "isMut": true, "isSigner": false, - "desc": "Destination account" + "docs": [ + "Destination account" + ] }, { "name": "token", "isMut": true, "isSigner": false, - "desc": "Token account containing one time authorization token" + "docs": [ + "Token account containing one time authorization token" + ] }, { "name": "oneTimePrintingAuthorizationMint", "isMut": true, "isSigner": false, - "desc": "One time authorization mint" + "docs": [ + "One time authorization mint" + ] }, { "name": "printingMint", "isMut": true, "isSigner": false, - "desc": "Printing mint" + "docs": [ + "Printing mint" + ] }, { "name": "burnAuthority", "isMut": false, "isSigner": true, - "desc": "Burn authority" + "docs": [ + "Burn authority" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "masterEdition", "isMut": false, "isSigner": false, - "desc": "Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])" + "docs": [ + "Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent" + "docs": [ + "Rent" + ] } ], "args": [], @@ -478,43 +605,57 @@ "name": "destination", "isMut": true, "isSigner": false, - "desc": "Destination account" + "docs": [ + "Destination account" + ] }, { "name": "printingMint", "isMut": true, "isSigner": false, - "desc": "Printing mint" + "docs": [ + "Printing mint" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": true, - "desc": "Update authority" + "docs": [ + "Update authority" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "masterEdition", "isMut": false, "isSigner": false, - "desc": "Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])" + "docs": [ + "Master Edition V1 key (pda of ['metadata', program id, mint id, 'edition'])" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent" + "docs": [ + "Rent" + ] } ], "args": [], @@ -530,55 +671,73 @@ "name": "edition", "isMut": true, "isSigner": false, - "desc": "Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition']" + "docs": [ + "Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition']" + ] }, { "name": "mint", "isMut": true, "isSigner": false, - "desc": "Metadata mint" + "docs": [ + "Metadata mint" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": true, - "desc": "Update authority" + "docs": [ + "Update authority" + ] }, { "name": "mintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + "docs": [ + "Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info" + "docs": [ + "Rent info" + ] } ], "args": [], @@ -594,86 +753,114 @@ "name": "newMetadata", "isMut": true, "isSigner": false, - "desc": "New Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "New Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "newEdition", "isMut": true, "isSigner": false, - "desc": "New Edition (pda of ['metadata', program id, mint id, 'edition'])" + "docs": [ + "New Edition (pda of ['metadata', program id, mint id, 'edition'])" + ] }, { "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'])" + "docs": [ + "Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'])" + ] }, { "name": "newMint", "isMut": true, "isSigner": false, - "desc": "Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + "docs": [ + "Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + ] }, { "name": "editionMarkPda", "isMut": true, "isSigner": false, - "desc": "Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE)." + "docs": [ + "Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE)." + ] }, { "name": "newMintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority of new mint" + "docs": [ + "Mint authority of new mint" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "tokenAccountOwner", "isMut": false, "isSigner": true, - "desc": "owner of token account containing master token (#8)" + "docs": [ + "owner of token account containing master token (#8)" + ] }, { "name": "tokenAccount", "isMut": false, "isSigner": false, - "desc": "token account containing token from master metadata mint" + "docs": [ + "token account containing token from master metadata mint" + ] }, { "name": "newMetadataUpdateAuthority", "isMut": false, "isSigner": false, - "desc": "Update authority info for new metadata" + "docs": [ + "Update authority info for new metadata" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Master record metadata account" + "docs": [ + "Master record metadata account" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info", - "optional": true + "isOptional": true, + "docs": [ + "Rent info" + ] } ], "args": [ @@ -684,6 +871,7 @@ } } ], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 11 @@ -696,19 +884,25 @@ "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition'])" + "docs": [ + "Master Record Edition V1 (pda of ['metadata', program id, master metadata mint id, 'edition'])" + ] }, { "name": "oneTimeAuth", "isMut": true, "isSigner": false, - "desc": "One time authorization mint" + "docs": [ + "One time authorization mint" + ] }, { "name": "printingMint", "isMut": true, "isSigner": false, - "desc": "Printing mint" + "docs": [ + "Printing mint" + ] } ], "args": [], @@ -724,104 +918,138 @@ "name": "newMetadata", "isMut": true, "isSigner": false, - "desc": "New Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "New Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "newEdition", "isMut": true, "isSigner": false, - "desc": "New Edition (pda of ['metadata', program id, mint id, 'edition'])" + "docs": [ + "New Edition (pda of ['metadata', program id, mint id, 'edition'])" + ] }, { "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']" + "docs": [ + "Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition']" + ] }, { "name": "newMint", "isMut": true, "isSigner": false, - "desc": "Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + "docs": [ + "Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + ] }, { "name": "editionMarkPda", "isMut": true, "isSigner": false, - "desc": "Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE)." + "docs": [ + "Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE)." + ] }, { "name": "newMintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority of new mint" + "docs": [ + "Mint authority of new mint" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "vaultAuthority", "isMut": false, "isSigner": true, - "desc": "Vault authority" + "docs": [ + "Vault authority" + ] }, { "name": "safetyDepositStore", "isMut": false, "isSigner": false, - "desc": "Safety deposit token store account" + "docs": [ + "Safety deposit token store account" + ] }, { "name": "safetyDepositBox", "isMut": false, "isSigner": false, - "desc": "Safety deposit box" + "docs": [ + "Safety deposit box" + ] }, { "name": "vault", "isMut": false, "isSigner": false, - "desc": "Vault" + "docs": [ + "Vault" + ] }, { "name": "newMetadataUpdateAuthority", "isMut": false, "isSigner": false, - "desc": "Update authority info for new metadata" + "docs": [ + "Update authority info for new metadata" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Master record metadata account" + "docs": [ + "Master record metadata account" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "tokenVaultProgram", "isMut": false, "isSigner": false, - "desc": "Token vault program" + "docs": [ + "Token vault program" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info", - "optional": true + "isOptional": true, + "docs": [ + "Rent info" + ] } ], "args": [ @@ -832,6 +1060,7 @@ } } ], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 13 @@ -844,7 +1073,9 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] } ], "args": [], @@ -860,13 +1091,17 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": true, - "desc": "Update authority key" + "docs": [ + "Update authority key" + ] } ], "args": [ @@ -889,47 +1124,62 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of token asset" + "docs": [ + "Mint of token asset" + ] }, { "name": "mintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority" + "docs": [ + "Mint authority" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": false, - "desc": "update authority info" + "docs": [ + "update authority info" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info", - "optional": true + "isOptional": true, + "docs": [ + "Rent info" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 16 @@ -942,56 +1192,74 @@ "name": "edition", "isMut": true, "isSigner": false, - "desc": "Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition']" + "docs": [ + "Unallocated edition V2 account with address as pda of ['metadata', program id, mint, 'edition']" + ] }, { "name": "mint", "isMut": true, "isSigner": false, - "desc": "Metadata mint" + "docs": [ + "Metadata mint" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": true, - "desc": "Update authority" + "docs": [ + "Update authority" + ] }, { "name": "mintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + "docs": [ + "Mint authority on the metadata's mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info", - "optional": true + "isOptional": true, + "docs": [ + "Rent info" + ] } ], "args": [ @@ -1002,6 +1270,7 @@ } } ], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 17 @@ -1014,47 +1283,62 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "collectionAuthority", "isMut": true, "isSigner": true, - "desc": "Collection Update authority" + "docs": [ + "Collection Update authority" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection" + "docs": [ + "Mint of the Collection" + ] }, { "name": "collection", "isMut": false, "isSigner": false, - "desc": "Metadata Account of the Collection" + "docs": [ + "Metadata Account of the Collection" + ] }, { "name": "collectionMasterEditionAccount", "isMut": false, "isSigner": false, - "desc": "MasterEdition2 Account of the Collection Token" + "docs": [ + "MasterEdition2 Account of the Collection Token" + ] }, { "name": "collectionAuthorityRecord", "isMut": false, "isSigner": false, - "desc": "Collection Authority Record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Collection Authority Record PDA" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 18 @@ -1067,69 +1351,91 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "tokenAccount", "isMut": true, "isSigner": false, - "desc": "Token Account Of NFT" + "docs": [ + "Token Account Of NFT" + ] }, { "name": "mint", "isMut": true, "isSigner": false, - "desc": "Mint of the Metadata" + "docs": [ + "Mint of the Metadata" + ] }, { "name": "useAuthority", "isMut": true, "isSigner": true, - "desc": "A Use Authority / Can be the current Owner of the NFT" + "docs": [ + "A Use Authority / Can be the current Owner of the NFT" + ] }, { "name": "owner", "isMut": false, "isSigner": false, - "desc": "Owner" + "docs": [ + "Owner" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "ataProgram", "isMut": false, "isSigner": false, - "desc": "Associated Token program" + "docs": [ + "Associated Token program" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info" + "docs": [ + "Rent info" + ] }, { "name": "useAuthorityRecord", "isMut": true, "isSigner": false, - "desc": "Use Authority Record PDA If present the program Assumes a delegated use authority", - "optional": true + "isOptional": true, + "docs": [ + "Use Authority Record PDA If present the program Assumes a delegated use authority" + ] }, { "name": "burner", "isMut": false, "isSigner": false, - "desc": "Program As Signer (Burner)", - "optional": true + "isOptional": true, + "docs": [ + "Program As Signer (Burner)" + ] } ], "args": [ @@ -1140,6 +1446,7 @@ } } ], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 19 @@ -1152,68 +1459,90 @@ "name": "useAuthorityRecord", "isMut": true, "isSigner": false, - "desc": "Use Authority Record PDA" + "docs": [ + "Use Authority Record PDA" + ] }, { "name": "owner", "isMut": true, "isSigner": true, - "desc": "Owner" + "docs": [ + "Owner" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "user", "isMut": false, "isSigner": false, - "desc": "A Use Authority" + "docs": [ + "A Use Authority" + ] }, { "name": "ownerTokenAccount", "isMut": true, "isSigner": false, - "desc": "Owned Token Account Of Mint" + "docs": [ + "Owned Token Account Of Mint" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of Metadata" + "docs": [ + "Mint of Metadata" + ] }, { "name": "burner", "isMut": false, "isSigner": false, - "desc": "Program As Signer (Burner)" + "docs": [ + "Program As Signer (Burner)" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info", - "optional": true + "isOptional": true, + "docs": [ + "Rent info" + ] } ], "args": [ @@ -1224,6 +1553,7 @@ } } ], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 20 @@ -1236,59 +1566,78 @@ "name": "useAuthorityRecord", "isMut": true, "isSigner": false, - "desc": "Use Authority Record PDA" + "docs": [ + "Use Authority Record PDA" + ] }, { "name": "owner", "isMut": true, "isSigner": true, - "desc": "Owner" + "docs": [ + "Owner" + ] }, { "name": "user", "isMut": false, "isSigner": false, - "desc": "A Use Authority" + "docs": [ + "A Use Authority" + ] }, { "name": "ownerTokenAccount", "isMut": true, "isSigner": false, - "desc": "Owned Token Account Of Mint" + "docs": [ + "Owned Token Account Of Mint" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of Metadata" + "docs": [ + "Mint of Metadata" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info", - "optional": true + "isOptional": true, + "docs": [ + "Rent info" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 21 @@ -1301,41 +1650,54 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "collectionAuthority", "isMut": true, "isSigner": true, - "desc": "Collection Authority" + "docs": [ + "Collection Authority" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection" + "docs": [ + "Mint of the Collection" + ] }, { "name": "collection", "isMut": false, "isSigner": false, - "desc": "Metadata Account of the Collection" + "docs": [ + "Metadata Account of the Collection" + ] }, { "name": "collectionMasterEditionAccount", "isMut": false, "isSigner": false, - "desc": "MasterEdition2 Account of the Collection Token" + "docs": [ + "MasterEdition2 Account of the Collection Token" + ] }, { "name": "collectionAuthorityRecord", "isMut": false, "isSigner": false, - "desc": "Collection Authority Record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Collection Authority Record PDA" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 22 @@ -1348,53 +1710,70 @@ "name": "collectionAuthorityRecord", "isMut": true, "isSigner": false, - "desc": "Collection Authority Record PDA" + "docs": [ + "Collection Authority Record PDA" + ] }, { "name": "newCollectionAuthority", "isMut": false, "isSigner": false, - "desc": "A Collection Authority" + "docs": [ + "A Collection Authority" + ] }, { "name": "updateAuthority", "isMut": true, "isSigner": true, - "desc": "Update Authority of Collection NFT" + "docs": [ + "Update Authority of Collection NFT" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Collection Metadata account" + "docs": [ + "Collection Metadata account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of Collection Metadata" + "docs": [ + "Mint of Collection Metadata" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info", - "optional": true + "isOptional": true, + "docs": [ + "Rent info" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 23 @@ -1407,31 +1786,41 @@ "name": "collectionAuthorityRecord", "isMut": true, "isSigner": false, - "desc": "Collection Authority Record PDA" + "docs": [ + "Collection Authority Record PDA" + ] }, { "name": "delegateAuthority", "isMut": true, "isSigner": false, - "desc": "Delegated Collection Authority" + "docs": [ + "Delegated Collection Authority" + ] }, { "name": "revokeAuthority", "isMut": true, "isSigner": true, - "desc": "Update Authority, or Delegated Authority, of Collection NFT" + "docs": [ + "Update Authority, or Delegated Authority, of Collection NFT" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of Metadata" + "docs": [ + "Mint of Metadata" + ] } ], "args": [], @@ -1447,53 +1836,70 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "collectionAuthority", "isMut": true, "isSigner": true, - "desc": "Collection Update authority" + "docs": [ + "Collection Update authority" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": false, - "desc": "Update Authority of Collection NFT and NFT" + "docs": [ + "Update Authority of Collection NFT and NFT" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection" + "docs": [ + "Mint of the Collection" + ] }, { "name": "collection", "isMut": false, "isSigner": false, - "desc": "Metadata Account of the Collection" + "docs": [ + "Metadata Account of the Collection" + ] }, { "name": "collectionMasterEditionAccount", "isMut": false, "isSigner": false, - "desc": "MasterEdition2 Account of the Collection Token" + "docs": [ + "MasterEdition2 Account of the Collection Token" + ] }, { "name": "collectionAuthorityRecord", "isMut": false, "isSigner": false, - "desc": "Collection Authority Record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Collection Authority Record PDA" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 25 @@ -1506,31 +1912,41 @@ "name": "delegate", "isMut": true, "isSigner": true, - "desc": "Delegate" + "docs": [ + "Delegate" + ] }, { "name": "tokenAccount", "isMut": true, "isSigner": false, - "desc": "Token account to freeze" + "docs": [ + "Token account to freeze" + ] }, { "name": "edition", "isMut": false, "isSigner": false, - "desc": "Edition" + "docs": [ + "Edition" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Token mint" + "docs": [ + "Token mint" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token Program" + "docs": [ + "Token Program" + ] } ], "args": [], @@ -1546,31 +1962,41 @@ "name": "delegate", "isMut": true, "isSigner": true, - "desc": "Delegate" + "docs": [ + "Delegate" + ] }, { "name": "tokenAccount", "isMut": true, "isSigner": false, - "desc": "Token account to thaw" + "docs": [ + "Token account to thaw" + ] }, { "name": "edition", "isMut": false, "isSigner": false, - "desc": "Edition" + "docs": [ + "Edition" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Token mint" + "docs": [ + "Token mint" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token Program" + "docs": [ + "Token Program" + ] } ], "args": [], @@ -1586,13 +2012,17 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata (pda of ['metadata', program id, mint id])" + ] }, { "name": "creator", "isMut": false, "isSigner": true, - "desc": "Creator" + "docs": [ + "Creator" + ] } ], "args": [], @@ -1608,47 +2038,62 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata (pda of ['metadata', program id, mint id])" + ] }, { "name": "owner", "isMut": true, "isSigner": true, - "desc": "NFT owner" + "docs": [ + "NFT owner" + ] }, { "name": "mint", "isMut": true, "isSigner": false, - "desc": "Mint of the NFT" + "docs": [ + "Mint of the NFT" + ] }, { "name": "tokenAccount", "isMut": true, "isSigner": false, - "desc": "Token account to close" + "docs": [ + "Token account to close" + ] }, { "name": "masterEditionAccount", "isMut": true, "isSigner": false, - "desc": "MasterEdition2 of the NFT" + "docs": [ + "MasterEdition2 of the NFT" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program" + "docs": [ + "SPL Token Program" + ] }, { "name": "collectionMetadata", "isMut": true, "isSigner": false, - "desc": "Metadata of the Collection", - "optional": true + "isOptional": true, + "docs": [ + "Metadata of the Collection" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 29 @@ -1661,47 +2106,62 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "collectionAuthority", "isMut": false, "isSigner": true, - "desc": "Collection Update authority" + "docs": [ + "Collection Update authority" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection" + "docs": [ + "Mint of the Collection" + ] }, { "name": "collection", "isMut": true, "isSigner": false, - "desc": "Metadata Account of the Collection" + "docs": [ + "Metadata Account of the Collection" + ] }, { "name": "collectionMasterEditionAccount", "isMut": false, "isSigner": false, - "desc": "MasterEdition2 Account of the Collection Token" + "docs": [ + "MasterEdition2 Account of the Collection Token" + ] }, { "name": "collectionAuthorityRecord", "isMut": false, "isSigner": false, - "desc": "Collection Authority Record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Collection Authority Record PDA" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 30 @@ -1714,47 +2174,62 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "collectionAuthority", "isMut": false, "isSigner": true, - "desc": "Collection Authority" + "docs": [ + "Collection Authority" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection" + "docs": [ + "Mint of the Collection" + ] }, { "name": "collection", "isMut": true, "isSigner": false, - "desc": "Metadata Account of the Collection" + "docs": [ + "Metadata Account of the Collection" + ] }, { "name": "collectionMasterEditionAccount", "isMut": false, "isSigner": false, - "desc": "MasterEdition2 Account of the Collection Token" + "docs": [ + "MasterEdition2 Account of the Collection Token" + ] }, { "name": "collectionAuthorityRecord", "isMut": false, "isSigner": false, - "desc": "Collection Authority Record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Collection Authority Record PDA" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 31 @@ -1767,53 +2242,70 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "collectionAuthority", "isMut": false, "isSigner": true, - "desc": "Collection Update authority" + "docs": [ + "Collection Update authority" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": false, - "desc": "Update Authority of Collection NFT and NFT" + "docs": [ + "Update Authority of Collection NFT and NFT" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection" + "docs": [ + "Mint of the Collection" + ] }, { "name": "collection", "isMut": true, "isSigner": false, - "desc": "Metadata Account of the Collection" + "docs": [ + "Metadata Account of the Collection" + ] }, { "name": "collectionMasterEditionAccount", "isMut": true, "isSigner": false, - "desc": "MasterEdition2 Account of the Collection Token" + "docs": [ + "MasterEdition2 Account of the Collection Token" + ] }, { "name": "collectionAuthorityRecord", "isMut": false, "isSigner": false, - "desc": "Collection Authority Record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Collection Authority Record PDA" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 32 @@ -1826,44 +2318,58 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of token asset" + "docs": [ + "Mint of token asset" + ] }, { "name": "mintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority" + "docs": [ + "Mint authority" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": false, - "desc": "update authority info" + "docs": [ + "update authority info" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "rent", "isMut": false, "isSigner": false, - "desc": "Rent info", - "optional": true + "isOptional": true, + "docs": [ + "Rent info" + ] } ], "args": [ @@ -1874,6 +2380,7 @@ } } ], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 33 @@ -1886,26 +2393,34 @@ "name": "collectionMetadata", "isMut": true, "isSigner": false, - "desc": "Collection Metadata account" + "docs": [ + "Collection Metadata account" + ] }, { "name": "collectionAuthority", "isMut": true, "isSigner": true, - "desc": "Collection Update authority" + "docs": [ + "Collection Update authority" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection" + "docs": [ + "Mint of the Collection" + ] }, { "name": "collectionAuthorityRecord", "isMut": false, "isSigner": false, - "desc": "Collection Authority Record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Collection Authority Record PDA" + ] } ], "args": [ @@ -1916,6 +2431,7 @@ } } ], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 34 @@ -1928,29 +2444,38 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": true, - "desc": "Metadata update authority" + "docs": [ + "Metadata update authority" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint account" + "docs": [ + "Mint account" + ] }, { "name": "edition", "isMut": false, "isSigner": false, - "desc": "Edition account", - "optional": true + "isOptional": true, + "docs": [ + "Edition account" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 35 @@ -1963,32 +2488,42 @@ "name": "collectionMetadata", "isMut": true, "isSigner": false, - "desc": "Collection Metadata account" + "docs": [ + "Collection Metadata account" + ] }, { "name": "collectionAuthority", "isMut": true, "isSigner": true, - "desc": "Collection Update authority" + "docs": [ + "Collection Update authority" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection" + "docs": [ + "Mint of the Collection" + ] }, { "name": "bubblegumSigner", "isMut": false, "isSigner": true, - "desc": "Signing PDA of Bubblegum program" + "docs": [ + "Signing PDA of Bubblegum program" + ] }, { "name": "collectionAuthorityRecord", "isMut": false, "isSigner": false, - "desc": "Collection Authority Record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Collection Authority Record PDA" + ] } ], "args": [ @@ -1999,6 +2534,7 @@ } } ], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 36 @@ -2011,61 +2547,81 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata (pda of ['metadata', program id, mint id])" + ] }, { "name": "owner", "isMut": true, "isSigner": true, - "desc": "NFT owner" + "docs": [ + "NFT owner" + ] }, { "name": "printEditionMint", "isMut": true, "isSigner": false, - "desc": "Mint of the print edition NFT" + "docs": [ + "Mint of the print edition NFT" + ] }, { "name": "masterEditionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the original/master NFT" + "docs": [ + "Mint of the original/master NFT" + ] }, { "name": "printEditionTokenAccount", "isMut": true, "isSigner": false, - "desc": "Token account the print edition NFT is in" + "docs": [ + "Token account the print edition NFT is in" + ] }, { "name": "masterEditionTokenAccount", "isMut": false, "isSigner": false, - "desc": "Token account the Master Edition NFT is in" + "docs": [ + "Token account the Master Edition NFT is in" + ] }, { "name": "masterEditionAccount", "isMut": true, "isSigner": false, - "desc": "MasterEdition2 of the original NFT" + "docs": [ + "MasterEdition2 of the original NFT" + ] }, { "name": "printEditionAccount", "isMut": true, "isSigner": false, - "desc": "Print Edition account of the NFT" + "docs": [ + "Print Edition account of the NFT" + ] }, { "name": "editionMarkerAccount", "isMut": true, "isSigner": false, - "desc": "Edition Marker PDA of the NFT" + "docs": [ + "Edition Marker PDA of the NFT" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program" + "docs": [ + "SPL Token Program" + ] } ], "args": [], @@ -2081,59 +2637,78 @@ "name": "escrow", "isMut": true, "isSigner": false, - "desc": "Escrow account" + "docs": [ + "Escrow account" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint account" + "docs": [ + "Mint account" + ] }, { "name": "tokenAccount", "isMut": false, "isSigner": false, - "desc": "Token account of the token" + "docs": [ + "Token account of the token" + ] }, { "name": "edition", "isMut": false, "isSigner": false, - "desc": "Edition account" + "docs": [ + "Edition account" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Wallet paying for the transaction and new account" + "docs": [ + "Wallet paying for the transaction and new account" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "authority", "isMut": false, "isSigner": true, - "desc": "Authority/creator of the escrow account", - "optional": true + "isOptional": true, + "docs": [ + "Authority/creator of the escrow account" + ] } ], "args": [], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 38 @@ -2146,49 +2721,65 @@ "name": "escrow", "isMut": true, "isSigner": false, - "desc": "Escrow account" + "docs": [ + "Escrow account" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint account" + "docs": [ + "Mint account" + ] }, { "name": "tokenAccount", "isMut": false, "isSigner": false, - "desc": "Token account" + "docs": [ + "Token account" + ] }, { "name": "edition", "isMut": false, "isSigner": false, - "desc": "Edition account" + "docs": [ + "Edition account" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Wallet paying for the transaction and new account" + "docs": [ + "Wallet paying for the transaction and new account" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] } ], "args": [], @@ -2204,80 +2795,106 @@ "name": "escrow", "isMut": false, "isSigner": false, - "desc": "Escrow account" + "docs": [ + "Escrow account" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Wallet paying for the transaction and new account" + "docs": [ + "Wallet paying for the transaction and new account" + ] }, { "name": "attributeMint", "isMut": false, "isSigner": false, - "desc": "Mint account for the new attribute" + "docs": [ + "Mint account for the new attribute" + ] }, { "name": "attributeSrc", "isMut": true, "isSigner": false, - "desc": "Token account source for the new attribute" + "docs": [ + "Token account source for the new attribute" + ] }, { "name": "attributeDst", "isMut": true, "isSigner": false, - "desc": "Token account, owned by TM, destination for the new attribute" + "docs": [ + "Token account, owned by TM, destination for the new attribute" + ] }, { "name": "escrowMint", "isMut": false, "isSigner": false, - "desc": "Mint account that the escrow is attached" + "docs": [ + "Mint account that the escrow is attached" + ] }, { "name": "escrowAccount", "isMut": false, "isSigner": false, - "desc": "Token account that holds the token the escrow is attached to" + "docs": [ + "Token account that holds the token the escrow is attached to" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "ataProgram", "isMut": false, "isSigner": false, - "desc": "Associated Token program" + "docs": [ + "Associated Token program" + ] }, { "name": "tokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "authority", "isMut": false, "isSigner": true, - "desc": "Authority/creator of the escrow account", - "optional": true + "isOptional": true, + "docs": [ + "Authority/creator of the escrow account" + ] } ], "args": [ @@ -2288,6 +2905,7 @@ } } ], + "legacyOptionalAccountsStrategy": true, "discriminant": { "type": "u8", "value": 40 @@ -2300,92 +2918,120 @@ "name": "authority", "isMut": true, "isSigner": true, - "desc": "Asset owner or Utility delegate" + "docs": [ + "Asset owner or Utility delegate" + ] }, { "name": "collectionMetadata", "isMut": true, "isSigner": false, - "desc": "Metadata of the Collection", - "optional": true + "isOptional": true, + "docs": [ + "Metadata of the Collection" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata (pda of ['metadata', program id, mint id])" + ] }, { "name": "edition", "isMut": true, "isSigner": false, - "desc": "Edition of the asset", - "optional": true + "isOptional": true, + "docs": [ + "Edition of the asset" + ] }, { "name": "mint", "isMut": true, "isSigner": false, - "desc": "Mint of token asset" + "docs": [ + "Mint of token asset" + ] }, { "name": "token", "isMut": true, "isSigner": false, - "desc": "Token account to close" + "docs": [ + "Token account to close" + ] }, { "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "Master edition account", - "optional": true + "isOptional": true, + "docs": [ + "Master edition account" + ] }, { "name": "masterEditionMint", "isMut": false, "isSigner": false, - "desc": "Master edition mint of the asset", - "optional": true + "isOptional": true, + "docs": [ + "Master edition mint of the asset" + ] }, { "name": "masterEditionToken", "isMut": false, "isSigner": false, - "desc": "Master edition token account", - "optional": true + "isOptional": true, + "docs": [ + "Master edition token account" + ] }, { "name": "editionMarker", "isMut": true, "isSigner": false, - "desc": "Edition marker account", - "optional": true + "isOptional": true, + "docs": [ + "Edition marker account" + ] }, { "name": "tokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account", - "optional": true + "isOptional": true, + "docs": [ + "Token record account" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program" + "docs": [ + "SPL Token Program" + ] } ], "args": [ @@ -2396,7 +3042,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 41 @@ -2409,56 +3054,74 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Unallocated metadata account with address as pda of ['metadata', program id, mint id]" + "docs": [ + "Unallocated metadata account with address as pda of ['metadata', program id, mint id]" + ] }, { "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "Unallocated edition account with address as pda of ['metadata', program id, mint, 'edition']", - "optional": true + "isOptional": true, + "docs": [ + "Unallocated edition account with address as pda of ['metadata', program id, mint, 'edition']" + ] }, { "name": "mint", "isMut": true, "isSigner": false, - "desc": "Mint of token asset" + "docs": [ + "Mint of token asset" + ] }, { "name": "authority", "isMut": false, "isSigner": true, - "desc": "Mint authority" + "docs": [ + "Mint authority" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": false, - "desc": "Update authority for the metadata account" + "docs": [ + "Update authority for the metadata account" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token program" + "docs": [ + "SPL Token program" + ] } ], "args": [ @@ -2469,7 +3132,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 42 @@ -2482,97 +3144,127 @@ "name": "token", "isMut": true, "isSigner": false, - "desc": "Token or Associated Token account" + "docs": [ + "Token or Associated Token account" + ] }, { "name": "tokenOwner", "isMut": false, "isSigner": false, - "desc": "Owner of the token account", - "optional": true + "isOptional": true, + "docs": [ + "Owner of the token account" + ] }, { "name": "metadata", "isMut": false, "isSigner": false, - "desc": "Metadata account (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata account (pda of ['metadata', program id, mint id])" + ] }, { "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "Master Edition account", - "optional": true + "isOptional": true, + "docs": [ + "Master Edition account" + ] }, { "name": "tokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account", - "optional": true + "isOptional": true, + "docs": [ + "Token record account" + ] }, { "name": "mint", "isMut": true, "isSigner": false, - "desc": "Mint of token asset" + "docs": [ + "Mint of token asset" + ] }, { "name": "authority", "isMut": false, "isSigner": true, - "desc": "(Mint or Update) authority" + "docs": [ + "(Mint or Update) authority" + ] }, { "name": "delegateRecord", "isMut": false, "isSigner": false, - "desc": "Metadata delegate record", - "optional": true + "isOptional": true, + "docs": [ + "Metadata delegate record" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token program" + "docs": [ + "SPL Token program" + ] }, { "name": "splAtaProgram", "isMut": false, "isSigner": false, - "desc": "SPL Associated Token Account program" + "docs": [ + "SPL Associated Token Account program" + ] }, { "name": "authorizationRulesProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules program", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules program" + ] }, { "name": "authorizationRules", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules account" + ] } ], "args": [ @@ -2583,7 +3275,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 43 @@ -2596,92 +3287,120 @@ "name": "delegateRecord", "isMut": true, "isSigner": false, - "desc": "Delegate record account", - "optional": true + "isOptional": true, + "docs": [ + "Delegate record account" + ] }, { "name": "delegate", "isMut": false, "isSigner": false, - "desc": "Owner of the delegated account" + "docs": [ + "Owner of the delegated account" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "masterEdition", "isMut": false, "isSigner": false, - "desc": "Master Edition account", - "optional": true + "isOptional": true, + "docs": [ + "Master Edition account" + ] }, { "name": "tokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account", - "optional": true + "isOptional": true, + "docs": [ + "Token record account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of metadata" + "docs": [ + "Mint of metadata" + ] }, { "name": "token", "isMut": true, "isSigner": false, - "desc": "Token account of mint", - "optional": true + "isOptional": true, + "docs": [ + "Token account of mint" + ] }, { "name": "authority", "isMut": false, "isSigner": true, - "desc": "Update authority or token owner" + "docs": [ + "Update authority or token owner" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System Program" + "docs": [ + "System Program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program", - "optional": true + "isOptional": true, + "docs": [ + "SPL Token Program" + ] }, { "name": "authorizationRulesProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules Program" + ] }, { "name": "authorizationRules", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules account" + ] } ], "args": [ @@ -2692,7 +3411,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 44 @@ -2705,92 +3423,120 @@ "name": "delegateRecord", "isMut": true, "isSigner": false, - "desc": "Delegate record account", - "optional": true + "isOptional": true, + "docs": [ + "Delegate record account" + ] }, { "name": "delegate", "isMut": false, "isSigner": false, - "desc": "Owner of the delegated account" + "docs": [ + "Owner of the delegated account" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "masterEdition", "isMut": false, "isSigner": false, - "desc": "Master Edition account", - "optional": true + "isOptional": true, + "docs": [ + "Master Edition account" + ] }, { "name": "tokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account", - "optional": true + "isOptional": true, + "docs": [ + "Token record account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of metadata" + "docs": [ + "Mint of metadata" + ] }, { "name": "token", "isMut": true, "isSigner": false, - "desc": "Token account of mint", - "optional": true + "isOptional": true, + "docs": [ + "Token account of mint" + ] }, { "name": "authority", "isMut": false, "isSigner": true, - "desc": "Update authority or token owner" + "docs": [ + "Update authority or token owner" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System Program" + "docs": [ + "System Program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program", - "optional": true + "isOptional": true, + "docs": [ + "SPL Token Program" + ] }, { "name": "authorizationRulesProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules Program" + ] }, { "name": "authorizationRules", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules account" + ] } ], "args": [ @@ -2801,7 +3547,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 45 @@ -2814,85 +3559,111 @@ "name": "authority", "isMut": false, "isSigner": true, - "desc": "Delegate or freeze authority" + "docs": [ + "Delegate or freeze authority" + ] }, { "name": "tokenOwner", "isMut": false, "isSigner": false, - "desc": "Token owner account", - "optional": true + "isOptional": true, + "docs": [ + "Token owner account" + ] }, { "name": "token", "isMut": true, "isSigner": false, - "desc": "Token account" + "docs": [ + "Token account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint account" + "docs": [ + "Mint account" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "edition", "isMut": false, "isSigner": false, - "desc": "Edition account", - "optional": true + "isOptional": true, + "docs": [ + "Edition account" + ] }, { "name": "tokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account", - "optional": true + "isOptional": true, + "docs": [ + "Token record account" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program", - "optional": true + "isOptional": true, + "docs": [ + "SPL Token Program" + ] }, { "name": "authorizationRulesProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules Program" + ] }, { "name": "authorizationRules", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules account" + ] } ], "args": [ @@ -2903,7 +3674,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 46 @@ -2916,85 +3686,111 @@ "name": "authority", "isMut": false, "isSigner": true, - "desc": "Delegate or freeze authority" + "docs": [ + "Delegate or freeze authority" + ] }, { "name": "tokenOwner", "isMut": false, "isSigner": false, - "desc": "Token owner account", - "optional": true + "isOptional": true, + "docs": [ + "Token owner account" + ] }, { "name": "token", "isMut": true, "isSigner": false, - "desc": "Token account" + "docs": [ + "Token account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint account" + "docs": [ + "Mint account" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "edition", "isMut": false, "isSigner": false, - "desc": "Edition account", - "optional": true + "isOptional": true, + "docs": [ + "Edition account" + ] }, { "name": "tokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account", - "optional": true + "isOptional": true, + "docs": [ + "Token record account" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program", - "optional": true + "isOptional": true, + "docs": [ + "SPL Token Program" + ] }, { "name": "authorizationRulesProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules Program" + ] }, { "name": "authorizationRules", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules account" + ] } ], "args": [ @@ -3005,7 +3801,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 47 @@ -3018,97 +3813,126 @@ "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "edition", "isMut": true, "isSigner": false, - "desc": "Edition account" + "docs": [ + "Edition account" + ] }, { "name": "token", "isMut": true, "isSigner": false, - "desc": "Token account" + "docs": [ + "Token account" + ] }, { "name": "tokenOwner", "isMut": false, "isSigner": false, - "desc": "Token account owner" + "docs": [ + "Token account owner" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint account" + "docs": [ + "Mint account" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "authority", "isMut": false, "isSigner": true, - "desc": "Update authority" + "docs": [ + "Update authority" + ] }, { "name": "collectionMetadata", "isMut": false, "isSigner": false, - "desc": "Collection metadata account" + "docs": [ + "Collection metadata account" + ] }, { "name": "delegateRecord", "isMut": false, "isSigner": false, - "desc": "Delegate record account" + "docs": [ + "Delegate record account" + ] }, { "name": "tokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account" + "docs": [ + "Token record account" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instruction sysvar account" + "docs": [ + "Instruction sysvar account" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program" + "docs": [ + "SPL Token Program" + ] }, { "name": "authorizationRulesProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules Program" + ] }, { "name": "authorizationRules", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules account" + ] } ], "args": [], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 48 @@ -3121,108 +3945,142 @@ "name": "token", "isMut": true, "isSigner": false, - "desc": "Token account" + "docs": [ + "Token account" + ] }, { "name": "tokenOwner", "isMut": false, "isSigner": false, - "desc": "Token account owner" + "docs": [ + "Token account owner" + ] }, { "name": "destination", "isMut": true, "isSigner": false, - "desc": "Destination token account" + "docs": [ + "Destination token account" + ] }, { "name": "destinationOwner", "isMut": false, "isSigner": false, - "desc": "Destination token account owner" + "docs": [ + "Destination token account owner" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint of token asset" + "docs": [ + "Mint of token asset" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata (pda of ['metadata', program id, mint id])" + "docs": [ + "Metadata (pda of ['metadata', program id, mint id])" + ] }, { "name": "edition", "isMut": false, "isSigner": false, - "desc": "Edition of token asset", - "optional": true + "isOptional": true, + "docs": [ + "Edition of token asset" + ] }, { "name": "ownerTokenRecord", "isMut": true, "isSigner": false, - "desc": "Owner token record account", - "optional": true + "isOptional": true, + "docs": [ + "Owner token record account" + ] }, { "name": "destinationTokenRecord", "isMut": true, "isSigner": false, - "desc": "Destination token record account", - "optional": true + "isOptional": true, + "docs": [ + "Destination token record account" + ] }, { "name": "authority", "isMut": false, "isSigner": true, - "desc": "Transfer authority (token owner or delegate)" + "docs": [ + "Transfer authority (token owner or delegate)" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System Program" + "docs": [ + "System Program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program" + "docs": [ + "SPL Token Program" + ] }, { "name": "splAtaProgram", "isMut": false, "isSigner": false, - "desc": "SPL Associated Token Account program" + "docs": [ + "SPL Associated Token Account program" + ] }, { "name": "authorizationRulesProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules Program" + ] }, { "name": "authorizationRules", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules account" + ] } ], "args": [ @@ -3233,7 +4091,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 49 @@ -3246,72 +4103,94 @@ "name": "authority", "isMut": false, "isSigner": true, - "desc": "Update authority or delegate" + "docs": [ + "Update authority or delegate" + ] }, { "name": "delegateRecord", "isMut": false, "isSigner": false, - "desc": "Delegate record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Delegate record PDA" + ] }, { "name": "token", "isMut": false, "isSigner": false, - "desc": "Token account", - "optional": true + "isOptional": true, + "docs": [ + "Token account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint account" + "docs": [ + "Mint account" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "edition", "isMut": false, "isSigner": false, - "desc": "Edition account", - "optional": true + "isOptional": true, + "docs": [ + "Edition account" + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "authorizationRulesProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules Program" + ] }, { "name": "authorizationRules", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules account" + ] } ], "args": [ @@ -3322,7 +4201,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 50 @@ -3335,79 +4213,103 @@ "name": "authority", "isMut": false, "isSigner": true, - "desc": "Token owner or delegate" + "docs": [ + "Token owner or delegate" + ] }, { "name": "delegateRecord", "isMut": true, "isSigner": false, - "desc": "Delegate record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Delegate record PDA" + ] }, { "name": "token", "isMut": true, "isSigner": false, - "desc": "Token account", - "optional": true + "isOptional": true, + "docs": [ + "Token account" + ] }, { "name": "mint", "isMut": false, "isSigner": false, - "desc": "Mint account" + "docs": [ + "Mint account" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "edition", "isMut": true, "isSigner": false, - "desc": "Edition account", - "optional": true + "isOptional": true, + "docs": [ + "Edition account" + ] }, { "name": "payer", "isMut": false, "isSigner": true, - "desc": "Payer" + "docs": [ + "Payer" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "SPL Token Program", - "optional": true + "isOptional": true, + "docs": [ + "SPL Token Program" + ] }, { "name": "authorizationRulesProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules Program" + ] }, { "name": "authorizationRules", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", - "optional": true + "isOptional": true, + "docs": [ + "Token Authorization Rules account" + ] } ], "args": [ @@ -3418,7 +4320,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 51 @@ -3431,53 +4332,69 @@ "name": "authority", "isMut": false, "isSigner": true, - "desc": "Creator to verify, collection update authority or delegate" + "docs": [ + "Creator to verify, collection update authority or delegate" + ] }, { "name": "delegateRecord", "isMut": false, "isSigner": false, - "desc": "Delegate record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Delegate record PDA" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection", - "optional": true + "isOptional": true, + "docs": [ + "Mint of the Collection" + ] }, { "name": "collectionMetadata", "isMut": true, "isSigner": false, - "desc": "Metadata Account of the Collection", - "optional": true + "isOptional": true, + "docs": [ + "Metadata Account of the Collection" + ] }, { "name": "collectionMasterEdition", "isMut": false, "isSigner": false, - "desc": "Master Edition Account of the Collection Token", - "optional": true + "isOptional": true, + "docs": [ + "Master Edition Account of the Collection Token" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] } ], "args": [ @@ -3488,7 +4405,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 52 @@ -3501,46 +4417,60 @@ "name": "authority", "isMut": false, "isSigner": true, - "desc": "Creator to verify, collection (or metadata if parent burned) update authority or delegate" + "docs": [ + "Creator to verify, collection (or metadata if parent burned) update authority or delegate" + ] }, { "name": "delegateRecord", "isMut": false, "isSigner": false, - "desc": "Delegate record PDA", - "optional": true + "isOptional": true, + "docs": [ + "Delegate record PDA" + ] }, { "name": "metadata", "isMut": true, "isSigner": false, - "desc": "Metadata account" + "docs": [ + "Metadata account" + ] }, { "name": "collectionMint", "isMut": false, "isSigner": false, - "desc": "Mint of the Collection", - "optional": true + "isOptional": true, + "docs": [ + "Mint of the Collection" + ] }, { "name": "collectionMetadata", "isMut": true, "isSigner": false, - "desc": "Metadata Account of the Collection", - "optional": true + "isOptional": true, + "docs": [ + "Metadata Account of the Collection" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] } ], "args": [ @@ -3551,7 +4481,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 53 @@ -3564,13 +4493,17 @@ "name": "authority", "isMut": false, "isSigner": true, - "desc": "Authority to collect fees" + "docs": [ + "Authority to collect fees" + ] }, { "name": "pdaAccount", "isMut": false, "isSigner": false, - "desc": "PDA to retrieve fees from" + "docs": [ + "PDA to retrieve fees from" + ] } ], "args": [], @@ -3586,110 +4519,146 @@ "name": "editionMetadata", "isMut": true, "isSigner": false, - "desc": "New Metadata key (pda of ['metadata', program id, mint id])" + "docs": [ + "New Metadata key (pda of ['metadata', program id, mint id])" + ] }, { "name": "edition", "isMut": true, "isSigner": false, - "desc": "New Edition (pda of ['metadata', program id, mint id, 'edition'])" + "docs": [ + "New Edition (pda of ['metadata', program id, mint id, 'edition'])" + ] }, { "name": "editionMint", "isMut": true, "isSigner": false, - "desc": "Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + "docs": [ + "Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY" + ] }, { "name": "editionTokenAccountOwner", "isMut": false, "isSigner": false, - "desc": "Owner of the token account of new token" + "docs": [ + "Owner of the token account of new token" + ] }, { "name": "editionTokenAccount", "isMut": true, "isSigner": false, - "desc": "Token account of new token" + "docs": [ + "Token account of new token" + ] }, { "name": "editionMintAuthority", "isMut": false, "isSigner": true, - "desc": "Mint authority of new mint" + "docs": [ + "Mint authority of new mint" + ] }, { "name": "editionTokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account", - "optional": true + "isOptional": true, + "docs": [ + "Token record account" + ] }, { "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'])" + "docs": [ + "Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'])" + ] }, { "name": "editionMarkerPda", "isMut": true, "isSigner": false, - "desc": "Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE)." + "docs": [ + "Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE)." + ] }, { "name": "payer", "isMut": true, "isSigner": true, - "desc": "payer" + "docs": [ + "payer" + ] }, { "name": "masterTokenAccountOwner", "isMut": false, "isSigner": true, - "desc": "owner of token account containing master token" + "docs": [ + "owner of token account containing master token" + ] }, { "name": "masterTokenAccount", "isMut": false, "isSigner": false, - "desc": "token account containing token from master metadata mint" + "docs": [ + "token account containing token from master metadata mint" + ] }, { "name": "masterMetadata", "isMut": false, "isSigner": false, - "desc": "Master record metadata account" + "docs": [ + "Master record metadata account" + ] }, { "name": "updateAuthority", "isMut": false, "isSigner": false, - "desc": "The update authority of the master edition." + "docs": [ + "The update authority of the master edition." + ] }, { "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "Token program" + "docs": [ + "Token program" + ] }, { "name": "splAtaProgram", "isMut": false, "isSigner": false, - "desc": "SPL Associated Token Account program" + "docs": [ + "SPL Associated Token Account program" + ] }, { "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "Instructions sysvar account" + "docs": [ + "Instructions sysvar account" + ] }, { "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "System program" + "docs": [ + "System program" + ] } ], "args": [ @@ -3700,7 +4669,6 @@ } } ], - "defaultOptionalAccounts": true, "discriminant": { "type": "u8", "value": 55 @@ -6758,7 +7726,7 @@ "metadata": { "origin": "shank", "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", - "binaryVersion": "0.0.11", - "libVersion": "0.0.11" + "binaryVersion": "0.2.0", + "libVersion": "0.2.0" } } \ No newline at end of file diff --git a/package.json b/package.json index 210d0afe..82938a00 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,8 @@ "programs:test": "RUST_LOG=error ./configs/program-scripts/test.sh", "programs:debug": "./configs/program-scripts/test.sh", "programs:clean": "rm -rf ./programs/.bin", + "clients:rust:test": "./configs/client-scripts/test-rust-client.sh", + "clients:js:test": "./configs/client-scripts/test-js-client.sh", "generate": "pnpm generate:idls && pnpm generate:clients", "generate:idls": "node ./configs/shank.cjs", "generate:clients": "node ./configs/kinobi.cjs", @@ -14,9 +16,9 @@ "validator:stop": "amman stop" }, "devDependencies": { - "@metaplex-foundation/kinobi": "^0.11.1", - "@metaplex-foundation/shank-js": "^0.1.0", "@metaplex-foundation/amman": "^0.12.1", + "@metaplex-foundation/kinobi": "^0.13.2", + "@metaplex-foundation/shank-js": "^0.1.0", "typescript": "^4.9.4" }, "packageManager": "pnpm@8.2.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 74752407..2922689b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,8 +5,8 @@ devDependencies: specifier: ^0.12.1 version: 0.12.1(typescript@4.9.5) '@metaplex-foundation/kinobi': - specifier: ^0.11.1 - version: 0.11.1 + specifier: ^0.13.2 + version: 0.13.2 '@metaplex-foundation/shank-js': specifier: ^0.1.0 version: 0.1.0 @@ -85,8 +85,8 @@ packages: resolution: {integrity: sha512-S9RulC2fFCFOQraz61bij+5YCHhSO9llJegK8c8Y6731fSi6snUSQJdCUqYS8AIgR0TKbQvdvgSyIIdbDFZbBA==} dev: true - /@metaplex-foundation/kinobi@0.11.1: - resolution: {integrity: sha512-khRJA/2I9Capfj9vMrsPTFOTHWN9H1YPv8EOyELXgLkLRVlVZH0z88Ge/zzl2JqCTZpz1IOWJU1XfJYwiDamjQ==} + /@metaplex-foundation/kinobi@0.13.2: + resolution: {integrity: sha512-y2T7lySApu2hD0hy/Y+oe5lGBHWxugZIfLrTn8LqAhFcxISMqEZj2yvcCYVSr2obIXKDeMEpHJsP43AULdd4mA==} dependencies: '@noble/hashes': 1.2.0 chalk: 4.1.2 diff --git a/programs/token-metadata/Cargo.lock b/programs/token-metadata/Cargo.lock index 10673c03..ac29ec72 100644 --- a/programs/token-metadata/Cargo.lock +++ b/programs/token-metadata/Cargo.lock @@ -2134,31 +2134,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "mpl-token-metadata" -version = "1.13.2" -dependencies = [ - "arrayref", - "async-trait", - "borsh 0.9.3", - "mpl-token-auth-rules", - "mpl-token-metadata-context-derive 0.3.0", - "mpl-utils 0.3.1", - "num-derive", - "num-traits", - "rmp-serde", - "rooster", - "serde", - "serde_with 1.14.0", - "shank 0.0.11", - "solana-program", - "solana-program-test", - "solana-sdk", - "spl-associated-token-account 1.1.3", - "spl-token 3.5.0", - "thiserror", -] - [[package]] name = "mpl-token-metadata-context-derive" version = "0.2.1" @@ -3033,7 +3008,7 @@ version = "0.1.0" source = "git+https://github.com/metaplex-foundation/rooster#e424745fd5abfe1442fd37f3814d1f908302499d" dependencies = [ "borsh 0.9.3", - "mpl-token-metadata 1.13.2-beta.1", + "mpl-token-metadata", "mpl-utils 0.3.1", "num-derive", "num-traits", @@ -3405,6 +3380,15 @@ dependencies = [ "shank_macro 0.0.11", ] +[[package]] +name = "shank" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bc647510fc0d94a936f7367a9e3e30edbefd410068747ce4d4084b19b5fdbab" +dependencies = [ + "shank_macro 0.2.1", +] + [[package]] name = "shank_macro" version = "0.0.10" @@ -3429,6 +3413,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "shank_macro" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9ec31d18dcca23f2270ccf69766a99156792da3aed050dc5713af0e778b4f2" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.32", + "shank_macro_impl 0.2.1", + "shank_render", + "syn 1.0.109", +] + [[package]] name = "shank_macro_impl" version = "0.0.10" @@ -3455,6 +3452,30 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "shank_macro_impl" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccaeb1359cf545507b5d18a637cc5cf192c7dcc8c737dff466013ca2d9e792c7" +dependencies = [ + "anyhow", + "proc-macro2 1.0.66", + "quote 1.0.32", + "serde", + "syn 1.0.109", +] + +[[package]] +name = "shank_render" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63f0b763c4c767dfb462a884d5f5b9b99fdd0a214c910d95792eb02a13b3d69" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.32", + "shank_macro_impl 0.2.1", +] + [[package]] name = "sharded-slab" version = "0.1.4" @@ -5044,6 +5065,31 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "token_metadata" +version = "1.13.2" +dependencies = [ + "arrayref", + "async-trait", + "borsh 0.9.3", + "mpl-token-auth-rules", + "mpl-token-metadata-context-derive 0.3.0", + "mpl-utils 0.3.1", + "num-derive", + "num-traits", + "rmp-serde", + "rooster", + "serde", + "serde_with 1.14.0", + "shank 0.2.1", + "solana-program", + "solana-program-test", + "solana-sdk", + "spl-associated-token-account 2.0.0", + "spl-token 4.0.0", + "thiserror", +] + [[package]] name = "tokio" version = "1.14.1" diff --git a/programs/token-metadata/program/Cargo.toml b/programs/token-metadata/program/Cargo.toml index ee0ae2f8..1c422c45 100644 --- a/programs/token-metadata/program/Cargo.toml +++ b/programs/token-metadata/program/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mpl-token-metadata" +name = "token_metadata" version = "1.13.2" description = "Metaplex Metadata" authors = ["Metaplex Developers "] @@ -23,7 +23,7 @@ num-derive = "0.3" num-traits = "0.2" serde = { version = "1.0.149", optional = true } serde_with = { version = "1.14.0", optional = true } -shank = "0.0.11" +shank = "0.2.0" solana-program = ">= 1.14.13, < 1.17" spl-token = { version = ">= 3.5.0, < 5.0", features = ["no-entrypoint"] } spl-associated-token-account = { version = ">= 1.1.3, < 3.0", features = ["no-entrypoint"] } diff --git a/programs/token-metadata/program/src/instruction/mod.rs b/programs/token-metadata/program/src/instruction/mod.rs index 9681e20c..c9e448ad 100644 --- a/programs/token-metadata/program/src/instruction/mod.rs +++ b/programs/token-metadata/program/src/instruction/mod.rs @@ -99,6 +99,7 @@ pub enum MetadataInstruction { #[account(13, name="system_program", desc="System program")] #[account(14, name="rent", desc="Rent info")] #[account(15, optional, writable, name="reservation_list", desc="Reservation List - If present, and you are on this list, you can get an edition number given by your position on the list.")] + #[legacy_optional_accounts_strategy] DeprecatedMintNewEditionFromMasterEditionViaPrintingToken, /// Allows updating the primary sale boolean on Metadata solely through owning an account @@ -197,6 +198,7 @@ pub enum MetadataInstruction { #[account(11, name="token_program", desc="Token program")] #[account(12, name="system_program", desc="System program")] #[account(13, optional, name="rent", desc="Rent info")] + #[legacy_optional_accounts_strategy] MintNewEditionFromMasterEditionViaToken(MintNewEditionFromMasterEditionViaTokenArgs), /// Converts the Master Edition V1 to a Master Edition V2, draining lamports from the two printing mints @@ -225,6 +227,7 @@ pub enum MetadataInstruction { #[account(14, name="token_vault_program", desc="Token vault program")] #[account(15, name="system_program", desc="System program")] #[account(16, optional, name="rent", desc="Rent info")] + #[legacy_optional_accounts_strategy] MintNewEditionFromMasterEditionViaVaultProxy(MintNewEditionFromMasterEditionViaTokenArgs), /// Puff a Metadata - make all of it's variable length fields (name/uri/symbol) a fixed length using a null character @@ -245,6 +248,7 @@ pub enum MetadataInstruction { #[account(4, name="update_authority", desc="update authority info")] #[account(5, name="system_program", desc="System program")] #[account(6, optional, name="rent", desc="Rent info")] + #[legacy_optional_accounts_strategy] CreateMetadataAccountV2, /// Register a Metadata as a Master Edition V2, which means Edition V2s can be minted. @@ -259,6 +263,7 @@ pub enum MetadataInstruction { #[account(6, name="token_program", desc="Token program")] #[account(7, name="system_program", desc="System program")] #[account(8, optional, name="rent", desc="Rent info")] + #[legacy_optional_accounts_strategy] CreateMasterEditionV3(CreateMasterEditionArgs), /// If a MetadataAccount Has a Collection allow the UpdateAuthority of the Collection to Verify the NFT Belongs in the Collection. @@ -269,6 +274,7 @@ pub enum MetadataInstruction { #[account(4, name="collection", desc="Metadata Account of the Collection")] #[account(5, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")] #[account(6, optional, name="collection_authority_record", desc="Collection Authority Record PDA")] + #[legacy_optional_accounts_strategy] VerifyCollection, /// Utilize or Use an NFT , burns the NFT and returns the lamports to the update authority if the use method is burn and its out of uses. @@ -286,6 +292,7 @@ pub enum MetadataInstruction { #[account(8, name="rent", desc="Rent info")] #[account(9, optional, writable, name="use_authority_record", desc="Use Authority Record PDA If present the program Assumes a delegated use authority")] #[account(10, optional, name="burner", desc="Program As Signer (Burner)")] + #[legacy_optional_accounts_strategy] Utilize(UtilizeArgs), /// Approve another account to call [utilize] on this NFT. @@ -300,6 +307,7 @@ pub enum MetadataInstruction { #[account(8, name="token_program", desc="Token program")] #[account(9, name="system_program", desc="System program")] #[account(10, optional, name="rent", desc="Rent info")] + #[legacy_optional_accounts_strategy] ApproveUseAuthority(ApproveUseAuthorityArgs), /// Revoke account to call [utilize] on this NFT. @@ -312,6 +320,7 @@ pub enum MetadataInstruction { #[account(6, name="token_program", desc="Token program")] #[account(7, name="system_program", desc="System program")] #[account(8, optional, name="rent", desc="Rent info")] + #[legacy_optional_accounts_strategy] RevokeUseAuthority, /// If a MetadataAccount Has a Collection allow an Authority of the Collection to unverify an NFT in a Collection. @@ -321,6 +330,7 @@ pub enum MetadataInstruction { #[account(3, name="collection", desc="Metadata Account of the Collection")] #[account(4, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")] #[account(5, optional, name="collection_authority_record", desc="Collection Authority Record PDA")] + #[legacy_optional_accounts_strategy] UnverifyCollection, /// Approve another account to verify NFTs belonging to a collection, [verify_collection] on the collection NFT. @@ -332,6 +342,7 @@ pub enum MetadataInstruction { #[account(5, name="mint", desc="Mint of Collection Metadata")] #[account(6, name="system_program", desc="System program")] #[account(7, optional, name="rent", desc="Rent info")] + #[legacy_optional_accounts_strategy] ApproveCollectionAuthority, /// Revoke account to call [verify_collection] on this NFT. @@ -352,6 +363,7 @@ pub enum MetadataInstruction { #[account(5, name="collection", desc="Metadata Account of the Collection")] #[account(6, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")] #[account(7, optional, name="collection_authority_record", desc="Collection Authority Record PDA")] + #[legacy_optional_accounts_strategy] SetAndVerifyCollection, /// Allow freezing of an NFT if this user is the delegate of the NFT. @@ -383,6 +395,7 @@ pub enum MetadataInstruction { #[account(4, writable, name="master_edition_account", desc="MasterEdition2 of the NFT")] #[account(5, name="spl_token_program", desc="SPL Token Program")] #[account(6, optional, writable, name="collection_metadata", desc="Metadata of the Collection")] + #[legacy_optional_accounts_strategy] BurnNft, /// Verify Collection V2, new in v1.3--supports Collection Details. @@ -394,6 +407,7 @@ pub enum MetadataInstruction { #[account(4, writable, name="collection", desc="Metadata Account of the Collection")] #[account(5, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")] #[account(6, optional, name="collection_authority_record", desc="Collection Authority Record PDA")] + #[legacy_optional_accounts_strategy] VerifySizedCollectionItem, /// Unverify Collection V2, new in v1.3--supports Collection Details. @@ -405,6 +419,7 @@ pub enum MetadataInstruction { #[account(4, writable, name="collection", desc="Metadata Account of the Collection")] #[account(5, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")] #[account(6, optional, name="collection_authority_record", desc="Collection Authority Record PDA")] + #[legacy_optional_accounts_strategy] UnverifySizedCollectionItem, // Set And Verify V2, new in v1.3--supports Collection Details. @@ -418,6 +433,7 @@ pub enum MetadataInstruction { #[account(5, writable, name="collection", desc="Metadata Account of the Collection")] #[account(6, writable, name="collection_master_edition_account", desc="MasterEdition2 Account of the Collection Token")] #[account(7, optional, name="collection_authority_record", desc="Collection Authority Record PDA")] + #[legacy_optional_accounts_strategy] SetAndVerifySizedCollectionItem, /// Create Metadata object. @@ -428,6 +444,7 @@ pub enum MetadataInstruction { #[account(4, name="update_authority", desc="update authority info")] #[account(5, name="system_program", desc="System program")] #[account(6, optional, name="rent", desc="Rent info")] + #[legacy_optional_accounts_strategy] CreateMetadataAccountV3(CreateMetadataAccountArgsV3), /// Set size of an existing collection. @@ -435,6 +452,7 @@ pub enum MetadataInstruction { #[account(1, signer, writable, name="collection_authority", desc="Collection Update authority")] #[account(2, name="collection_mint", desc="Mint of the Collection")] #[account(3, optional, name="collection_authority_record", desc="Collection Authority Record PDA")] + #[legacy_optional_accounts_strategy] SetCollectionSize(SetCollectionSizeArgs), /// Set the token standard of the asset. @@ -442,6 +460,7 @@ pub enum MetadataInstruction { #[account(1, signer, name="update_authority", desc="Metadata update authority")] #[account(2, name="mint", desc="Mint account")] #[account(3, optional, name="edition", desc="Edition account")] + #[legacy_optional_accounts_strategy] SetTokenStandard, /// Set size of an existing collection using CPI from the Bubblegum program. This is how @@ -451,6 +470,7 @@ pub enum MetadataInstruction { #[account(2, name="collection_mint", desc="Mint of the Collection")] #[account(3, signer, name="bubblegum_signer", desc="Signing PDA of Bubblegum program")] #[account(4, optional, name="collection_authority_record", desc="Collection Authority Record PDA")] + #[legacy_optional_accounts_strategy] BubblegumSetCollectionSize(SetCollectionSizeArgs), /// Completely burn a print edition NFT. @@ -476,6 +496,7 @@ pub enum MetadataInstruction { #[account(6, name="system_program", desc="System program")] #[account(7, name="sysvar_instructions", desc="Instructions sysvar account")] #[account(8, optional, signer, name="authority", desc="Authority/creator of the escrow account")] + #[legacy_optional_accounts_strategy] CreateEscrowAccount, /// Close the escrow account. @@ -503,6 +524,7 @@ pub enum MetadataInstruction { #[account(10, name="token_program", desc="Token program")] #[account(11, name="sysvar_instructions", desc="Instructions sysvar account")] #[account(12, optional, signer, name="authority", desc="Authority/creator of the escrow account")] + #[legacy_optional_accounts_strategy] TransferOutOfEscrow(TransferOutOfEscrowArgs), //---- New API @@ -547,7 +569,6 @@ pub enum MetadataInstruction { #[account(11, name="system_program", desc="System program")] #[account(12, name="sysvar_instructions", desc="Instructions sysvar account")] #[account(13, name="spl_token_program", desc="SPL Token Program")] - #[default_optional_accounts] Burn(BurnArgs), /// Creates the metadata and associated accounts for a new or existing mint account. @@ -567,7 +588,6 @@ pub enum MetadataInstruction { #[account(8, name="spl_token_program", desc="SPL Token program")] #[args(initialize_mint: bool)] #[args(update_authority_as_signer: bool)] - #[default_optional_accounts] Create(CreateArgs), /// Mints tokens from a mint account into the specified token account. @@ -591,7 +611,6 @@ pub enum MetadataInstruction { #[account(12, name="spl_ata_program", desc="SPL Associated Token Account program")] #[account(13, optional, name="authorization_rules_program", desc="Token Authorization Rules program")] #[account(14, optional, name="authorization_rules", desc="Token Authorization Rules account")] - #[default_optional_accounts] Mint(MintArgs), /// Creates a delegate for an asset. @@ -616,7 +635,6 @@ pub enum MetadataInstruction { #[account(11, optional, name="spl_token_program", desc="SPL Token Program")] #[account(12, optional, name="authorization_rules_program", desc="Token Authorization Rules Program")] #[account(13, optional, name="authorization_rules", desc="Token Authorization Rules account")] - #[default_optional_accounts] Delegate(DelegateArgs), /// Revokes a delegate. @@ -636,7 +654,6 @@ pub enum MetadataInstruction { #[account(11, optional, name="spl_token_program", desc="SPL Token Program")] #[account(12, optional, name="authorization_rules_program", desc="Token Authorization Rules Program")] #[account(13, optional, name="authorization_rules", desc="Token Authorization Rules account")] - #[default_optional_accounts] Revoke(RevokeArgs), /// Locks an asset. For non-programmable assets, this will also freeze the token account. @@ -656,7 +673,6 @@ pub enum MetadataInstruction { #[account(10, optional, name="spl_token_program", desc="SPL Token Program")] #[account(11, optional, name="authorization_rules_program", desc="Token Authorization Rules Program")] #[account(12, optional, name="authorization_rules", desc="Token Authorization Rules account")] - #[default_optional_accounts] Lock(LockArgs), /// Unlocks an asset. For non-programmable assets, this will also thaw the token account. @@ -676,7 +692,6 @@ pub enum MetadataInstruction { #[account(10, optional, name="spl_token_program", desc="SPL Token Program")] #[account(11, optional, name="authorization_rules_program", desc="Token Authorization Rules Program")] #[account(12, optional, name="authorization_rules", desc="Token Authorization Rules account")] - #[default_optional_accounts] Unlock(UnlockArgs), /// Migrates an asset to a ProgrammableAsset type. @@ -695,7 +710,6 @@ pub enum MetadataInstruction { #[account(12, name="spl_token_program", desc="SPL Token Program")] #[account(13, optional, name="authorization_rules_program", desc="Token Authorization Rules Program")] #[account(14, optional, name="authorization_rules", desc="Token Authorization Rules account")] - #[default_optional_accounts] Migrate, /// Transfer an asset. @@ -719,7 +733,6 @@ pub enum MetadataInstruction { #[account(14, name="spl_ata_program", desc="SPL Associated Token Account program")] #[account(15, optional, name="authorization_rules_program", desc="Token Authorization Rules Program")] #[account(16, optional, name="authorization_rules", desc="Token Authorization Rules account")] - #[default_optional_accounts] Transfer(TransferArgs), /// Updates the metadata of an asset. @@ -737,7 +750,6 @@ pub enum MetadataInstruction { #[account(8, name="sysvar_instructions", desc="Instructions sysvar account")] #[account(9, optional, name="authorization_rules_program", desc="Token Authorization Rules Program")] #[account(10, optional, name="authorization_rules", desc="Token Authorization Rules account")] - #[default_optional_accounts] Update(UpdateArgs), /// Uses an asset. @@ -758,7 +770,6 @@ pub enum MetadataInstruction { #[account(9, optional, name="spl_token_program", desc="SPL Token Program")] #[account(10, optional, name="authorization_rules_program", desc="Token Authorization Rules Program")] #[account(11, optional, name="authorization_rules", desc="Token Authorization Rules account")] - #[default_optional_accounts] Use(UseArgs), /// Verifies that an asset was created by a specific creator or belongs in an specified collection. @@ -773,7 +784,6 @@ pub enum MetadataInstruction { #[account(5, optional, name="collection_master_edition", desc="Master Edition Account of the Collection Token")] #[account(6, name="system_program", desc="System program")] #[account(7, name="sysvar_instructions", desc="Instructions sysvar account")] - #[default_optional_accounts] Verify(VerificationArgs), /// Unverifies that an asset was created by a specific creator or belongs in an specified collection. @@ -787,7 +797,6 @@ pub enum MetadataInstruction { #[account(4, optional, writable, name="collection_metadata", desc="Metadata Account of the Collection")] #[account(5, name="system_program", desc="System program")] #[account(6, name="sysvar_instructions", desc="Instructions sysvar account")] - #[default_optional_accounts] Unverify(VerificationArgs), /// Collect fees stored on PDA accounts. @@ -816,7 +825,6 @@ pub enum MetadataInstruction { #[account(16, name="sysvar_instructions", desc="Instructions sysvar account")] #[account(17, name="system_program", desc="System program")] #[args(initialize_mint: bool)] - #[default_optional_accounts] Print(PrintArgs), } diff --git a/programs/token-metadata/program/tests/approve_use_authority.rs b/programs/token-metadata/program/tests/approve_use_authority.rs index b19c7b14..7c1a8a0a 100644 --- a/programs/token-metadata/program/tests/approve_use_authority.rs +++ b/programs/token-metadata/program/tests/approve_use_authority.rs @@ -1,11 +1,6 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{ - error::MetadataError, - pda::find_use_authority_account, - state::{UseAuthorityRecord, UseMethod, Uses}, -}; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{ @@ -13,13 +8,18 @@ use solana_sdk::{ signature::{Keypair, Signer}, transaction::{Transaction, TransactionError}, }; +use token_metadata::{ + error::MetadataError, + pda::find_use_authority_account, + state::{UseAuthorityRecord, UseMethod, Uses}, +}; use utils::*; mod approve_use_authority { use borsh::BorshDeserialize; - use mpl_token_metadata::{pda::find_program_as_burner_account, state::Key}; use solana_program::program_pack::Pack; use spl_token::state::Account; + use token_metadata::{pda::find_program_as_burner_account, state::Key}; use super::*; #[tokio::test] @@ -52,8 +52,8 @@ mod approve_use_authority { find_use_authority_account(&test_meta.mint.pubkey(), &use_authority.pubkey()); let (burner, _) = find_program_as_burner_account(); - let ix = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -112,8 +112,8 @@ mod approve_use_authority { find_use_authority_account(&test_meta.mint.pubkey(), &use_authority.pubkey()); let (burner, _) = find_program_as_burner_account(); - let ix = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -176,8 +176,8 @@ mod approve_use_authority { println!("{:?}", Account::unpack_from_slice(&thing.data).unwrap()); - let ix = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -245,8 +245,8 @@ mod approve_use_authority { println!("{:?}", Account::unpack_from_slice(&thing.data).unwrap()); - let ix = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -266,8 +266,8 @@ mod approve_use_authority { ); context.banks_client.process_transaction(tx).await.unwrap(); - let ix2 = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let ix2 = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -335,8 +335,8 @@ mod approve_use_authority { println!("{:?}", Account::unpack_from_slice(&thing.data).unwrap()); - let ix = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -395,8 +395,8 @@ mod approve_use_authority { let (burner, _) = find_program_as_burner_account(); - let ix = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), wrong_owner.pubkey(), diff --git a/programs/token-metadata/program/tests/bump_seed_migration.rs b/programs/token-metadata/program/tests/bump_seed_migration.rs index d7f92eb6..730260e1 100644 --- a/programs/token-metadata/program/tests/bump_seed_migration.rs +++ b/programs/token-metadata/program/tests/bump_seed_migration.rs @@ -2,7 +2,13 @@ pub mod utils; use borsh::{BorshDeserialize, BorshSerialize}; -use mpl_token_metadata::{ +use solana_program_test::*; +use solana_sdk::{ + account::{Account, AccountSharedData}, + signature::{Keypair, Signer}, + transaction::Transaction, +}; +use token_metadata::{ pda::{find_program_as_burner_account, find_use_authority_account}, state::{ Key as MetadataKey, UseAuthorityRecord, UseMethod, Uses, MAX_NAME_LENGTH, @@ -10,12 +16,6 @@ use mpl_token_metadata::{ }, utils::puffed_out_string, }; -use solana_program_test::*; -use solana_sdk::{ - account::{Account, AccountSharedData}, - signature::{Keypair, Signer}, - transaction::Transaction, -}; use utils::*; mod bump_seed_migration { @@ -64,7 +64,7 @@ mod bump_seed_migration { let mut account = Account { lamports: 1113600, data: vec![], - owner: mpl_token_metadata::ID, + owner: token_metadata::ID, executable: false, rent_epoch: 1, }; @@ -77,8 +77,8 @@ mod bump_seed_migration { .await .unwrap(); let (burner, _) = find_program_as_burner_account(); - let utilize_with_use_authority = mpl_token_metadata::instruction::utilize( - mpl_token_metadata::ID, + let utilize_with_use_authority = token_metadata::instruction::utilize( + token_metadata::ID, test_metadata.pubkey, test_metadata.token.pubkey(), test_metadata.mint.pubkey(), diff --git a/programs/token-metadata/program/tests/burn.rs b/programs/token-metadata/program/tests/burn.rs index c970cfb9..de0faec2 100644 --- a/programs/token-metadata/program/tests/burn.rs +++ b/programs/token-metadata/program/tests/burn.rs @@ -2,14 +2,6 @@ pub mod utils; -use mpl_token_metadata::{ - error::MetadataError, - instruction::{builders::BurnBuilder, BurnArgs, DelegateArgs, InstructionBuilder}, - state::{ - Collection, CollectionDetails, Creator, Key, MasterEditionV2 as ProgramMasterEditionV2, - Metadata as ProgramMetadata, PrintSupply, TokenMetadataAccount, TokenStandard, - }, -}; use num_traits::FromPrimitive; use solana_program::{program_pack::Pack, pubkey::Pubkey}; use solana_program_test::*; @@ -21,11 +13,19 @@ use solana_sdk::{ }; use spl_associated_token_account::get_associated_token_address; use spl_token::state::Account as TokenAccount; +use token_metadata::{ + error::MetadataError, + instruction::{builders::BurnBuilder, BurnArgs, DelegateArgs, InstructionBuilder}, + state::{ + Collection, CollectionDetails, Creator, Key, MasterEditionV2 as ProgramMasterEditionV2, + Metadata as ProgramMetadata, PrintSupply, TokenMetadataAccount, TokenStandard, + }, +}; use utils::*; mod pnft { - use mpl_token_metadata::{instruction::TransferArgs, pda::find_token_record_account}; use solana_program::system_instruction; + use token_metadata::{instruction::TransferArgs, pda::find_token_record_account}; use super::*; @@ -559,7 +559,7 @@ mod pnft { &fake_token_record.pubkey(), 100_000_000, 80, - &mpl_token_metadata::ID, + &token_metadata::ID, ); let args = BurnArgs::V1 { amount: 1 }; @@ -1000,7 +1000,7 @@ mod pnft { } mod pnft_edition { - use mpl_token_metadata::pda::find_token_record_account; + use token_metadata::pda::find_token_record_account; use super::*; @@ -3600,8 +3600,8 @@ mod nft_edition { } mod fungible { - use mpl_token_metadata::instruction::TransferArgs; use solana_program::native_token::LAMPORTS_PER_SOL; + use token_metadata::instruction::TransferArgs; use super::*; diff --git a/programs/token-metadata/program/tests/burn_edition_nft.rs b/programs/token-metadata/program/tests/burn_edition_nft.rs index 2986864e..9947b537 100644 --- a/programs/token-metadata/program/tests/burn_edition_nft.rs +++ b/programs/token-metadata/program/tests/burn_edition_nft.rs @@ -7,13 +7,13 @@ use solana_sdk::{instruction::InstructionError, signer::Signer, transaction::Tra use utils::*; mod burn_edition_nft { - use mpl_token_metadata::{ - error::MetadataError, - state::{MasterEditionV2 as ProgramMasterEdition, TokenMetadataAccount}, - }; use solana_program::pubkey::Pubkey; use solana_sdk::signature::Keypair; use spl_associated_token_account::get_associated_token_address; + use token_metadata::{ + error::MetadataError, + state::{MasterEditionV2 as ProgramMasterEdition, TokenMetadataAccount}, + }; use super::*; diff --git a/programs/token-metadata/program/tests/burn_nft.rs b/programs/token-metadata/program/tests/burn_nft.rs index e978bf29..26df549e 100644 --- a/programs/token-metadata/program/tests/burn_nft.rs +++ b/programs/token-metadata/program/tests/burn_nft.rs @@ -1,20 +1,20 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::state::Metadata as ProgramMetadata; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{instruction::InstructionError, signer::Signer, transaction::TransactionError}; +use token_metadata::state::Metadata as ProgramMetadata; use utils::*; mod burn_nft { use borsh::BorshDeserialize; - use mpl_token_metadata::{ + use solana_program::pubkey::Pubkey; + use solana_sdk::signature::Keypair; + use token_metadata::{ error::MetadataError, state::{Collection, CollectionDetails}, }; - use solana_program::pubkey::Pubkey; - use solana_sdk::signature::Keypair; use super::*; #[tokio::test] diff --git a/programs/token-metadata/program/tests/collection_migrations.rs b/programs/token-metadata/program/tests/collection_migrations.rs index aeef020d..d95c2046 100644 --- a/programs/token-metadata/program/tests/collection_migrations.rs +++ b/programs/token-metadata/program/tests/collection_migrations.rs @@ -16,12 +16,12 @@ use utils::*; // * Unsized -> Sized // * Unsized -> Unsized mod collection_migrations { - use mpl_token_metadata::{ + use solana_sdk::transaction::Transaction; + use token_metadata::{ error::MetadataError, pda::find_collection_authority_account, state::{Metadata as TmMetadata, TokenMetadataAccount}, }; - use solana_sdk::transaction::Transaction; use super::*; @@ -1185,8 +1185,8 @@ mod collection_migrations { &delegate_keypair.pubkey(), ); - let ix1 = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix1 = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, delegate_keypair.pubkey(), update_authority, diff --git a/programs/token-metadata/program/tests/collection_sizes.rs b/programs/token-metadata/program/tests/collection_sizes.rs index fa7b0e0c..990484e8 100644 --- a/programs/token-metadata/program/tests/collection_sizes.rs +++ b/programs/token-metadata/program/tests/collection_sizes.rs @@ -1,16 +1,16 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::state::Metadata as ProgramMetadata; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{instruction::InstructionError, transaction::TransactionError}; +use token_metadata::state::Metadata as ProgramMetadata; use utils::*; mod unsized_collection_handlers { - use mpl_token_metadata::{error::MetadataError, state::Collection}; use solana_sdk::{signature::Keypair, signer::Signer}; + use token_metadata::{error::MetadataError, state::Collection}; use super::*; @@ -247,8 +247,8 @@ mod unsized_collection_handlers { } mod sized_collection_handlers { - use mpl_token_metadata::{error::MetadataError, state::Collection}; use solana_sdk::{signature::Keypair, signer::Signer}; + use token_metadata::{error::MetadataError, state::Collection}; use super::*; #[tokio::test] @@ -449,8 +449,8 @@ mod sized_collection_handlers { mod size_tracking { use borsh::BorshDeserialize; - use mpl_token_metadata::state::{Collection, CollectionDetails}; use solana_sdk::{signature::Keypair, signer::Signer}; + use token_metadata::state::{Collection, CollectionDetails}; use super::*; #[tokio::test] diff --git a/programs/token-metadata/program/tests/create.rs b/programs/token-metadata/program/tests/create.rs index 589f4772..8f64499b 100644 --- a/programs/token-metadata/program/tests/create.rs +++ b/programs/token-metadata/program/tests/create.rs @@ -1,11 +1,6 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{ - state::{Key, MAX_NAME_LENGTH, MAX_SYMBOL_LENGTH, MAX_URI_LENGTH}, - utils::puffed_out_string, - ID, -}; use num_traits::FromPrimitive; use solana_program::pubkey::Pubkey; use solana_program_test::*; @@ -14,6 +9,11 @@ use solana_sdk::{ signature::{Keypair, Signer}, transaction::{Transaction, TransactionError}, }; +use token_metadata::{ + state::{Key, MAX_NAME_LENGTH, MAX_SYMBOL_LENGTH, MAX_URI_LENGTH}, + utils::puffed_out_string, + ID, +}; use utils::*; mod create { @@ -21,7 +21,7 @@ mod create { use std::str::FromStr; use borsh::BorshDeserialize; - use mpl_token_metadata::{ + use token_metadata::{ error::MetadataError, instruction::{builders::CreateBuilder, CreateArgs, InstructionBuilder}, state::{ diff --git a/programs/token-metadata/program/tests/create_master_edition.rs b/programs/token-metadata/program/tests/create_master_edition.rs index 2da0a147..e8cfe598 100644 --- a/programs/token-metadata/program/tests/create_master_edition.rs +++ b/programs/token-metadata/program/tests/create_master_edition.rs @@ -1,7 +1,6 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{error::MetadataError, instruction, state::Key, ID}; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{ @@ -9,6 +8,7 @@ use solana_sdk::{ signature::{Keypair, Signer}, transaction::{Transaction, TransactionError}, }; +use token_metadata::{error::MetadataError, instruction, state::Key, ID}; use utils::*; mod create_master_edition { diff --git a/programs/token-metadata/program/tests/create_metadata_account.rs b/programs/token-metadata/program/tests/create_metadata_account.rs index 44a02969..7ce65542 100644 --- a/programs/token-metadata/program/tests/create_metadata_account.rs +++ b/programs/token-metadata/program/tests/create_metadata_account.rs @@ -1,7 +1,15 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{ +use num_traits::FromPrimitive; +use solana_program::{pubkey::Pubkey, system_instruction::assign}; +use solana_program_test::*; +use solana_sdk::{ + instruction::InstructionError, + signature::{Keypair, Signer}, + transaction::{Transaction, TransactionError}, +}; +use token_metadata::{ error::MetadataError, instruction, state::{ @@ -11,19 +19,11 @@ use mpl_token_metadata::{ utils::{puffed_out_string, BUBBLEGUM_PROGRAM_ADDRESS}, ID, }; -use num_traits::FromPrimitive; -use solana_program::{pubkey::Pubkey, system_instruction::assign}; -use solana_program_test::*; -use solana_sdk::{ - instruction::InstructionError, - signature::{Keypair, Signer}, - transaction::{Transaction, TransactionError}, -}; use utils::*; mod create_meta_accounts { - use mpl_token_metadata::state::TokenStandard; + use token_metadata::state::TokenStandard; use super::*; #[tokio::test] diff --git a/programs/token-metadata/program/tests/delegate.rs b/programs/token-metadata/program/tests/delegate.rs index 40025f59..0c15e61a 100644 --- a/programs/token-metadata/program/tests/delegate.rs +++ b/programs/token-metadata/program/tests/delegate.rs @@ -13,7 +13,10 @@ mod delegate { use borsh::BorshDeserialize; use mpl_token_auth_rules::error::RuleSetError; - use mpl_token_metadata::{ + use num_traits::FromPrimitive; + use solana_program::{program_option::COption, program_pack::Pack}; + use spl_token::state::Account; + use token_metadata::{ error::MetadataError, instruction::{DelegateArgs, MetadataDelegateRole}, pda::{find_metadata_delegate_record_account, find_token_record_account}, @@ -22,9 +25,6 @@ mod delegate { TokenStandard, }, }; - use num_traits::FromPrimitive; - use solana_program::{program_option::COption, program_pack::Pack}; - use spl_token::state::Account; use super::*; @@ -462,7 +462,7 @@ mod delegate { #[tokio::test] async fn store_rule_set_revision_on_delegate() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.set_compute_max_units(400_000); let mut context = program_test.start_with_context().await; @@ -608,7 +608,7 @@ mod delegate { #[tokio::test] async fn delegate_not_in_allow_list() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.set_compute_max_units(400_000); let mut context = program_test.start_with_context().await; diff --git a/programs/token-metadata/program/tests/escrow.rs b/programs/token-metadata/program/tests/escrow.rs index 735ae071..18706ca5 100644 --- a/programs/token-metadata/program/tests/escrow.rs +++ b/programs/token-metadata/program/tests/escrow.rs @@ -7,8 +7,8 @@ use utils::*; mod escrow { use borsh::BorshDeserialize; - use mpl_token_metadata::{escrow::find_escrow_account, state::EscrowAuthority}; use solana_program::program_pack::Pack; + use token_metadata::{escrow::find_escrow_account, state::EscrowAuthority}; use super::*; @@ -47,8 +47,8 @@ mod escrow { ); print!("\nEscrow Address: {:#?}\n", escrow_address); - let ix0 = mpl_token_metadata::escrow::create_escrow_account( - mpl_token_metadata::ID, + let ix0 = token_metadata::escrow::create_escrow_account( + token_metadata::ID, escrow_address.0, parent_test_metadata.pubkey, parent_test_metadata.mint.pubkey(), @@ -70,7 +70,7 @@ mod escrow { let _metadata = parent_test_metadata.get_data(&mut context).await; let escrow_account = get_account(&mut context, &escrow_address.0).await; - let escrow: mpl_token_metadata::state::TokenOwnedEscrow = + let escrow: token_metadata::state::TokenOwnedEscrow = BorshDeserialize::deserialize(&mut &escrow_account.data[..]).unwrap(); print!("\n{:#?}\n", escrow); @@ -139,7 +139,7 @@ mod escrow { let _metadata = attribute_test_metadata.get_data(&mut context).await; let escrow_account = get_account(&mut context, &escrow_address.0).await; - let escrow: mpl_token_metadata::state::TokenOwnedEscrow = + let escrow: token_metadata::state::TokenOwnedEscrow = BorshDeserialize::deserialize(&mut &escrow_account.data[..]).unwrap(); print!("\n{:#?}\n", escrow); @@ -166,8 +166,8 @@ mod escrow { &attribute_test_metadata.mint.pubkey(), ); - let ix2 = mpl_token_metadata::escrow::transfer_out_of_escrow( - mpl_token_metadata::ID, + let ix2 = token_metadata::escrow::transfer_out_of_escrow( + token_metadata::ID, escrow_address.0, parent_test_metadata.pubkey, context.payer.pubkey(), @@ -199,7 +199,7 @@ mod escrow { let _metadata = attribute_test_metadata.get_data(&mut context).await; let escrow_account = get_account(&mut context, &escrow_address.0).await; - let escrow: mpl_token_metadata::state::TokenOwnedEscrow = + let escrow: token_metadata::state::TokenOwnedEscrow = BorshDeserialize::deserialize(&mut &escrow_account.data[..]).unwrap(); print!("\n{:#?}\n", escrow); @@ -248,8 +248,8 @@ mod escrow { ); print!("\nEscrow Address: {:#?}\n", escrow_address); - let ix0 = mpl_token_metadata::escrow::create_escrow_account( - mpl_token_metadata::ID, + let ix0 = token_metadata::escrow::create_escrow_account( + token_metadata::ID, escrow_address.0, parent_test_metadata.pubkey, parent_test_metadata.mint.pubkey(), @@ -271,7 +271,7 @@ mod escrow { let _metadata = parent_test_metadata.get_data(&mut context).await; let escrow_account = get_account(&mut context, &escrow_address.0).await; - let escrow: mpl_token_metadata::state::TokenOwnedEscrow = + let escrow: token_metadata::state::TokenOwnedEscrow = BorshDeserialize::deserialize(&mut &escrow_account.data[..]).unwrap(); print!("\n{:#?}\n", escrow); @@ -332,7 +332,7 @@ mod escrow { let _metadata = attribute_test_metadata.get_data(&mut context).await; let escrow_account = get_account(&mut context, &escrow_address.0).await; - let escrow: mpl_token_metadata::state::TokenOwnedEscrow = + let escrow: token_metadata::state::TokenOwnedEscrow = BorshDeserialize::deserialize(&mut &escrow_account.data[..]).unwrap(); context.banks_client.process_transaction(tx1).await.unwrap(); @@ -361,8 +361,8 @@ mod escrow { &attribute_test_metadata.mint.pubkey(), ); - let ix2 = mpl_token_metadata::escrow::transfer_out_of_escrow( - mpl_token_metadata::ID, + let ix2 = token_metadata::escrow::transfer_out_of_escrow( + token_metadata::ID, escrow_address.0, parent_test_metadata.pubkey, context.payer.pubkey(), @@ -375,8 +375,8 @@ mod escrow { 1, ); - let ix3 = mpl_token_metadata::escrow::transfer_out_of_escrow( - mpl_token_metadata::ID, + let ix3 = token_metadata::escrow::transfer_out_of_escrow( + token_metadata::ID, escrow_address.0, parent_test_metadata.pubkey, context.payer.pubkey(), diff --git a/programs/token-metadata/program/tests/fees.rs b/programs/token-metadata/program/tests/fees.rs index 0f62c2b0..c227f24e 100644 --- a/programs/token-metadata/program/tests/fees.rs +++ b/programs/token-metadata/program/tests/fees.rs @@ -5,16 +5,16 @@ use solana_program_test::*; use utils::*; mod fees { - use mpl_token_metadata::{ - instruction::{collect_fees, BurnArgs, UpdateArgs}, - state::{CREATE_FEE, FEE_FLAG_CLEARED, METADATA_FEE_FLAG_INDEX}, - }; use solana_program::{native_token::LAMPORTS_PER_SOL, pubkey::Pubkey}; use solana_sdk::{ signature::{read_keypair_file, Keypair}, signer::Signer, transaction::Transaction, }; + use token_metadata::{ + instruction::{collect_fees, BurnArgs, UpdateArgs}, + state::{CREATE_FEE, FEE_FLAG_CLEARED, METADATA_FEE_FLAG_INDEX}, + }; use super::*; @@ -36,7 +36,7 @@ mod fees { let mut nft = DigitalAsset::new(); nft.create( &mut context, - mpl_token_metadata::state::TokenStandard::NonFungible, + token_metadata::state::TokenStandard::NonFungible, None, ) .await @@ -55,7 +55,7 @@ mod fees { let mut nft = DigitalAsset::new(); nft.create( &mut context, - mpl_token_metadata::state::TokenStandard::NonFungible, + token_metadata::state::TokenStandard::NonFungible, None, ) .await @@ -103,7 +103,7 @@ mod fees { let mut nft = DigitalAsset::new(); nft.create( &mut context, - mpl_token_metadata::state::TokenStandard::NonFungible, + token_metadata::state::TokenStandard::NonFungible, None, ) .await @@ -163,7 +163,7 @@ mod fees { let mut nft = DigitalAsset::new(); nft.create_and_mint( &mut context, - mpl_token_metadata::state::TokenStandard::NonFungible, + token_metadata::state::TokenStandard::NonFungible, None, None, 1, diff --git a/programs/token-metadata/program/tests/freeze_authority.rs b/programs/token-metadata/program/tests/freeze_authority.rs index d42da938..5c61b427 100644 --- a/programs/token-metadata/program/tests/freeze_authority.rs +++ b/programs/token-metadata/program/tests/freeze_authority.rs @@ -1,10 +1,10 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::error::MetadataError; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{instruction::InstructionError, transaction::TransactionError}; +use token_metadata::error::MetadataError; use utils::*; #[tokio::test] diff --git a/programs/token-metadata/program/tests/freeze_delegated_account.rs b/programs/token-metadata/program/tests/freeze_delegated_account.rs index 219917e8..b6c3ca76 100644 --- a/programs/token-metadata/program/tests/freeze_delegated_account.rs +++ b/programs/token-metadata/program/tests/freeze_delegated_account.rs @@ -1,7 +1,6 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::error::MetadataError; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{ @@ -9,6 +8,7 @@ use solana_sdk::{ signature::{Keypair, Signer}, transaction::{Transaction, TransactionError}, }; +use token_metadata::error::MetadataError; use utils::*; mod freeze_delegated { @@ -66,8 +66,8 @@ mod freeze_delegated { // delegate freezes token let freeze_tx = Transaction::new_signed_with_payer( - &[mpl_token_metadata::instruction::freeze_delegated_account( - mpl_token_metadata::ID, + &[token_metadata::instruction::freeze_delegated_account( + token_metadata::ID, delegate.pubkey(), test_metadata.token.pubkey(), test_master_edition.pubkey, @@ -143,8 +143,8 @@ mod freeze_delegated { .unwrap(); // delegate freezes token - let freeze_ix = mpl_token_metadata::instruction::freeze_delegated_account( - mpl_token_metadata::ID, + let freeze_ix = token_metadata::instruction::freeze_delegated_account( + token_metadata::ID, delegate.pubkey(), test_metadata.token.pubkey(), test_metadata.pubkey, @@ -197,8 +197,8 @@ mod freeze_delegated { .unwrap(); // attempt to freeze delegated account - let freeze_ix = mpl_token_metadata::instruction::freeze_delegated_account( - mpl_token_metadata::ID, + let freeze_ix = token_metadata::instruction::freeze_delegated_account( + token_metadata::ID, context.payer.pubkey(), test_metadata.token.pubkey(), test_master_edition.pubkey, @@ -263,8 +263,8 @@ mod freeze_delegated { .unwrap(); // delegate freezes token - let freeze_ix = mpl_token_metadata::instruction::freeze_delegated_account( - mpl_token_metadata::ID, + let freeze_ix = token_metadata::instruction::freeze_delegated_account( + token_metadata::ID, delegate.pubkey(), test_metadata.token.pubkey(), test_master_edition.pubkey, @@ -278,8 +278,8 @@ mod freeze_delegated { ); // owner attempt to thaw account - let thaw_ix = mpl_token_metadata::instruction::thaw_delegated_account( - mpl_token_metadata::ID, + let thaw_ix = token_metadata::instruction::thaw_delegated_account( + token_metadata::ID, context.payer.pubkey(), test_metadata.token.pubkey(), test_master_edition.pubkey, diff --git a/programs/token-metadata/program/tests/lock.rs b/programs/token-metadata/program/tests/lock.rs index 72b6c686..5fcc28e5 100644 --- a/programs/token-metadata/program/tests/lock.rs +++ b/programs/token-metadata/program/tests/lock.rs @@ -8,12 +8,6 @@ use utils::*; mod lock { use borsh::BorshDeserialize; - use mpl_token_metadata::{ - error::MetadataError, - instruction::DelegateArgs, - pda::find_token_record_account, - state::{TokenRecord, TokenStandard, TokenState}, - }; use solana_program::{program_pack::Pack, pubkey::Pubkey}; use solana_sdk::{ instruction::InstructionError, @@ -21,6 +15,12 @@ mod lock { transaction::TransactionError, }; use spl_token::state::Account; + use token_metadata::{ + error::MetadataError, + instruction::DelegateArgs, + pda::find_token_record_account, + state::{TokenRecord, TokenStandard, TokenState}, + }; use super::*; diff --git a/programs/token-metadata/program/tests/mint.rs b/programs/token-metadata/program/tests/mint.rs index 315fa327..3c1795a1 100644 --- a/programs/token-metadata/program/tests/mint.rs +++ b/programs/token-metadata/program/tests/mint.rs @@ -7,10 +7,10 @@ use utils::*; mod mint { - use mpl_token_metadata::{error::MetadataError, state::TokenStandard}; use num_traits::FromPrimitive; use solana_program::program_pack::Pack; use spl_token::state::Account; + use token_metadata::{error::MetadataError, state::TokenStandard}; use super::*; diff --git a/programs/token-metadata/program/tests/mint_new_edition_from_master_edition_via_token.rs b/programs/token-metadata/program/tests/mint_new_edition_from_master_edition_via_token.rs index 4b8190c1..0410797e 100644 --- a/programs/token-metadata/program/tests/mint_new_edition_from_master_edition_via_token.rs +++ b/programs/token-metadata/program/tests/mint_new_edition_from_master_edition_via_token.rs @@ -2,12 +2,6 @@ pub mod utils; use borsh::BorshSerialize; -use mpl_token_metadata::{ - error::MetadataError, - instruction, - state::{Collection, Creator, Key, MAX_MASTER_EDITION_LEN}, - ID, -}; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{ @@ -16,6 +10,12 @@ use solana_sdk::{ signature::{Keypair, Signer}, transaction::{Transaction, TransactionError}, }; +use token_metadata::{ + error::MetadataError, + instruction, + state::{Collection, Creator, Key, MAX_MASTER_EDITION_LEN}, + ID, +}; use utils::*; // NOTE: these tests depend on the token-vault program having been compiled @@ -117,7 +117,7 @@ mod mint_new_edition_from_master_edition_via_token { let tx = Transaction::new_signed_with_payer( [instruction::sign_metadata( - mpl_token_metadata::ID, + token_metadata::ID, test_metadata.pubkey, creator_pub, )] diff --git a/programs/token-metadata/program/tests/print.rs b/programs/token-metadata/program/tests/print.rs index e215eca6..c3832716 100644 --- a/programs/token-metadata/program/tests/print.rs +++ b/programs/token-metadata/program/tests/print.rs @@ -2,21 +2,21 @@ pub mod utils; use borsh::BorshSerialize; -use mpl_token_metadata::{ - error::MetadataError, - state::{Key, MAX_MASTER_EDITION_LEN}, -}; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{ account::AccountSharedData, instruction::InstructionError, transaction::TransactionError, }; +use token_metadata::{ + error::MetadataError, + state::{Key, MAX_MASTER_EDITION_LEN}, +}; use utils::*; mod print { use borsh::BorshDeserialize; - use mpl_token_metadata::state::{PrintSupply, TokenStandard}; + use token_metadata::state::{PrintSupply, TokenStandard}; use super::*; #[tokio::test] @@ -56,11 +56,9 @@ mod print { .await .unwrap() .unwrap(); - let edition_metadata: mpl_token_metadata::state::Metadata = - mpl_token_metadata::state::Metadata::deserialize( - &mut &edition_metadata_account.data[..], - ) - .unwrap(); + let edition_metadata: token_metadata::state::Metadata = + token_metadata::state::Metadata::deserialize(&mut &edition_metadata_account.data[..]) + .unwrap(); assert_eq!( edition_metadata.token_standard, Some(TokenStandard::ProgrammableNonFungibleEdition) diff --git a/programs/token-metadata/program/tests/process_legacy_instruction.rs b/programs/token-metadata/program/tests/process_legacy_instruction.rs index a39e7743..9dd92ca4 100644 --- a/programs/token-metadata/program/tests/process_legacy_instruction.rs +++ b/programs/token-metadata/program/tests/process_legacy_instruction.rs @@ -14,13 +14,13 @@ use utils::*; mod process_legacy_instruction { use borsh::BorshDeserialize; - use mpl_token_metadata::{ + use solana_program::program_pack::Pack; + use spl_token::state::Account; + use token_metadata::{ error::MetadataError, instruction::{sign_metadata, DelegateArgs}, state::{Metadata, TokenStandard}, }; - use solana_program::program_pack::Pack; - use spl_token::state::Account; use super::*; @@ -64,7 +64,7 @@ mod process_legacy_instruction { // we won't need to use this keypair let creator = Keypair::new(); - let sign_ix = sign_metadata(mpl_token_metadata::ID, asset.metadata, creator.pubkey()); + let sign_ix = sign_metadata(token_metadata::ID, asset.metadata, creator.pubkey()); let sign_tx = Transaction::new_signed_with_payer( &[sign_ix], Some(&context.payer.pubkey()), @@ -137,8 +137,8 @@ mod process_legacy_instruction { // tries to use a "legacy" thaw instruction with a pNFT - let thaw_ix = mpl_token_metadata::instruction::thaw_delegated_account( - mpl_token_metadata::ID, + let thaw_ix = token_metadata::instruction::thaw_delegated_account( + token_metadata::ID, delegate_pubkey, asset.token.unwrap(), asset.edition.unwrap(), @@ -169,8 +169,8 @@ mod process_legacy_instruction { // tries to freeze (this would normally fail at the SPL Token level, but we // should get our custom error first) - let freeze_ix = mpl_token_metadata::instruction::freeze_delegated_account( - mpl_token_metadata::ID, + let freeze_ix = token_metadata::instruction::freeze_delegated_account( + token_metadata::ID, delegate_pubkey, asset.token.unwrap(), asset.edition.unwrap(), diff --git a/programs/token-metadata/program/tests/revoke.rs b/programs/token-metadata/program/tests/revoke.rs index 5b572631..5e92168f 100644 --- a/programs/token-metadata/program/tests/revoke.rs +++ b/programs/token-metadata/program/tests/revoke.rs @@ -12,7 +12,11 @@ use utils::*; mod revoke { use borsh::{BorshDeserialize, BorshSerialize}; - use mpl_token_metadata::{ + use num_traits::FromPrimitive; + use solana_program::{program_option::COption, program_pack::Pack}; + use solana_sdk::account::{Account as SdkAccount, AccountSharedData}; + use spl_token::state::Account; + use token_metadata::{ error::MetadataError, instruction::{DelegateArgs, MetadataDelegateRole, RevokeArgs}, pda::{find_metadata_delegate_record_account, find_token_record_account}, @@ -21,10 +25,6 @@ mod revoke { TOKEN_RECORD_SIZE, }, }; - use num_traits::FromPrimitive; - use solana_program::{program_option::COption, program_pack::Pack}; - use solana_sdk::account::{Account as SdkAccount, AccountSharedData}; - use spl_token::state::Account; use super::*; @@ -337,7 +337,7 @@ mod revoke { #[tokio::test] async fn clear_rule_set_revision_on_delegate() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.set_compute_max_units(400_000); let mut context = program_test.start_with_context().await; @@ -480,7 +480,7 @@ mod revoke { let record_account = SdkAccount { lamports: pda.lamports, data, - owner: mpl_token_metadata::ID, + owner: token_metadata::ID, executable: false, rent_epoch: pda.rent_epoch, }; diff --git a/programs/token-metadata/program/tests/revoke_use_authority.rs b/programs/token-metadata/program/tests/revoke_use_authority.rs index e2952559..5c35acaf 100644 --- a/programs/token-metadata/program/tests/revoke_use_authority.rs +++ b/programs/token-metadata/program/tests/revoke_use_authority.rs @@ -1,19 +1,19 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{ - pda::find_use_authority_account, - state::{UseAuthorityRecord, UseMethod, Uses}, -}; use solana_program_test::*; use solana_sdk::{ signature::{Keypair, Signer}, transaction::Transaction, }; +use token_metadata::{ + pda::find_use_authority_account, + state::{UseAuthorityRecord, UseMethod, Uses}, +}; use utils::*; mod revoke_use_authority { use borsh::BorshDeserialize; - use mpl_token_metadata::pda::find_program_as_burner_account; + use token_metadata::pda::find_program_as_burner_account; use super::*; #[tokio::test] @@ -46,8 +46,8 @@ mod revoke_use_authority { find_use_authority_account(&test_meta.mint.pubkey(), &use_authority.pubkey()); let (burner, _) = find_program_as_burner_account(); - let approve_ix = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let approve_ix = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -78,8 +78,8 @@ mod revoke_use_authority { assert_eq!(record_acct.allowed_uses, 1); - let revoke_ix = mpl_token_metadata::instruction::revoke_use_authority( - mpl_token_metadata::ID, + let revoke_ix = token_metadata::instruction::revoke_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), diff --git a/programs/token-metadata/program/tests/seralization.rs b/programs/token-metadata/program/tests/seralization.rs index 421e4584..a207aa07 100644 --- a/programs/token-metadata/program/tests/seralization.rs +++ b/programs/token-metadata/program/tests/seralization.rs @@ -1,11 +1,11 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{ +use solana_program_test::*; +use token_metadata::{ state::{Key, MasterEditionV2 as ProgramME, MAX_MASTER_EDITION_LEN}, utils::try_from_slice_checked, }; -use solana_program_test::*; use utils::*; mod serialization { diff --git a/programs/token-metadata/program/tests/set_collection_size.rs b/programs/token-metadata/program/tests/set_collection_size.rs index 11eb8fa2..53c1215a 100644 --- a/programs/token-metadata/program/tests/set_collection_size.rs +++ b/programs/token-metadata/program/tests/set_collection_size.rs @@ -2,16 +2,6 @@ pub mod utils; use borsh::{BorshDeserialize, BorshSerialize}; -use mpl_token_metadata::{ - error::MetadataError, - instruction::{ - approve_collection_authority, set_collection_size, MetadataInstruction, - SetCollectionSizeArgs, - }, - pda::find_collection_authority_account, - state::{CollectionDetails, Metadata as ProgramMetadata}, - ID as PROGRAM_ID, -}; use num_traits::FromPrimitive; use solana_program::{ instruction::{AccountMeta, Instruction}, @@ -24,11 +14,21 @@ use solana_sdk::{ signer::Signer, transaction::{Transaction, TransactionError}, }; +use token_metadata::{ + error::MetadataError, + instruction::{ + approve_collection_authority, set_collection_size, MetadataInstruction, + SetCollectionSizeArgs, + }, + pda::find_collection_authority_account, + state::{CollectionDetails, Metadata as ProgramMetadata}, + ID as PROGRAM_ID, +}; use utils::*; mod set_collection_size { - use mpl_token_metadata::pda::find_collection_authority_account; + use token_metadata::pda::find_collection_authority_account; use super::*; diff --git a/programs/token-metadata/program/tests/set_token_standard.rs b/programs/token-metadata/program/tests/set_token_standard.rs index 69f4a094..b369f40c 100644 --- a/programs/token-metadata/program/tests/set_token_standard.rs +++ b/programs/token-metadata/program/tests/set_token_standard.rs @@ -2,12 +2,6 @@ pub mod utils; use borsh::{BorshDeserialize, BorshSerialize}; -use mpl_token_metadata::{ - error::MetadataError, - instruction::set_token_standard, - state::{Metadata as ProgramMetadata, TokenStandard}, - ID as PROGRAM_ID, -}; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{ @@ -17,6 +11,12 @@ use solana_sdk::{ signer::Signer, transaction::{Transaction, TransactionError}, }; +use token_metadata::{ + error::MetadataError, + instruction::set_token_standard, + state::{Metadata as ProgramMetadata, TokenStandard}, + ID as PROGRAM_ID, +}; use utils::*; #[tokio::test] diff --git a/programs/token-metadata/program/tests/sign_metadata.rs b/programs/token-metadata/program/tests/sign_metadata.rs index 65752234..3be82c0f 100644 --- a/programs/token-metadata/program/tests/sign_metadata.rs +++ b/programs/token-metadata/program/tests/sign_metadata.rs @@ -8,11 +8,11 @@ pub mod utils; mod sign_metadata { - use mpl_token_metadata::{ + use solana_sdk::transaction::Transaction; + use token_metadata::{ instruction::{remove_creator_verification, sign_metadata}, state::Creator, }; - use solana_sdk::transaction::Transaction; use super::*; @@ -48,7 +48,7 @@ mod sign_metadata { ) .await .unwrap(); - let sign_ix = sign_metadata(mpl_token_metadata::ID, test_meta.pubkey, creator.pubkey()); + let sign_ix = sign_metadata(token_metadata::ID, test_meta.pubkey, creator.pubkey()); let sign_tx = Transaction::new_signed_with_payer( &[sign_ix], Some(&context.payer.pubkey()), @@ -64,7 +64,7 @@ mod sign_metadata { assert!(after_sign.data.creators.unwrap()[1].verified); let remove_ix = - remove_creator_verification(mpl_token_metadata::ID, test_meta.pubkey, creator.pubkey()); + remove_creator_verification(token_metadata::ID, test_meta.pubkey, creator.pubkey()); let remove_tx = Transaction::new_signed_with_payer( &[remove_ix], Some(&context.payer.pubkey()), diff --git a/programs/token-metadata/program/tests/transfer.rs b/programs/token-metadata/program/tests/transfer.rs index 6d1460bb..ef6077ef 100644 --- a/programs/token-metadata/program/tests/transfer.rs +++ b/programs/token-metadata/program/tests/transfer.rs @@ -3,10 +3,6 @@ pub mod utils; use mpl_token_auth_rules::payload::{PayloadType, SeedsVec}; -use mpl_token_metadata::{ - instruction::TransferArgs, - state::{PayloadKey, TokenStandard}, -}; use num_traits::FromPrimitive; use rooster::instruction::DelegateArgs as RoosterDelegateArgs; use solana_program::{native_token::LAMPORTS_PER_SOL, program_pack::Pack, pubkey::Pubkey}; @@ -17,19 +13,23 @@ use solana_sdk::{ transaction::TransactionError, }; use spl_associated_token_account::get_associated_token_address; +use token_metadata::{ + instruction::TransferArgs, + state::{PayloadKey, TokenStandard}, +}; use utils::*; mod standard_transfer { - use mpl_token_metadata::{ - error::MetadataError, - instruction::{DelegateArgs, TransferArgs}, - state::TokenStandard, - }; use solana_program::{ native_token::LAMPORTS_PER_SOL, program_option::COption, program_pack::Pack, pubkey::Pubkey, }; use spl_associated_token_account::get_associated_token_address; + use token_metadata::{ + error::MetadataError, + instruction::{DelegateArgs, TransferArgs}, + state::TokenStandard, + }; use super::*; @@ -368,15 +368,15 @@ mod standard_transfer { mod auth_rules_transfer { use borsh::BorshDeserialize; use mpl_token_auth_rules::payload::Payload; - use mpl_token_metadata::{ + use solana_sdk::transaction::Transaction; + use spl_associated_token_account::instruction::create_associated_token_account; + use spl_token::instruction::approve; + use token_metadata::{ error::MetadataError, instruction::DelegateArgs, pda::find_token_record_account, state::{ProgrammableConfig, TokenDelegateRole, TokenRecord}, }; - use solana_sdk::transaction::Transaction; - use spl_associated_token_account::instruction::create_associated_token_account; - use spl_token::instruction::approve; use super::*; @@ -384,7 +384,7 @@ mod auth_rules_transfer { async fn wallet_to_wallet() { // Wallet to wallet should skip royalties rules, for now. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let mut context = program_test.start_with_context().await; @@ -500,7 +500,7 @@ mod auth_rules_transfer { #[tokio::test] async fn fail_transfer_zero_amount() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let mut context = program_test.start_with_context().await; @@ -561,17 +561,13 @@ mod auth_rules_transfer { let err = nft.transfer(params).await.unwrap_err(); - assert_custom_error_ix!( - 2, - err, - mpl_token_metadata::error::MetadataError::InvalidAmount - ); + assert_custom_error_ix!(2, err, token_metadata::error::MetadataError::InvalidAmount); } #[tokio::test] async fn owner_transfer() { // Tests an owner transferring from a system wallet to a PDA and vice versa. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.add_program("rooster", rooster::ID, None); let mut context = program_test.start_with_context().await; @@ -711,7 +707,7 @@ mod auth_rules_transfer { #[tokio::test] async fn transfer_delegate() { // Tests a delegate transferring from a system wallet to a PDA and vice versa. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.add_program("rooster", rooster::ID, None); program_test.set_compute_max_units(400_000); @@ -878,7 +874,7 @@ mod auth_rules_transfer { #[tokio::test] async fn transfer_delegate_wrong_metadata() { // Tests a delegate transferring from a system wallet to a PDA and vice versa. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.add_program("rooster", rooster::ID, None); program_test.set_compute_max_units(400_000); @@ -981,7 +977,7 @@ mod auth_rules_transfer { #[tokio::test] async fn sale_delegate() { // Tests a delegate transferring from a system wallet to a PDA and vice versa. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.add_program("rooster", rooster::ID, None); program_test.set_compute_max_units(400_000); @@ -1162,7 +1158,7 @@ mod auth_rules_transfer { // the delegate to close the account. This test ensures that the CloseAuthority // is cleared after the transfer along with the rest of the delegate data. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.add_program("rooster", rooster::ID, None); program_test.set_compute_max_units(400_000); @@ -1276,7 +1272,7 @@ mod auth_rules_transfer { async fn no_auth_rules_skips_validation() { // Tests a pNFT with a rule_set of None skipping validation and still being // transferred correctly. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let mut context = program_test.start_with_context().await; @@ -1326,7 +1322,7 @@ mod auth_rules_transfer { #[tokio::test] async fn locked_transfer_delegate() { // tests a LockedTransfer delegate, which works similarly to a Transfer delegate - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.add_program("rooster", rooster::ID, None); program_test.set_compute_max_units(400_000); @@ -1454,7 +1450,7 @@ mod auth_rules_transfer { #[tokio::test] async fn escrowless_delegate_transfer() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.add_program("rooster", rooster::ID, None); let mut context = program_test.start_with_context().await; @@ -1558,7 +1554,7 @@ mod auth_rules_transfer { // We ensure that the destination owner is linked to the destination token account // so that people cannot get around auth rules by passing in an owner that is in an allowlist // but doesn't actually correspond to the token account. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let mut context = program_test.start_with_context().await; @@ -1650,7 +1646,7 @@ mod auth_rules_transfer { #[tokio::test] async fn invalid_close_authority_fails() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let mut context = program_test.start_with_context().await; @@ -1726,7 +1722,7 @@ mod auth_rules_transfer { #[tokio::test] async fn clear_delegate_after_holder_transfer() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.add_program("rooster", rooster::ID, None); let mut context = program_test.start_with_context().await; @@ -1819,7 +1815,7 @@ mod auth_rules_transfer { #[tokio::test] async fn delegate_on_destination_transfer_fails() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let mut context = program_test.start_with_context().await; diff --git a/programs/token-metadata/program/tests/unlock.rs b/programs/token-metadata/program/tests/unlock.rs index 2a095f4e..8c2ccaf2 100644 --- a/programs/token-metadata/program/tests/unlock.rs +++ b/programs/token-metadata/program/tests/unlock.rs @@ -7,14 +7,14 @@ use utils::*; mod utility { use borsh::BorshDeserialize; - use mpl_token_metadata::{ + use solana_program::{program_pack::Pack, pubkey::Pubkey}; + use solana_sdk::signature::{Keypair, Signer}; + use spl_token::state::Account; + use token_metadata::{ instruction::DelegateArgs, pda::find_token_record_account, state::{TokenDelegateRole, TokenRecord, TokenStandard, TokenState}, }; - use solana_program::{program_pack::Pack, pubkey::Pubkey}; - use solana_sdk::signature::{Keypair, Signer}; - use spl_token::state::Account; use super::*; diff --git a/programs/token-metadata/program/tests/unverify.rs b/programs/token-metadata/program/tests/unverify.rs index 5dfe0d25..03b5c87c 100644 --- a/programs/token-metadata/program/tests/unverify.rs +++ b/programs/token-metadata/program/tests/unverify.rs @@ -2,12 +2,6 @@ pub mod utils; -use mpl_token_metadata::{ - error::MetadataError, - instruction::{BurnArgs, DelegateArgs, MetadataDelegateRole, UpdateArgs, VerificationArgs}, - pda::{find_metadata_delegate_record_account, find_token_record_account}, - state::{Collection, CollectionDetails, Creator, TokenStandard}, -}; use num_traits::FromPrimitive; use solana_program::native_token::LAMPORTS_PER_SOL; use solana_program_test::*; @@ -15,6 +9,12 @@ use solana_sdk::{ instruction::InstructionError, signature::Keypair, signer::Signer, transaction::TransactionError, }; +use token_metadata::{ + error::MetadataError, + instruction::{BurnArgs, DelegateArgs, MetadataDelegateRole, UpdateArgs, VerificationArgs}, + pda::{find_metadata_delegate_record_account, find_token_record_account}, + state::{Collection, CollectionDetails, Creator, TokenStandard}, +}; use utils::*; mod unverify_creator { diff --git a/programs/token-metadata/program/tests/update.rs b/programs/token-metadata/program/tests/update.rs index 1c5ca3d2..245f12eb 100644 --- a/programs/token-metadata/program/tests/update.rs +++ b/programs/token-metadata/program/tests/update.rs @@ -1,16 +1,6 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{ - error::MetadataError, - instruction::{ - builders::UpdateBuilder, CollectionToggle, DelegateArgs, InstructionBuilder, RuleSetToggle, - TransferArgs, UpdateArgs, - }, - state::{Collection, Creator, Data, ProgrammableConfig, TokenStandard}, - state::{MAX_NAME_LENGTH, MAX_SYMBOL_LENGTH, MAX_URI_LENGTH}, - utils::puffed_out_string, -}; use num_traits::FromPrimitive; use solana_program::{program_pack::Pack, pubkey::Pubkey}; use solana_program_test::*; @@ -21,6 +11,16 @@ use solana_sdk::{ transaction::{Transaction, TransactionError}, }; use spl_token::state::Account; +use token_metadata::{ + error::MetadataError, + instruction::{ + builders::UpdateBuilder, CollectionToggle, DelegateArgs, InstructionBuilder, RuleSetToggle, + TransferArgs, UpdateArgs, + }, + state::{Collection, Creator, Data, ProgrammableConfig, TokenStandard}, + state::{MAX_NAME_LENGTH, MAX_SYMBOL_LENGTH, MAX_URI_LENGTH}, + utils::puffed_out_string, +}; use utils::{DigitalAsset, *}; mod update { @@ -404,7 +404,7 @@ mod update { #[tokio::test] async fn success_update_pfnt_config_by_update_authority() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -477,7 +477,7 @@ mod update { #[tokio::test] async fn fail_update_pfnt_config_no_token_in_account() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -596,7 +596,7 @@ mod update { #[tokio::test] async fn fail_update_pfnt_config_token_and_mint_mismatch() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -696,7 +696,7 @@ mod update { #[tokio::test] async fn fail_update_pfnt_config_metadata_and_mint_mismatch() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -796,7 +796,7 @@ mod update { #[tokio::test] async fn fail_update_pfnt_config_by_update_authority_wrong_edition() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -932,7 +932,7 @@ mod update { delegate_args: DelegateArgs, update_args: UpdateArgs, ) { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -1070,7 +1070,7 @@ mod update { } async fn fail_update_by_items_delegate(delegate_args: DelegateArgs) { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -1143,7 +1143,7 @@ mod update { #[tokio::test] async fn fail_update_by_items_persistent_delegate() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -1213,7 +1213,7 @@ mod update { #[tokio::test] async fn fail_update_by_holder() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -2169,7 +2169,7 @@ mod update { async fn success_update_prog_config_by_collections_prog_config_delegate( update_args: UpdateArgs, ) { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -2271,7 +2271,7 @@ mod update { #[tokio::test] async fn success_update_data_by_collections_data_delegate() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -2402,7 +2402,7 @@ mod update { #[tokio::test] async fn fail_update_prog_config_by_col_prog_config_delegate_wrong_v1_args() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -2514,7 +2514,7 @@ mod update { #[tokio::test] async fn fail_update_by_col_prog_config_delegate_using_new_collection_in_v1_args() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -2632,7 +2632,7 @@ mod update { // prevent it from being updated again because it either won't be owned by the mpl-token-auth rules // program or it won't be a valid rule set to call validate on. // We relax the check a little to let users fix invalid rule sets. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -2788,7 +2788,7 @@ mod update { #[tokio::test] async fn cannot_update_rule_set_when_delegate_set() { // When a delegate is set, the rule set cannot be updated. - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); program_test.set_compute_max_units(400_000); let context = &mut program_test.start_with_context().await; @@ -3340,7 +3340,7 @@ mod update { #[tokio::test] async fn fail_update_data_by_collections_collection_delegate() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; @@ -3486,7 +3486,7 @@ mod update { #[tokio::test] async fn fail_update_prog_config_by_collections_collection_delegate() { - let mut program_test = ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None); + let mut program_test = ProgramTest::new("token_metadata", token_metadata::ID, None); program_test.add_program("mpl_token_auth_rules", mpl_token_auth_rules::ID, None); let context = &mut program_test.start_with_context().await; diff --git a/programs/token-metadata/program/tests/update_metadata_account_v2.rs b/programs/token-metadata/program/tests/update_metadata_account_v2.rs index 70fba11a..d7f2bcb6 100644 --- a/programs/token-metadata/program/tests/update_metadata_account_v2.rs +++ b/programs/token-metadata/program/tests/update_metadata_account_v2.rs @@ -1,7 +1,14 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{ +use num_traits::FromPrimitive; +use solana_program_test::*; +use solana_sdk::{ + instruction::InstructionError, + signature::{Keypair, Signer}, + transaction::{Transaction, TransactionError}, +}; +use token_metadata::{ error::MetadataError, instruction, state::{ @@ -11,17 +18,10 @@ use mpl_token_metadata::{ utils::puffed_out_string, ID, }; -use num_traits::FromPrimitive; -use solana_program_test::*; -use solana_sdk::{ - instruction::InstructionError, - signature::{Keypair, Signer}, - transaction::{Transaction, TransactionError}, -}; use utils::*; mod update_metadata_account_v2 { - use mpl_token_metadata::pda::find_collection_authority_account; + use token_metadata::pda::find_collection_authority_account; use super::*; @@ -173,8 +173,8 @@ mod update_metadata_account_v2 { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), update_authority, @@ -493,8 +493,8 @@ mod update_metadata_account_v2 { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), update_authority, diff --git a/programs/token-metadata/program/tests/update_primary_sale_happened_via_token.rs b/programs/token-metadata/program/tests/update_primary_sale_happened_via_token.rs index 36437643..916c0791 100644 --- a/programs/token-metadata/program/tests/update_primary_sale_happened_via_token.rs +++ b/programs/token-metadata/program/tests/update_primary_sale_happened_via_token.rs @@ -1,13 +1,6 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{ - error::MetadataError, - instruction, - state::{Key, MAX_NAME_LENGTH, MAX_SYMBOL_LENGTH, MAX_URI_LENGTH}, - utils::puffed_out_string, - ID, -}; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{ @@ -15,11 +8,18 @@ use solana_sdk::{ signature::{Keypair, Signer}, transaction::{Transaction, TransactionError}, }; +use token_metadata::{ + error::MetadataError, + instruction, + state::{Key, MAX_NAME_LENGTH, MAX_SYMBOL_LENGTH, MAX_URI_LENGTH}, + utils::puffed_out_string, + ID, +}; use utils::*; mod update_primary_sale_happened_via_token { - use mpl_token_metadata::state::Creator; + use token_metadata::state::Creator; use super::*; #[tokio::test] diff --git a/programs/token-metadata/program/tests/uses.rs b/programs/token-metadata/program/tests/uses.rs index c9648f2d..6c24a0e9 100644 --- a/programs/token-metadata/program/tests/uses.rs +++ b/programs/token-metadata/program/tests/uses.rs @@ -1,7 +1,6 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::state::{UseMethod, Uses}; use num_traits::FromPrimitive; use solana_program_test::*; use solana_sdk::{ @@ -9,18 +8,19 @@ use solana_sdk::{ signature::Signer, transaction::{Transaction, TransactionError}, }; +use token_metadata::state::{UseMethod, Uses}; use utils::*; mod uses { use borsh::BorshDeserialize; - use mpl_token_metadata::{ + use solana_program::program_pack::Pack; + use solana_sdk::signature::Keypair; + use spl_token::state::Account; + use token_metadata::{ error::MetadataError, pda::{find_program_as_burner_account, find_use_authority_account}, state::{Key, UseAuthorityRecord}, }; - use solana_program::program_pack::Pack; - use solana_sdk::signature::Keypair; - use spl_token::state::Account; use super::*; @@ -52,8 +52,8 @@ mod uses { .await .unwrap(); - let ix = mpl_token_metadata::instruction::utilize( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::utilize( + token_metadata::ID, test_metadata.pubkey, test_metadata.token.pubkey(), test_metadata.mint.pubkey(), @@ -112,8 +112,8 @@ mod uses { .await .unwrap(); - let ix = mpl_token_metadata::instruction::utilize( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::utilize( + token_metadata::ID, test_metadata.pubkey, test_metadata.token.pubkey(), test_metadata.mint.pubkey(), @@ -168,8 +168,8 @@ mod uses { .await .unwrap(); - let ix = mpl_token_metadata::instruction::utilize( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::utilize( + token_metadata::ID, test_metadata.pubkey, test_metadata.token.pubkey(), test_metadata.mint.pubkey(), @@ -229,8 +229,8 @@ mod uses { find_use_authority_account(&test_metadata.mint.pubkey(), &use_authority.pubkey()); let (burner, _) = find_program_as_burner_account(); - let add_use_authority = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let add_use_authority = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -255,8 +255,8 @@ mod uses { .await .unwrap(); - let utilize_with_use_authority = mpl_token_metadata::instruction::utilize( - mpl_token_metadata::ID, + let utilize_with_use_authority = token_metadata::instruction::utilize( + token_metadata::ID, test_metadata.pubkey, test_metadata.token.pubkey(), test_metadata.mint.pubkey(), @@ -315,8 +315,8 @@ mod uses { find_use_authority_account(&test_metadata.mint.pubkey(), &use_authority.pubkey()); let (burner, _) = find_program_as_burner_account(); - let add_use_authority = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let add_use_authority = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -341,8 +341,8 @@ mod uses { .await .unwrap(); - let utilize_with_use_authority = mpl_token_metadata::instruction::utilize( - mpl_token_metadata::ID, + let utilize_with_use_authority = token_metadata::instruction::utilize( + token_metadata::ID, test_metadata.pubkey, test_metadata.token.pubkey(), test_metadata.mint.pubkey(), @@ -366,8 +366,8 @@ mod uses { .await .unwrap(); - let revoke_use_authority = mpl_token_metadata::instruction::revoke_use_authority( - mpl_token_metadata::ID, + let revoke_use_authority = token_metadata::instruction::revoke_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -390,8 +390,8 @@ mod uses { .unwrap(); context.warp_to_slot(100).unwrap(); - let utilize_with_use_authority_fail = mpl_token_metadata::instruction::utilize( - mpl_token_metadata::ID, + let utilize_with_use_authority_fail = token_metadata::instruction::utilize( + token_metadata::ID, test_metadata.pubkey, test_metadata.token.pubkey(), test_metadata.mint.pubkey(), @@ -453,8 +453,8 @@ mod uses { let (record, _) = find_use_authority_account(&test_meta.mint.pubkey(), &use_authority.pubkey()); let (burner, _) = find_program_as_burner_account(); - let approveix = mpl_token_metadata::instruction::approve_use_authority( - mpl_token_metadata::ID, + let approveix = token_metadata::instruction::approve_use_authority( + token_metadata::ID, record, use_authority.pubkey(), context.payer.pubkey(), @@ -482,8 +482,8 @@ mod uses { assert_eq!(record_acct.key, Key::UseAuthorityRecord); assert_eq!(record_acct.allowed_uses, 1); - let utilize_ix = mpl_token_metadata::instruction::utilize( - mpl_token_metadata::ID, + let utilize_ix = token_metadata::instruction::utilize( + token_metadata::ID, test_meta.pubkey, test_meta.token.pubkey(), test_meta.mint.pubkey(), @@ -540,8 +540,8 @@ mod uses { .await .unwrap(); - let utilize_ix = mpl_token_metadata::instruction::utilize( - mpl_token_metadata::ID, + let utilize_ix = token_metadata::instruction::utilize( + token_metadata::ID, test_meta.pubkey, test_meta.token.pubkey(), test_meta.mint.pubkey(), diff --git a/programs/token-metadata/program/tests/utils/collection.rs b/programs/token-metadata/program/tests/utils/collection.rs index 12849b30..b0b1bd7e 100644 --- a/programs/token-metadata/program/tests/utils/collection.rs +++ b/programs/token-metadata/program/tests/utils/collection.rs @@ -1,9 +1,9 @@ use crate::*; -use mpl_token_metadata::{ +use solana_program::borsh::try_from_slice_unchecked; +use token_metadata::{ id, instruction, state::{Collection, Creator, Data, DataV2, Uses, PREFIX}, }; -use solana_program::borsh::try_from_slice_unchecked; use solana_sdk::{ pubkey::Pubkey, signature::Signer, signer::keypair::Keypair, transaction::Transaction, diff --git a/programs/token-metadata/program/tests/utils/digital_asset.rs b/programs/token-metadata/program/tests/utils/digital_asset.rs index 0520ed7b..ecc9543b 100644 --- a/programs/token-metadata/program/tests/utils/digital_asset.rs +++ b/programs/token-metadata/program/tests/utils/digital_asset.rs @@ -1,5 +1,17 @@ use borsh::BorshDeserialize; -use mpl_token_metadata::{ +use solana_program::{program_option::COption, program_pack::Pack, pubkey::Pubkey}; +use solana_program_test::{BanksClientError, ProgramTestContext}; +use solana_sdk::{ + account::AccountSharedData, + compute_budget::ComputeBudgetInstruction, + signature::{Keypair, Signer}, + transaction::Transaction, +}; +use spl_associated_token_account::{ + get_associated_token_address, instruction::create_associated_token_account, +}; +use spl_token::state::Account; +use token_metadata::{ instruction::{ self, builders::{ @@ -23,18 +35,6 @@ use mpl_token_metadata::{ }, ID, }; -use solana_program::{program_option::COption, program_pack::Pack, pubkey::Pubkey}; -use solana_program_test::{BanksClientError, ProgramTestContext}; -use solana_sdk::{ - account::AccountSharedData, - compute_budget::ComputeBudgetInstruction, - signature::{Keypair, Signer}, - transaction::Transaction, -}; -use spl_associated_token_account::{ - get_associated_token_address, instruction::create_associated_token_account, -}; -use spl_token::state::Account; use super::{airdrop, create_mint, create_token_account, get_account, mint_tokens}; @@ -118,12 +118,12 @@ impl DigitalAsset { let (edition_marker, _) = Pubkey::find_program_address( &[ PREFIX.as_bytes(), - mpl_token_metadata::ID.as_ref(), + token_metadata::ID.as_ref(), parent_asset.mint.pubkey().as_ref(), EDITION.as_bytes(), marker_num.to_string().as_bytes(), ], - &mpl_token_metadata::ID, + &token_metadata::ID, ); builder.edition_marker(edition_marker); } diff --git a/programs/token-metadata/program/tests/utils/edition_marker.rs b/programs/token-metadata/program/tests/utils/edition_marker.rs index 25baed53..64262e07 100644 --- a/programs/token-metadata/program/tests/utils/edition_marker.rs +++ b/programs/token-metadata/program/tests/utils/edition_marker.rs @@ -1,15 +1,4 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use mpl_token_metadata::{ - instruction::{ - self, - builders::{BurnBuilder, DelegateBuilder, PrintBuilder, TransferBuilder}, - BurnArgs, DelegateArgs, InstructionBuilder, MetadataDelegateRole, MetadataInstruction, - MintNewEditionFromMasterEditionViaTokenArgs, PrintArgs, TransferArgs, - }, - pda::{find_metadata_delegate_record_account, find_token_record_account, MARKER}, - state::{ProgrammableConfig, TokenMetadataAccount, EDITION, EDITION_MARKER_BIT_SIZE, PREFIX}, - ID, -}; use solana_program::{ instruction::{AccountMeta, Instruction}, system_program, sysvar, @@ -22,6 +11,17 @@ use solana_sdk::{ use spl_associated_token_account::{ get_associated_token_address, instruction::create_associated_token_account, }; +use token_metadata::{ + instruction::{ + self, + builders::{BurnBuilder, DelegateBuilder, PrintBuilder, TransferBuilder}, + BurnArgs, DelegateArgs, InstructionBuilder, MetadataDelegateRole, MetadataInstruction, + MintNewEditionFromMasterEditionViaTokenArgs, PrintArgs, TransferArgs, + }, + pda::{find_metadata_delegate_record_account, find_token_record_account, MARKER}, + state::{ProgrammableConfig, TokenMetadataAccount, EDITION, EDITION_MARKER_BIT_SIZE, PREFIX}, + ID, +}; use crate::*; @@ -162,7 +162,7 @@ impl EditionMarker { pub async fn get_data( &self, context: &mut ProgramTestContext, - ) -> mpl_token_metadata::state::EditionMarker { + ) -> token_metadata::state::EditionMarker { let account = get_account(context, &self.pubkey).await; BorshDeserialize::deserialize(&mut &account.data[..]).unwrap() } @@ -170,7 +170,7 @@ impl EditionMarker { pub async fn get_data_v2( &self, context: &mut ProgramTestContext, - ) -> mpl_token_metadata::state::EditionMarkerV2 { + ) -> token_metadata::state::EditionMarkerV2 { let account = get_account(context, &self.pubkey).await; BorshDeserialize::deserialize(&mut &account.data[..]).unwrap() } @@ -263,16 +263,16 @@ impl EditionMarker { let edition_marker_pda = Pubkey::find_program_address( &[ PREFIX.as_bytes(), - mpl_token_metadata::ID.as_ref(), + token_metadata::ID.as_ref(), self.metadata_mint_pubkey.as_ref(), EDITION.as_bytes(), MARKER.as_bytes(), ], - &mpl_token_metadata::ID, + &token_metadata::ID, ); let token_record_pda = find_token_record_account(&self.mint.pubkey(), &self.token.pubkey()); - let master_metadata = mpl_token_metadata::state::Metadata::safe_deserialize( + let master_metadata = token_metadata::state::Metadata::safe_deserialize( &get_account(context, &self.metadata_pubkey).await.data, ) .unwrap(); @@ -327,12 +327,12 @@ impl EditionMarker { let edition_marker_pda = Pubkey::find_program_address( &[ PREFIX.as_bytes(), - mpl_token_metadata::ID.as_ref(), + token_metadata::ID.as_ref(), self.metadata_mint_pubkey.as_ref(), EDITION.as_bytes(), MARKER.as_bytes(), ], - &mpl_token_metadata::ID, + &token_metadata::ID, ); let edition_ata = @@ -383,7 +383,7 @@ impl EditionMarker { context: &mut ProgramTestContext, ) -> Result<(), BanksClientError> { let fake_token_program = Keypair::new(); - let program_id = mpl_token_metadata::ID; + let program_id = token_metadata::ID; let edition_number = self.edition.checked_div(EDITION_MARKER_BIT_SIZE).unwrap(); let as_string = edition_number.to_string(); @@ -728,9 +728,8 @@ impl EditionMarker { // determines if we need to set the rule set let metadata_account = get_account(context, &self.metadata_pubkey).await; - let metadata: mpl_token_metadata::state::Metadata = - mpl_token_metadata::state::Metadata::deserialize(&mut &metadata_account.data[..]) - .unwrap(); + let metadata: token_metadata::state::Metadata = + token_metadata::state::Metadata::deserialize(&mut &metadata_account.data[..]).unwrap(); if let Some(ProgrammableConfig::V1 { rule_set: Some(rule_set), diff --git a/programs/token-metadata/program/tests/utils/master_edition_v2.rs b/programs/token-metadata/program/tests/utils/master_edition_v2.rs index 04bb6580..3f325e0a 100644 --- a/programs/token-metadata/program/tests/utils/master_edition_v2.rs +++ b/programs/token-metadata/program/tests/utils/master_edition_v2.rs @@ -1,9 +1,4 @@ use borsh::{ser::BorshSerialize, BorshDeserialize}; -use mpl_token_metadata::{ - instruction::{self, CreateMasterEditionArgs, MetadataInstruction}, - state::{MasterEditionV2 as ProgramMasterEdition, TokenMetadataAccount, EDITION, PREFIX}, - ID, -}; use solana_program::{ instruction::{AccountMeta, Instruction}, sysvar, @@ -13,6 +8,11 @@ use solana_sdk::{ signature::{Keypair, Signer}, transaction::Transaction, }; +use token_metadata::{ + instruction::{self, CreateMasterEditionArgs, MetadataInstruction}, + state::{MasterEditionV2 as ProgramMasterEdition, TokenMetadataAccount, EDITION, PREFIX}, + ID, +}; use crate::*; @@ -65,7 +65,7 @@ impl MasterEditionV2 { pub async fn get_data( &self, context: &mut ProgramTestContext, - ) -> mpl_token_metadata::state::MasterEditionV2 { + ) -> token_metadata::state::MasterEditionV2 { let account = get_account(context, &self.pubkey).await; ProgramMasterEdition::safe_deserialize(&account.data).unwrap() } @@ -73,7 +73,7 @@ impl MasterEditionV2 { pub async fn get_data_from_account( context: &mut ProgramTestContext, pubkey: &Pubkey, - ) -> mpl_token_metadata::state::MasterEditionV2 { + ) -> token_metadata::state::MasterEditionV2 { let account = get_account(context, pubkey).await; BorshDeserialize::deserialize(&mut &account.data[..]).unwrap() } @@ -86,7 +86,7 @@ impl MasterEditionV2 { let fake_token_program = Keypair::new(); let fake_instruction = Instruction { - program_id: mpl_token_metadata::ID, + program_id: token_metadata::ID, accounts: vec![ AccountMeta::new(self.pubkey, false), AccountMeta::new(self.mint_pubkey, false), diff --git a/programs/token-metadata/program/tests/utils/metadata.rs b/programs/token-metadata/program/tests/utils/metadata.rs index becb4d76..5cd2b91f 100644 --- a/programs/token-metadata/program/tests/utils/metadata.rs +++ b/programs/token-metadata/program/tests/utils/metadata.rs @@ -1,5 +1,8 @@ use borsh::BorshDeserialize; -use mpl_token_metadata::{ +use solana_sdk::{ + pubkey::Pubkey, signature::Signer, signer::keypair::Keypair, transaction::Transaction, +}; +use token_metadata::{ instruction, state::{ Collection, CollectionDetails, Creator, DataV2, Metadata as TmMetadata, @@ -8,9 +11,6 @@ use mpl_token_metadata::{ }, ID, }; -use solana_sdk::{ - pubkey::Pubkey, signature::Signer, signer::keypair::Keypair, transaction::Transaction, -}; use crate::*; @@ -64,7 +64,7 @@ impl Metadata { pub async fn get_data( &self, context: &mut ProgramTestContext, - ) -> mpl_token_metadata::state::Metadata { + ) -> token_metadata::state::Metadata { let account = get_account(context, &self.pubkey).await; BorshDeserialize::deserialize(&mut &account.data[..]).unwrap() } @@ -631,7 +631,7 @@ impl Metadata { let tx = Transaction::new_signed_with_payer( &[instruction::update_metadata_accounts_v2( - mpl_token_metadata::ID, + token_metadata::ID, self.pubkey, context.payer.pubkey(), Some(new_update_authority), diff --git a/programs/token-metadata/program/tests/utils/mod.rs b/programs/token-metadata/program/tests/utils/mod.rs index 03f30287..299e162f 100644 --- a/programs/token-metadata/program/tests/utils/mod.rs +++ b/programs/token-metadata/program/tests/utils/mod.rs @@ -12,8 +12,6 @@ pub use digital_asset::*; pub use edition_marker::*; pub use master_edition_v2::MasterEditionV2; pub use metadata::{assert_collection_size, Metadata}; -pub use mpl_token_metadata::instruction; -use mpl_token_metadata::state::CollectionDetails; pub use programmable::create_default_metaplex_rule_set; pub use rooster_manager::*; use solana_program_test::*; @@ -22,6 +20,8 @@ use solana_sdk::{ signer::keypair::Keypair, system_instruction, transaction::Transaction, }; use spl_token::state::Mint; +pub use token_metadata::instruction; +use token_metadata::state::CollectionDetails; pub const DEFAULT_COLLECTION_DETAILS: Option = { #[allow(deprecated)] @@ -29,7 +29,7 @@ pub const DEFAULT_COLLECTION_DETAILS: Option = { }; pub fn program_test() -> ProgramTest { - ProgramTest::new("mpl_token_metadata", mpl_token_metadata::ID, None) + ProgramTest::new("token_metadata", token_metadata::ID, None) } pub async fn get_account(context: &mut ProgramTestContext, pubkey: &Pubkey) -> Account { @@ -77,7 +77,7 @@ pub async fn burn( ) -> Result<(), BanksClientError> { let tx = Transaction::new_signed_with_payer( &[instruction::burn_nft( - mpl_token_metadata::ID, + token_metadata::ID, metadata, owner.pubkey(), mint, @@ -110,7 +110,7 @@ pub async fn burn_edition( ) -> Result<(), BanksClientError> { let tx = Transaction::new_signed_with_payer( &[instruction::burn_edition_nft( - mpl_token_metadata::ID, + token_metadata::ID, metadata, owner.pubkey(), print_edition_mint, diff --git a/programs/token-metadata/program/tests/utils/programmable.rs b/programs/token-metadata/program/tests/utils/programmable.rs index 6d0cc921..5231f8c9 100644 --- a/programs/token-metadata/program/tests/utils/programmable.rs +++ b/programs/token-metadata/program/tests/utils/programmable.rs @@ -3,10 +3,6 @@ use mpl_token_auth_rules::{ payload::Payload, state::{CompareOp, Rule, RuleSetV1}, }; -use mpl_token_metadata::{ - processor::{AuthorizationData, DelegateScenario, TransferScenario}, - state::{Operation, PayloadKey, TokenDelegateRole}, -}; use rmp_serde::Serializer; use serde::Serialize; use solana_sdk::{ @@ -15,6 +11,10 @@ use solana_sdk::{ signature::{Keypair, Signer}, transaction::Transaction, }; +use token_metadata::{ + processor::{AuthorizationData, DelegateScenario, TransferScenario}, + state::{Operation, PayloadKey, TokenDelegateRole}, +}; use crate::*; diff --git a/programs/token-metadata/program/tests/verify.rs b/programs/token-metadata/program/tests/verify.rs index fb9a9979..9f9ce1f0 100644 --- a/programs/token-metadata/program/tests/verify.rs +++ b/programs/token-metadata/program/tests/verify.rs @@ -2,7 +2,14 @@ pub mod utils; -use mpl_token_metadata::{ +use num_traits::FromPrimitive; +use solana_program::native_token::LAMPORTS_PER_SOL; +use solana_program_test::*; +use solana_sdk::{ + instruction::InstructionError, signature::Keypair, signer::Signer, transaction::Transaction, + transaction::TransactionError, +}; +use token_metadata::{ error::MetadataError, instruction::{ builders::VerifyBuilder, DelegateArgs, InstructionBuilder, MetadataDelegateRole, @@ -11,13 +18,6 @@ use mpl_token_metadata::{ pda::{find_metadata_delegate_record_account, find_token_record_account}, state::{Collection, CollectionDetails, Creator, TokenStandard}, }; -use num_traits::FromPrimitive; -use solana_program::native_token::LAMPORTS_PER_SOL; -use solana_program_test::*; -use solana_sdk::{ - instruction::InstructionError, signature::Keypair, signer::Signer, transaction::Transaction, - transaction::TransactionError, -}; use utils::*; mod verify_creator { diff --git a/programs/token-metadata/program/tests/verify_collection.rs b/programs/token-metadata/program/tests/verify_collection.rs index c556cfec..66e31149 100644 --- a/programs/token-metadata/program/tests/verify_collection.rs +++ b/programs/token-metadata/program/tests/verify_collection.rs @@ -2,15 +2,6 @@ pub mod utils; use borsh::BorshDeserialize; -use mpl_token_metadata::{ - error::MetadataError, - pda::find_collection_authority_account, - state::{ - Collection, CollectionAuthorityRecord, Key, UseMethod, Uses, - COLLECTION_AUTHORITY_RECORD_SIZE, MAX_NAME_LENGTH, MAX_SYMBOL_LENGTH, MAX_URI_LENGTH, - }, - utils::puffed_out_string, -}; use num_traits::FromPrimitive; use solana_program::native_token::LAMPORTS_PER_SOL; use solana_program_test::*; @@ -20,12 +11,21 @@ use solana_sdk::{ signature::{Keypair, Signer}, transaction::{Transaction, TransactionError}, }; +use token_metadata::{ + error::MetadataError, + pda::find_collection_authority_account, + state::{ + Collection, CollectionAuthorityRecord, Key, UseMethod, Uses, + COLLECTION_AUTHORITY_RECORD_SIZE, MAX_NAME_LENGTH, MAX_SYMBOL_LENGTH, MAX_URI_LENGTH, + }, + utils::puffed_out_string, +}; use utils::*; mod verify_collection { use borsh::BorshDeserialize; - use mpl_token_metadata::state::{CollectionAuthorityRecord, COLLECTION_AUTHORITY_RECORD_SIZE}; use solana_sdk::transaction::Transaction; + use token_metadata::state::{CollectionAuthorityRecord, COLLECTION_AUTHORITY_RECORD_SIZE}; use super::*; #[tokio::test] @@ -548,8 +548,8 @@ mod verify_collection { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), context.payer.pubkey(), @@ -632,8 +632,8 @@ mod verify_collection { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), update_authority, @@ -721,8 +721,8 @@ mod verify_collection { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), update_authority, @@ -765,8 +765,8 @@ mod verify_collection { ); assert!(metadata_after.collection.unwrap().verified); - let ix_revoke = mpl_token_metadata::instruction::revoke_collection_authority( - mpl_token_metadata::ID, + let ix_revoke = token_metadata::instruction::revoke_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), new_collection_authority.pubkey(), @@ -842,8 +842,8 @@ mod verify_collection { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), context.payer.pubkey(), @@ -869,8 +869,8 @@ mod verify_collection { .unwrap(); assert_eq!(account_before.data.len(), COLLECTION_AUTHORITY_RECORD_SIZE); - let ixrevoke = mpl_token_metadata::instruction::revoke_collection_authority( - mpl_token_metadata::ID, + let ixrevoke = token_metadata::instruction::revoke_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), context.payer.pubkey(), @@ -946,8 +946,8 @@ mod verify_collection { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), update_authority, @@ -1004,8 +1004,8 @@ mod verify_collection { let metadata_after_unverify = test_metadata.get_data(&mut context).await; assert!(!metadata_after_unverify.collection.unwrap().verified); - let ix_revoke = mpl_token_metadata::instruction::revoke_collection_authority( - mpl_token_metadata::ID, + let ix_revoke = token_metadata::instruction::revoke_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), incorrect_revoke_authority.pubkey(), @@ -1231,8 +1231,8 @@ async fn fail_invalid_collection_update_authority() { &delegate_keypair.pubkey(), ); - let ix1 = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix1 = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, delegate_keypair.pubkey(), update_authority, @@ -1311,7 +1311,7 @@ async fn success_collection_authority_delegate_revoke() { let record_account = Account { lamports: LAMPORTS_PER_SOL, data, - owner: mpl_token_metadata::ID, + owner: token_metadata::ID, executable: false, rent_epoch: 1, }; @@ -1320,8 +1320,8 @@ async fn success_collection_authority_delegate_revoke() { let payer = context.payer.pubkey(); - let ix_revoke = mpl_token_metadata::instruction::revoke_collection_authority( - mpl_token_metadata::ID, + let ix_revoke = token_metadata::instruction::revoke_collection_authority( + token_metadata::ID, record, delegate_keypair.pubkey(), payer, @@ -1342,8 +1342,8 @@ async fn success_collection_authority_delegate_revoke() { .await .unwrap(); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, delegate_keypair.pubkey(), payer, diff --git a/programs/token-metadata/program/tests/verify_sized_collection_item.rs b/programs/token-metadata/program/tests/verify_sized_collection_item.rs index 9bd13e6a..ef6d7cbe 100644 --- a/programs/token-metadata/program/tests/verify_sized_collection_item.rs +++ b/programs/token-metadata/program/tests/verify_sized_collection_item.rs @@ -1,7 +1,14 @@ #![cfg(feature = "test-bpf")] pub mod utils; -use mpl_token_metadata::{ +use num_traits::FromPrimitive; +use solana_program_test::*; +use solana_sdk::{ + instruction::InstructionError, + signature::{Keypair, Signer}, + transaction::{Transaction, TransactionError}, +}; +use token_metadata::{ error::MetadataError, instruction::set_collection_size, pda::find_collection_authority_account, @@ -12,19 +19,12 @@ use mpl_token_metadata::{ utils::puffed_out_string, ID as PROGRAM_ID, }; -use num_traits::FromPrimitive; -use solana_program_test::*; -use solana_sdk::{ - instruction::InstructionError, - signature::{Keypair, Signer}, - transaction::{Transaction, TransactionError}, -}; use utils::*; mod verify_sized_collection_item { use borsh::BorshDeserialize; - use mpl_token_metadata::state::{CollectionAuthorityRecord, COLLECTION_AUTHORITY_RECORD_SIZE}; use solana_sdk::transaction::Transaction; + use token_metadata::state::{CollectionAuthorityRecord, COLLECTION_AUTHORITY_RECORD_SIZE}; use super::*; #[tokio::test] @@ -579,8 +579,8 @@ mod verify_sized_collection_item { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), context.payer.pubkey(), @@ -674,8 +674,8 @@ mod verify_sized_collection_item { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), update_authority, @@ -773,8 +773,8 @@ mod verify_sized_collection_item { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), update_authority, @@ -817,8 +817,8 @@ mod verify_sized_collection_item { ); assert!(metadata_after.collection.unwrap().verified); - let ix_revoke = mpl_token_metadata::instruction::revoke_collection_authority( - mpl_token_metadata::ID, + let ix_revoke = token_metadata::instruction::revoke_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), new_collection_authority.pubkey(), @@ -894,8 +894,8 @@ mod verify_sized_collection_item { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), context.payer.pubkey(), @@ -921,8 +921,8 @@ mod verify_sized_collection_item { .unwrap(); assert_eq!(account_before.data.len(), COLLECTION_AUTHORITY_RECORD_SIZE); - let ixrevoke = mpl_token_metadata::instruction::revoke_collection_authority( - mpl_token_metadata::ID, + let ixrevoke = token_metadata::instruction::revoke_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), context.payer.pubkey(), @@ -1009,8 +1009,8 @@ mod verify_sized_collection_item { &test_collection.mint.pubkey(), &new_collection_authority.pubkey(), ); - let ix = mpl_token_metadata::instruction::approve_collection_authority( - mpl_token_metadata::ID, + let ix = token_metadata::instruction::approve_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), update_authority, @@ -1067,8 +1067,8 @@ mod verify_sized_collection_item { let metadata_after_unverify = test_metadata.get_data(&mut context).await; assert!(!metadata_after_unverify.collection.unwrap().verified); - let ix_revoke = mpl_token_metadata::instruction::revoke_collection_authority( - mpl_token_metadata::ID, + let ix_revoke = token_metadata::instruction::revoke_collection_authority( + token_metadata::ID, record, new_collection_authority.pubkey(), incorrect_revoke_authority.pubkey(),