From 204e2f17089dfc020b4e49089bc2014ec82b18e6 Mon Sep 17 00:00:00 2001 From: Nhan Phan Date: Wed, 8 May 2024 13:59:50 -0700 Subject: [PATCH] fix external plugin offsets, better types, new tests (#109) * Adding anchor types. * Update. * removed audit warning (#108) * better types, new test * Updating Kinobi dependency. * Fixing kinobi reference. * Bumping Kinobi version and fixing clients. * Fixing mpl-utils version. * Immutability plugins (#96) * Add ImmutableMetadata && AddBlocker plugins * Update autogenerated parts * add tests * change the order of enums * update generated part * added tests for ensuring that UA is the only one who can add the plugin * added tests for ensuring that UA is the only one who can add the plugin for collection and nested plugins * update tests * add audit details to readme (#103) * removed audit warning (#108) * regenerated clients * updated tests * updated rust clients * chore: Release mpl-core version 0.6.0 * Modify `update` and `update_plugin` to move external plugin offsets (#112) Notes Also combine asset and collection update functions to use the same processors. Also fix offset calculations when updating external plugins (added test for this case). More advanced refactor: Combine plugin updating into single utility function #113 Note this PR is built upon #109 so that it can be tested with the new tests from that branch. * Deploy JS client v0.4.7 * update ava version, allow assertions on external plugins, check oracles in oracle tests * minor add plugin interface change * add additional test assert, formatting --------- Co-authored-by: blockiosaurus Co-authored-by: Tony Boyle <81017245+tonyboylehub@users.noreply.github.com> Co-authored-by: Kyrylo Stepanov Co-authored-by: blockiosaurus <90809591+blockiosaurus@users.noreply.github.com> Co-authored-by: blockiosaurus Co-authored-by: Michael Danenberg <56533526+danenbm@users.noreply.github.com> --- Cargo.lock | 1154 ++++++++++------- README.md | 3 - clients/js/README.md | 258 ++-- clients/js/package.json | 9 +- clients/js/pnpm-lock.yaml | 420 +++--- clients/js/src/authority.ts | 17 +- clients/js/src/demo.ts | 104 +- clients/js/src/generated/types/addBlocker.ts | 23 + .../src/generated/types/immutableMetadata.ts | 22 + clients/js/src/generated/types/index.ts | 2 + clients/js/src/generated/types/plugin.ts | 34 +- clients/js/src/generated/types/pluginType.ts | 2 + clients/js/src/instructions/addPlugin.ts | 8 +- .../instructions/approvePluginAuthority.ts | 30 +- clients/js/src/instructions/burn.ts | 4 +- .../collection/addCollectionPlugin.ts | 2 +- clients/js/src/instructions/create.ts | 14 +- clients/js/src/instructions/removePlugin.ts | 12 +- .../src/instructions/revokePluginAuthority.ts | 25 +- clients/js/src/instructions/transfer.ts | 4 +- clients/js/src/instructions/update.ts | 4 +- clients/js/src/instructions/updatePlugin.ts | 6 +- clients/js/src/plugins/types.ts | 20 +- clients/js/test/_setupRaw.ts | 7 +- clients/js/test/_setupSdk.ts | 7 +- .../js/test/externalPlugins/oracle.test.ts | 616 ++++++++- .../js/test/plugins/asset/addBlocker.test.ts | 170 +++ .../plugins/asset/immutableMetadata.test.ts | 118 ++ .../plugins/collection/addBlocker.test.ts | 160 +++ .../collection/immutableMetadata.test.ts | 152 +++ clients/rust/Cargo.toml | 4 +- .../src/generated/accounts/base_asset_v1.rs | 10 +- .../generated/accounts/base_collection_v1.rs | 10 +- .../src/generated/accounts/hashed_asset_v1.rs | 10 +- .../generated/accounts/plugin_header_v1.rs | 10 +- .../generated/accounts/plugin_registry_v1.rs | 10 +- .../add_collection_external_plugin_v1.rs | 13 +- .../instructions/add_collection_plugin_v1.rs | 13 +- .../instructions/add_external_plugin_v1.rs | 13 +- .../generated/instructions/add_plugin_v1.rs | 13 +- .../approve_collection_plugin_authority_v1.rs | 13 +- .../approve_plugin_authority_v1.rs | 13 +- .../instructions/burn_collection_v1.rs | 13 +- .../src/generated/instructions/burn_v1.rs | 13 +- .../src/generated/instructions/collect.rs | 9 +- .../src/generated/instructions/compress_v1.rs | 9 +- .../instructions/create_collection_v1.rs | 13 +- .../instructions/create_collection_v2.rs | 13 +- .../src/generated/instructions/create_v1.rs | 13 +- .../src/generated/instructions/create_v2.rs | 13 +- .../generated/instructions/decompress_v1.rs | 13 +- .../remove_collection_external_plugin_v1.rs | 13 +- .../remove_collection_plugin_v1.rs | 13 +- .../instructions/remove_external_plugin_v1.rs | 13 +- .../instructions/remove_plugin_v1.rs | 13 +- .../revoke_collection_plugin_authority_v1.rs | 13 +- .../revoke_plugin_authority_v1.rs | 13 +- .../src/generated/instructions/transfer_v1.rs | 13 +- .../update_collection_external_plugin_v1.rs | 13 +- .../update_collection_plugin_v1.rs | 13 +- .../instructions/update_collection_v1.rs | 13 +- .../instructions/update_external_plugin_v1.rs | 13 +- .../instructions/update_plugin_v1.rs | 13 +- .../src/generated/instructions/update_v1.rs | 13 +- ...rite_collection_external_plugin_data_v1.rs | 13 +- .../write_external_plugin_data_v1.rs | 13 +- .../rust/src/generated/types/add_blocker.rs | 17 + clients/rust/src/generated/types/attribute.rs | 10 +- .../rust/src/generated/types/attributes.rs | 10 +- .../rust/src/generated/types/burn_delegate.rs | 10 +- .../src/generated/types/compression_proof.rs | 10 +- clients/rust/src/generated/types/creator.rs | 10 +- .../rust/src/generated/types/data_state.rs | 12 +- .../rust/src/generated/types/data_store.rs | 10 +- .../generated/types/data_store_init_info.rs | 10 +- .../generated/types/data_store_update_info.rs | 10 +- clients/rust/src/generated/types/edition.rs | 10 +- .../generated/types/external_check_result.rs | 10 +- .../src/generated/types/external_plugin.rs | 10 +- .../types/external_plugin_init_info.rs | 10 +- .../generated/types/external_plugin_key.rs | 10 +- .../generated/types/external_plugin_schema.rs | 12 +- .../generated/types/external_plugin_type.rs | 12 +- .../types/external_plugin_update_info.rs | 10 +- .../types/external_registry_record.rs | 10 +- .../types/external_validation_result.rs | 12 +- .../rust/src/generated/types/extra_account.rs | 10 +- .../src/generated/types/freeze_delegate.rs | 10 +- .../generated/types/hashable_plugin_schema.rs | 10 +- .../generated/types/hashed_asset_schema.rs | 10 +- .../types/hookable_lifecycle_event.rs | 12 +- .../src/generated/types/immutable_metadata.rs | 17 + clients/rust/src/generated/types/key.rs | 12 +- .../src/generated/types/lifecycle_hook.rs | 10 +- .../types/lifecycle_hook_init_info.rs | 10 +- .../types/lifecycle_hook_update_info.rs | 10 +- .../src/generated/types/master_edition.rs | 10 +- clients/rust/src/generated/types/mod.rs | 4 + clients/rust/src/generated/types/oracle.rs | 10 +- .../src/generated/types/oracle_init_info.rs | 10 +- .../src/generated/types/oracle_update_info.rs | 10 +- .../src/generated/types/oracle_validation.rs | 10 +- .../types/permanent_burn_delegate.rs | 10 +- .../types/permanent_freeze_delegate.rs | 10 +- .../types/permanent_transfer_delegate.rs | 10 +- clients/rust/src/generated/types/plugin.rs | 14 +- .../src/generated/types/plugin_authority.rs | 10 +- .../generated/types/plugin_authority_pair.rs | 10 +- .../rust/src/generated/types/plugin_type.rs | 14 +- .../src/generated/types/registry_record.rs | 10 +- clients/rust/src/generated/types/royalties.rs | 10 +- clients/rust/src/generated/types/rule_set.rs | 10 +- clients/rust/src/generated/types/seed.rs | 10 +- .../src/generated/types/transfer_delegate.rs | 10 +- .../src/generated/types/update_authority.rs | 10 +- .../src/generated/types/update_delegate.rs | 10 +- .../src/generated/types/validation_result.rs | 12 +- .../types/validation_results_offset.rs | 10 +- clients/rust/src/hooked/advanced_types.rs | 22 +- clients/rust/src/hooked/mod.rs | 2 + clients/rust/src/hooked/plugin.rs | 20 +- idls/mpl_core.json | 36 + package.json | 2 +- pnpm-lock.yaml | 20 +- programs/mpl-core/Cargo.toml | 4 +- programs/mpl-core/src/plugins/add_blocker.rs | 40 + .../src/plugins/immutable_metadata.rs | 33 + programs/mpl-core/src/plugins/lifecycle.rs | 56 + programs/mpl-core/src/plugins/mod.rs | 16 + programs/mpl-core/src/processor/update.rs | 34 +- .../src/processor/update_external_plugin.rs | 167 +-- .../mpl-core/src/processor/update_plugin.rs | 188 +-- 132 files changed, 3539 insertions(+), 1494 deletions(-) create mode 100644 clients/js/src/generated/types/addBlocker.ts create mode 100644 clients/js/src/generated/types/immutableMetadata.ts create mode 100644 clients/js/test/plugins/asset/addBlocker.test.ts create mode 100644 clients/js/test/plugins/asset/immutableMetadata.test.ts create mode 100644 clients/js/test/plugins/collection/addBlocker.test.ts create mode 100644 clients/js/test/plugins/collection/immutableMetadata.test.ts create mode 100644 clients/rust/src/generated/types/add_blocker.rs create mode 100644 clients/rust/src/generated/types/immutable_metadata.rs create mode 100644 programs/mpl-core/src/plugins/add_blocker.rs create mode 100644 programs/mpl-core/src/plugins/immutable_metadata.rs diff --git a/Cargo.lock b/Cargo.lock index 91cf667f..ed9f0028 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -117,6 +117,171 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "anchor-attribute-access-control" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd7368e171b3a317885dc08ec0f74eed9d0ad6c726cc819593aed81440dca926" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-account" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f527df85a8cba3f2bea04e46ed71b66e525ea378c7fec538aa205f4520b73e31" +dependencies = [ + "anchor-syn", + "bs58 0.5.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-constant" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eb1dc1845cf8636c2e046a274ca074dabd3884ac8ed11cc4ed64b7e8ef5a318" +dependencies = [ + "anchor-syn", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f382e41514c59a77ffa7bb1a47df9a0359564a749b6934485c742c11962e540" +dependencies = [ + "anchor-syn", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "473a122aeed3f6b666438236338d2ef7833ee5fdc5688e1baa80185d61088a53" +dependencies = [ + "anchor-syn", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f88c7ffe2eb40aeac43ffd0d74a6671581158aedfaa0552330a2ef92fa5c889" +dependencies = [ + "anchor-lang-idl", + "anchor-syn", + "anyhow", + "bs58 0.5.1", + "heck 0.3.3", + "proc-macro2", + "quote", + "serde_json", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed9b97c99dcec135aae0ff908c14bcfcd3e78cfc16a0c6f245135038f0e6d390" +dependencies = [ + "anchor-syn", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-serde" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbece98f6ad9c37070edc0841326c9623a249346cd74f433e7cef69b14f7f31d" +dependencies = [ + "anchor-syn", + "borsh-derive-internal 0.10.3", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-space" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8badbe2648bc99a85ee05a7a5f9512e5e2af8ffac71476a69350cb278057ac53" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-lang" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e41feb9c1cd9f4b0fad1c004fc8f289183f3ce27e9db38fa6e434470c716fb1e" +dependencies = [ + "anchor-attribute-access-control", + "anchor-attribute-account", + "anchor-attribute-constant", + "anchor-attribute-error", + "anchor-attribute-event", + "anchor-attribute-program", + "anchor-derive-accounts", + "anchor-derive-serde", + "anchor-derive-space", + "arrayref", + "base64 0.21.7", + "bincode", + "borsh 0.10.3", + "bytemuck", + "getrandom 0.2.12", + "solana-program", + "thiserror", +] + +[[package]] +name = "anchor-lang-idl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b29da81eae478b1bb846749b06b8a2cb9c6f9ed26ca793b0c916793fdf36adab" +dependencies = [ + "anyhow", + "serde", + "serde_json", +] + +[[package]] +name = "anchor-syn" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac53f2378bc08e89e20c2b893c01986ffd34cfbc69a17e35bd6f754753e9fdad" +dependencies = [ + "anyhow", + "bs58 0.5.1", + "heck 0.3.3", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2 0.10.8", + "syn 1.0.109", + "thiserror", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -201,7 +366,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" dependencies = [ - "quote 1.0.35", + "quote", "syn 1.0.109", ] @@ -213,8 +378,8 @@ checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ "num-bigint 0.4.4", "num-traits", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -249,8 +414,8 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -264,12 +429,6 @@ dependencies = [ "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" @@ -310,8 +469,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", "synstructure", ] @@ -322,8 +481,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -373,8 +532,8 @@ version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -460,6 +619,9 @@ name = "bitflags" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +dependencies = [ + "serde", +] [[package]] name = "bitmaps" @@ -538,7 +700,7 @@ dependencies = [ "borsh-derive-internal 0.9.3", "borsh-schema-derive-internal 0.9.3", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.76", + "proc-macro2", "syn 1.0.109", ] @@ -551,7 +713,7 @@ dependencies = [ "borsh-derive-internal 0.10.3", "borsh-schema-derive-internal 0.10.3", "proc-macro-crate 0.1.5", - "proc-macro2 1.0.76", + "proc-macro2", "syn 1.0.109", ] @@ -561,8 +723,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -572,8 +734,8 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -583,8 +745,8 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -594,8 +756,8 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -626,6 +788,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + [[package]] name = "bumpalo" version = "3.14.0" @@ -657,8 +828,8 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -996,8 +1167,8 @@ checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "strsim 0.10.0", "syn 2.0.48", ] @@ -1009,7 +1180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", - "quote 1.0.35", + "quote", "syn 2.0.48", ] @@ -1075,8 +1246,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -1127,32 +1298,32 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] [[package]] -name = "dlopen" -version = "0.1.8" +name = "dlopen2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e80ad39f814a9abe68583cd50a2d45c8a67561c3361ab8da240587dda80937" +checksum = "09b4f5f101177ff01b8ec4ecc81eead416a8aa42819a2869311b3420fa114ffa" dependencies = [ - "dlopen_derive", - "lazy_static", + "dlopen2_derive", "libc", + "once_cell", "winapi", ] [[package]] -name = "dlopen_derive" -version = "0.1.4" +name = "dlopen2_derive" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f236d9e1b1fbd81cea0f9cbdc8dcc7e8ebcd80e6659cd7cb2ad5f6c05946c581" +checksum = "a6cbae11b3de8fce2a456e8ea3dada226b35fe791f0dc1d360c0941f0bb681f3" dependencies = [ - "libc", - "quote 0.6.13", - "syn 0.15.44", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] @@ -1203,8 +1374,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0042ff8246a363dbe77d2ceedb073339e85a804b9a47636c6e016a9a32c05f" dependencies = [ "enum-ordinalize", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -1244,8 +1415,8 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03cdc46ec28bd728e67540c528013c6a10eb69a02eb31078a1bda695438cbfb8" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -1257,8 +1428,8 @@ checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" dependencies = [ "num-bigint 0.4.4", "num-traits", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -1346,6 +1517,15 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs-err" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" +dependencies = [ + "autocfg", +] + [[package]] name = "futures" version = "0.3.30" @@ -1400,8 +1580,8 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -1560,6 +1740,15 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "heck" version = "0.4.1" @@ -1680,7 +1869,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.5", + "socket2", "tokio", "tower-service", "tracing", @@ -1696,9 +1885,9 @@ dependencies = [ "futures-util", "http", "hyper", - "rustls 0.21.10", + "rustls", "tokio", - "tokio-rustls 0.24.1", + "tokio-rustls", ] [[package]] @@ -1929,6 +2118,18 @@ dependencies = [ "libsecp256k1-core", ] +[[package]] +name = "light-poseidon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" +dependencies = [ + "ark-bn254", + "ark-ff", + "num-bigint 0.4.4", + "thiserror", +] + [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -2073,15 +2274,16 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] [[package]] name = "mpl-core" -version = "0.5.1" +version = "0.6.0" dependencies = [ + "anchor-lang", "assert_matches", "base64 0.22.0", "borsh 0.10.3", @@ -2115,9 +2317,9 @@ dependencies = [ [[package]] name = "mpl-utils" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5487a93ce5e3d1e0b5857772f0e605b1ba83d2fc776988f8b8aaffd360f016f7" +checksum = "8ee1b830bfd014504a11b2234e2e7d6af535adda601f224cd519b923f593c91b" dependencies = [ "arrayref", "solana-program", @@ -2199,8 +2401,8 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -2210,8 +2412,8 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -2292,8 +2494,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ "proc-macro-crate 1.3.1", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -2304,8 +2506,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ "proc-macro-crate 3.1.0", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -2394,8 +2596,8 @@ checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" dependencies = [ "Inflector", "proc-macro-error", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -2485,8 +2687,8 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -2599,8 +2801,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", "version_check", ] @@ -2611,20 +2813,11 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "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.76" @@ -2643,63 +2836,63 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "qualifier_attr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "quinn" -version = "0.9.4" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8b432585672228923edbbf64b8b12c14e1112f62e88737655b4a083dbcd78e" +checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" dependencies = [ "bytes", "pin-project-lite", "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.20.9", + "rustls", "thiserror", "tokio", "tracing", - "webpki", ] [[package]] name = "quinn-proto" -version = "0.9.6" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b0b33c13a79f669c85defaf4c275dc86a0c0372807d0ca3d78e0bb87274863" +checksum = "141bf7dfde2fbc246bfd3fe12f2455aa24b0fbd9af535d8c86c7bd1381ff2b1a" dependencies = [ "bytes", "rand 0.8.5", "ring 0.16.20", "rustc-hash", - "rustls 0.20.9", + "rustls", "rustls-native-certs", "slab", "thiserror", "tinyvec", "tracing", - "webpki", ] [[package]] name = "quinn-udp" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "641538578b21f5e5c8ea733b736895576d0fe329bb883b937db6f4d163dbaaf4" +checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" dependencies = [ + "bytes", "libc", - "quinn-proto", - "socket2 0.4.10", + "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", + "windows-sys 0.48.0", ] [[package]] @@ -2708,7 +2901,7 @@ version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ - "proc-macro2 1.0.76", + "proc-macro2", ] [[package]] @@ -2885,14 +3078,14 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.10", + "rustls", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "system-configuration", "tokio", - "tokio-rustls 0.24.1", + "tokio-rustls", "tokio-util 0.7.10", "tower-service", "url", @@ -2996,18 +3189,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.20.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" -dependencies = [ - "log", - "ring 0.16.20", - "sct", - "webpki", -] - [[package]] name = "rustls" version = "0.21.10" @@ -3102,8 +3283,8 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -3170,8 +3351,8 @@ version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -3232,8 +3413,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" dependencies = [ "darling", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -3244,16 +3425,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" dependencies = [ "darling", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] [[package]] -name = "sha-1" -version = "0.10.1" +name = "sha1" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -3321,8 +3502,8 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9bf2645f8eebde043da69200195058e7b59806705104f908a31d05ca82844ce" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "shank_macro_impl", "shank_render", "syn 1.0.109", @@ -3335,8 +3516,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93d0593f48acb0a722906416b1f6b8926f6571eb9af16d566a7c65427f269f50" dependencies = [ "anyhow", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "serde", "syn 1.0.109", ] @@ -3347,8 +3528,8 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "121175ba61809189f888dc5822ebfd30fa0d91e1e1f61d25a4d40b0847b3075e" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "shank_macro_impl", ] @@ -3382,6 +3563,12 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "sized-chunks" version = "0.6.5" @@ -3407,16 +3594,6 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.5.5" @@ -3429,34 +3606,93 @@ dependencies = [ [[package]] name = "solana-account-decoder" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5763ba7519b166b152ca2c6f8defa22cd07d3aea42a3a86b74519857fc3d464" +checksum = "21ed570fba6f909f69c888b48b39c7e61b454e3594e448d0dad9d973f27f5668" dependencies = [ "Inflector", "base64 0.21.7", "bincode", - "bs58", + "bs58 0.4.0", "bv", "lazy_static", "serde", "serde_derive", "serde_json", - "solana-address-lookup-table-program", "solana-config-program", "solana-sdk", "spl-token", - "spl-token-2022 0.9.0", + "spl-token-2022 1.0.0", + "spl-token-group-interface", "spl-token-metadata-interface", "thiserror", "zstd", ] +[[package]] +name = "solana-accounts-db" +version = "1.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c457b335c3b13b0df99ffee59cf8b3d92e861abbddd0de93993367f449a76c" +dependencies = [ + "arrayref", + "bincode", + "blake3", + "bv", + "bytemuck", + "byteorder", + "bzip2", + "crossbeam-channel", + "dashmap", + "flate2", + "fnv", + "fs-err", + "im", + "index_list", + "itertools", + "lazy_static", + "log", + "lz4", + "memmap2", + "modular-bitfield", + "num-derive 0.3.3", + "num-traits", + "num_cpus", + "num_enum 0.6.1", + "ouroboros", + "percentage", + "qualifier_attr", + "rand 0.8.5", + "rayon", + "regex", + "rustc_version", + "serde", + "serde_derive", + "solana-bucket-map", + "solana-config-program", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-measure", + "solana-metrics", + "solana-program-runtime", + "solana-rayon-threadlimit", + "solana-sdk", + "solana-stake-program", + "solana-system-program", + "solana-vote-program", + "static_assertions", + "strum 0.24.1", + "strum_macros 0.24.3", + "tar", + "tempfile", + "thiserror", +] + [[package]] name = "solana-address-lookup-table-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a216474b9d25153d629aa7f4fb2246bc875ebe90e1155380e0436c209e62d5" +checksum = "dba35ca5c434b2479a2a55b831461bd8cfdf2c389ee3ae4a0fc51918fbe17d88" dependencies = [ "bincode", "bytemuck", @@ -3475,9 +3711,9 @@ dependencies = [ [[package]] name = "solana-banks-client" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd7f5b9262637ec61f0755d0a657332c61d8d7b6a1fa63c64664391b469a6282" +checksum = "9f22c7a0b5d1a81193875dded16ed189666fab0b753d46faec311c2798e0af34" dependencies = [ "borsh 0.10.3", "futures", @@ -3492,9 +3728,9 @@ dependencies = [ [[package]] name = "solana-banks-interface" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0610d7fee589a2ab66c0f7d08866fa8be7c3851b8e3361948134cd6116b1d077" +checksum = "7c2652008dcd55d163e08e4d94c2b7592cb8562b33e168ac86462ddac4dca143" dependencies = [ "serde", "solana-sdk", @@ -3503,13 +3739,14 @@ dependencies = [ [[package]] name = "solana-banks-server" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2209441a76b00a9b8368df8af84fbba695ef08c70fc66e885c5cb533ee4a85b" +checksum = "5a01440c39a08f90f8016013918491f8ffe16d066efe0508f9cb12e2863f6eaf" dependencies = [ "bincode", "crossbeam-channel", "futures", + "solana-accounts-db", "solana-banks-interface", "solana-client", "solana-runtime", @@ -3522,15 +3759,15 @@ dependencies = [ [[package]] name = "solana-bpf-loader-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c23c74148a75c1e5f8bb26113306198be1f030e75f3e23f8335470d9e014227" +checksum = "571e8ef9d82bec9d32dd2d54b00e1572a85c967ed996cf737f3a52946d760623" dependencies = [ "bincode", "byteorder", "libsecp256k1", "log", - "rand 0.7.3", + "scopeguard", "solana-measure", "solana-program-runtime", "solana-sdk", @@ -3541,16 +3778,17 @@ dependencies = [ [[package]] name = "solana-bucket-map" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dae145ef8145f850fc3fb832802ebed13dd91a51fff457d5f06f5c31a62efee" +checksum = "109fdb52669846283bc6ef2ed87c832295af6f7e3c4e7888127b3d506054d651" dependencies = [ "bv", + "bytemuck", "log", "memmap2", "modular-bitfield", "num_enum 0.6.1", - "rand 0.7.3", + "rand 0.8.5", "solana-measure", "solana-sdk", "tempfile", @@ -3558,14 +3796,13 @@ dependencies = [ [[package]] name = "solana-clap-utils" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bef7e2234cf1179b8ceadfae922d38d79f82932a762ff62b0051e0b3205984f" +checksum = "b4729fec3c2ac37b7daaf24c1ef879bbedbff3495b1ac728d9b627282d878753" dependencies = [ "chrono", "clap 2.34.0", "rpassword", - "solana-perf", "solana-remote-wallet", "solana-sdk", "thiserror", @@ -3576,19 +3813,19 @@ dependencies = [ [[package]] name = "solana-client" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2644f5a0c91f8c44db175d35d52bf772799597dbedf6a5d9f138d61e2b52b826" +checksum = "2da13019a833940af2edebda969db4337ab11c6fb220eb0d4c02d79c83ae8034" dependencies = [ "async-trait", "bincode", + "dashmap", "futures", "futures-util", - "indexmap 1.9.3", + "indexmap 2.1.0", "indicatif", "log", "quinn", - "rand 0.7.3", "rayon", "solana-connection-cache", "solana-measure", @@ -3609,9 +3846,9 @@ dependencies = [ [[package]] name = "solana-compute-budget-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61fe4b2d4e756c32139444cc3f8ee32fdc9b9aceb02e82216694fd36141dd126" +checksum = "0ba64641b22efb6332088dc5892369a2f2049f83e66459ea300a4fc74a7a9f84" dependencies = [ "solana-program-runtime", "solana-sdk", @@ -3619,9 +3856,9 @@ dependencies = [ [[package]] name = "solana-config-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bb9b6d2c575e1eecd85380cb6442525a0d2639afa627552264eaa7050f47fb3" +checksum = "04b91ca968a63946e7513a1de20188e6e917f09136339ee3bec247aa0e985d36" dependencies = [ "bincode", "chrono", @@ -3633,16 +3870,17 @@ dependencies = [ [[package]] name = "solana-connection-cache" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcd27f413c3702ee20bbf1152e928f9adff0a37fef0f36b956d4eb34aae2be71" +checksum = "49a850c0122f094efb83df00ab080ab6ace0dcd8dbf91240f91832157ee6d460" dependencies = [ "async-trait", "bincode", + "crossbeam-channel", "futures-util", - "indexmap 1.9.3", + "indexmap 2.1.0", "log", - "rand 0.7.3", + "rand 0.8.5", "rayon", "rcgen", "solana-measure", @@ -3652,28 +3890,49 @@ dependencies = [ "tokio", ] +[[package]] +name = "solana-cost-model" +version = "1.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c6e08e5be41ab19c7906a6b6adf58172fd49ee042f8511a6c4e0155daa1b7c" +dependencies = [ + "lazy_static", + "log", + "rustc_version", + "solana-address-lookup-table-program", + "solana-bpf-loader-program", + "solana-compute-budget-program", + "solana-config-program", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-loader-v4-program", + "solana-metrics", + "solana-program-runtime", + "solana-sdk", + "solana-stake-program", + "solana-system-program", + "solana-vote-program", +] + [[package]] name = "solana-frozen-abi" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7077f6495ccc313dff49c3e3f3ed03e49058258bae7fee77ac29ba0a474ba82" +checksum = "8e2c5e5dde22cac045d29675b3fefa84817e1f63b0b911d094c599e80c0c07d9" dependencies = [ "ahash 0.8.6", "blake3", "block-buffer 0.10.4", - "bs58", + "bs58 0.4.0", "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", @@ -3687,24 +3946,23 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f516f992211a2ab70de5c367190575c97e02d156f9f1d8b76886d673f30e88a2" +checksum = "296e4cf0e2479e4c21afe4d17e32526f71f1bcd93b1c7c660900bc3e4233447a" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "rustc_version", "syn 2.0.48", ] [[package]] name = "solana-loader-v4-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb13799b6df3e8ebd19862dabbb51781774d300405cbab244b35c482edc700ca" +checksum = "a902445f0bdf610e7eec94dab7f4a8e756d001c17651647730f1efcb9d7af6fe" dependencies = [ "log", - "rand 0.7.3", "solana-measure", "solana-program-runtime", "solana-sdk", @@ -3713,9 +3971,9 @@ dependencies = [ [[package]] name = "solana-logger" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b64def674bfaa4a3f8be7ba19c03c9caec4ec028ba62b9a427ec1bf608a2486" +checksum = "d37a1b1a383a01039afbc6447a1712fb2a1a73a5ba8916762e693e8e492fabf3" dependencies = [ "env_logger", "lazy_static", @@ -3724,9 +3982,9 @@ dependencies = [ [[package]] name = "solana-measure" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "932db6604bcf8ba3bba68e80564d7eaa0dd7b9667407e15c3557caa83203aee7" +checksum = "19831a93d760205f5c3e20d05a37b0e533caa1889e48041648ad0859e68ec336" dependencies = [ "log", "solana-sdk", @@ -3734,9 +3992,9 @@ dependencies = [ [[package]] name = "solana-metrics" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d81931f224798c0e52062b0683a07eebe1c1904954c8765773c9802a28fbd0c" +checksum = "f63c23a8db755b2903262ad473e32cbf0093e2d3a0a7b8183d797a182c08326a" dependencies = [ "crossbeam-channel", "gethostname", @@ -3744,23 +4002,24 @@ dependencies = [ "log", "reqwest", "solana-sdk", + "thiserror", ] [[package]] name = "solana-net-utils" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea3420fa9da3789548f31b3c68e6a090bfd1320c735289851b711546d38e3b0" +checksum = "29ac1afc7feb590b45fd72bee0ca4c4f24b2386184d7e00d9f0d17913655bb4a" dependencies = [ "bincode", "clap 3.2.25", "crossbeam-channel", "log", "nix", - "rand 0.7.3", + "rand 0.8.5", "serde", "serde_derive", - "socket2 0.4.10", + "socket2", "solana-logger", "solana-sdk", "solana-version", @@ -3770,25 +4029,27 @@ dependencies = [ [[package]] name = "solana-perf" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5859de708bd12fb189f3c161cda03fdd341ffcf6be4fe787c7d730a30d589ac6" +checksum = "bfdf5a429e018e8ba693f4c43f833192db421fe97b88dfaf97041aa258e4b191" dependencies = [ "ahash 0.8.6", "bincode", "bv", "caps", "curve25519-dalek", - "dlopen", - "dlopen_derive", + "dlopen2", "fnv", "lazy_static", "libc", "log", "nix", - "rand 0.7.3", + "rand 0.8.5", "rayon", + "rustc_version", "serde", + "solana-frozen-abi", + "solana-frozen-abi-macro", "solana-metrics", "solana-rayon-threadlimit", "solana-sdk", @@ -3797,22 +4058,21 @@ dependencies = [ [[package]] name = "solana-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e92350aa5b42564681655331e7e0b9d5c99a442de317ceeb4741efbbe9a6c05" +checksum = "8e3a3b9623f09e2c480b4e129c92d7a036f8614fd0fc7519791bd44e64061ce8" dependencies = [ "ark-bn254", "ark-ec", "ark-ff", "ark-serialize", - "array-bytes", "base64 0.21.7", "bincode", - "bitflags 1.3.2", + "bitflags 2.5.0", "blake3", "borsh 0.10.3", "borsh 0.9.3", - "bs58", + "bs58 0.4.0", "bv", "bytemuck", "cc", @@ -3825,14 +4085,14 @@ dependencies = [ "lazy_static", "libc", "libsecp256k1", + "light-poseidon", "log", "memoffset 0.9.0", "num-bigint 0.4.4", "num-derive 0.3.3", "num-traits", "parking_lot", - "rand 0.7.3", - "rand_chacha 0.2.2", + "rand 0.8.5", "rustc_version", "rustversion", "serde", @@ -3852,9 +4112,9 @@ dependencies = [ [[package]] name = "solana-program-runtime" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da0e9dd63326ded2055b42e54aa37baa6aeb8adaea658a0059c234af6d05c02" +checksum = "9d5dbb56d36cc15b4cf5a71c0ce6262a263212f7a312b0dbc41b226654329c37" dependencies = [ "base64 0.21.7", "bincode", @@ -3866,7 +4126,7 @@ dependencies = [ "num-derive 0.3.3", "num-traits", "percentage", - "rand 0.7.3", + "rand 0.8.5", "rustc_version", "serde", "solana-frozen-abi", @@ -3880,9 +4140,9 @@ dependencies = [ [[package]] name = "solana-program-test" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d72aaaabfc85bb6750c14ff6b69df500ed07749dbc2b775d4499f6b1eb5ceef7" +checksum = "61bbf119c35d4393702953e586b72053c3b80a92c781931cd412d53d2036475e" dependencies = [ "assert_matches", "async-trait", @@ -3892,6 +4152,7 @@ dependencies = [ "crossbeam-channel", "log", "serde", + "solana-accounts-db", "solana-banks-client", "solana-banks-interface", "solana-banks-server", @@ -3901,15 +4162,17 @@ dependencies = [ "solana-runtime", "solana-sdk", "solana-vote-program", + "solana_rbpf", + "test-case", "thiserror", "tokio", ] [[package]] name = "solana-pubsub-client" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d1ad6fa8f0e154b91e67969fdf5478e74b75a87d5e3dce14ab83f4cb2f60f1" +checksum = "2c22290c0d296a6a250a8d5b680797f12138a81af9c403a6ce62bd3ddad307e6" dependencies = [ "crossbeam-channel", "futures-util", @@ -3932,9 +4195,9 @@ dependencies = [ [[package]] name = "solana-quic-client" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de9426ee9c0f98522242d6656db18175a022959af0b8ed3f170729e29933cf08" +checksum = "f924d8722f9e910d790678a79c2a0bfed786dffe1aefa5d769f8548679794263" dependencies = [ "async-mutex", "async-trait", @@ -3944,9 +4207,8 @@ dependencies = [ "log", "quinn", "quinn-proto", - "quinn-udp", "rcgen", - "rustls 0.20.9", + "rustls", "solana-connection-cache", "solana-measure", "solana-metrics", @@ -3960,9 +4222,9 @@ dependencies = [ [[package]] name = "solana-rayon-threadlimit" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e6c7a43e34d7db0ad158690b331df15b92f6996e3b9b03629591a54fc3e97f" +checksum = "bc0a2e484e5b272690ac1431a6821f2b5180149d67c56934d9e007224ced15d0" dependencies = [ "lazy_static", "num_cpus", @@ -3970,9 +4232,9 @@ dependencies = [ [[package]] name = "solana-remote-wallet" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed87a28ede1536be71352e13965b1fe7a2cf205e3e4fae2eef8a3407219ba1cd" +checksum = "fb9a96d1c001d07a0abb08e05b92ff6528b2d9239d03c57f99f738527839eb12" dependencies = [ "console", "dialoguer", @@ -3989,14 +4251,14 @@ dependencies = [ [[package]] name = "solana-rpc-client" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f273acbce4493bc1de8174b94cfaee112b72263ae1684a6e13890f5004be53fb" +checksum = "91503edfdb2ba9c5e0127048e7795f22e050cf2bcee1259361af113d533b4b26" dependencies = [ "async-trait", "base64 0.21.7", "bincode", - "bs58", + "bs58 0.4.0", "indicatif", "log", "reqwest", @@ -4015,12 +4277,12 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4462198830687b83870985db945c5d49c720d83abf516c8206fefba12cca689d" +checksum = "131662e5eea4fa5fc88b01f07d9e430315c0976be848ba3994244249c5fb033a" dependencies = [ "base64 0.21.7", - "bs58", + "bs58 0.4.0", "jsonrpc-core", "reqwest", "semver", @@ -4031,15 +4293,15 @@ dependencies = [ "solana-sdk", "solana-transaction-status", "solana-version", - "spl-token-2022 0.9.0", + "spl-token-2022 1.0.0", "thiserror", ] [[package]] name = "solana-rpc-client-nonce-utils" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91b3abad7b1ffd4b29d33b7525ebbc2ec8d0ca5928e4d8f28e364928d68a8dd9" +checksum = "f67cdff955b9994ae240f6f287420c6727a581120c02ccc4f2fa535886732a1d" dependencies = [ "clap 2.34.0", "solana-clap-utils", @@ -4050,9 +4312,9 @@ dependencies = [ [[package]] name = "solana-runtime" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c014aff6ce20b28f1e5057a3f78081821d4b62eccd9dc3b6a7e756be85f8bc4" +checksum = "cf63159e669f29065c9ff280c09f5b96139b00258502ee401338150fce78fed7" dependencies = [ "arrayref", "base64 0.21.7", @@ -4067,6 +4329,7 @@ dependencies = [ "dir-diff", "flate2", "fnv", + "fs-err", "im", "index_list", "itertools", @@ -4080,21 +4343,24 @@ dependencies = [ "num-traits", "num_cpus", "num_enum 0.6.1", - "once_cell", "ouroboros", "percentage", - "rand 0.7.3", + "qualifier_attr", + "rand 0.8.5", "rayon", "regex", "rustc_version", "serde", "serde_derive", "serde_json", + "siphasher", + "solana-accounts-db", "solana-address-lookup-table-program", "solana-bpf-loader-program", "solana-bucket-map", "solana-compute-budget-program", "solana-config-program", + "solana-cost-model", "solana-frozen-abi", "solana-frozen-abi-macro", "solana-loader-v4-program", @@ -4107,6 +4373,7 @@ dependencies = [ "solana-stake-program", "solana-system-program", "solana-version", + "solana-vote", "solana-vote-program", "solana-zk-token-proof-program", "solana-zk-token-sdk", @@ -4122,16 +4389,16 @@ dependencies = [ [[package]] name = "solana-sdk" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2087e15c92d4d6b3f085dc12fbe9614141c811f90a54cc418240ac30b608133f" +checksum = "cb34583922c5e79004ad8d8d69f333d274d21b614f0e1a575f325fc29a104ec2" dependencies = [ "assert_matches", "base64 0.21.7", "bincode", - "bitflags 1.3.2", + "bitflags 2.5.0", "borsh 0.10.3", - "bs58", + "bs58 0.4.0", "bytemuck", "byteorder", "chrono", @@ -4152,8 +4419,9 @@ dependencies = [ "num_enum 0.6.1", "pbkdf2 0.11.0", "qstring", + "qualifier_attr", "rand 0.7.3", - "rand_chacha 0.2.2", + "rand 0.8.5", "rustc_version", "rustversion", "serde", @@ -4175,22 +4443,28 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0e0e7ee984b0f9179a1d4f4e9e67ce675de2324b5a98b61d2bdb61be3c19bb" +checksum = "60f58786e949f43b8c9b826fdfa5ad8586634b077ab04f989fb8e30535786712" dependencies = [ - "bs58", - "proc-macro2 1.0.76", - "quote 1.0.35", + "bs58 0.4.0", + "proc-macro2", + "quote", "rustversion", "syn 2.0.48", ] +[[package]] +name = "solana-security-txt" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" + [[package]] name = "solana-send-transaction-service" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1afb10d881ba8eecf2edbfffe7d51b7f27b953f1ab2148cb3ba0157e4bf6c75" +checksum = "9987eccfe96b38785d95840277da4238de4f01166d0c32ec9bbfc5a319f4a530" dependencies = [ "crossbeam-channel", "log", @@ -4204,9 +4478,9 @@ dependencies = [ [[package]] name = "solana-stake-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a543a3de0eb703e856dca5b92b4fe461bac5aa12080bd8486105acf265cbb68d" +checksum = "5ab247c866dab350bf610df8e1fab97ae0a0519cb81914348d382eac9e80940d" dependencies = [ "bincode", "log", @@ -4219,16 +4493,16 @@ dependencies = [ [[package]] name = "solana-streamer" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a868a782cab696677cd12deacda1862dbeeba903a4a8d8404a4d6bf45e8a556c" +checksum = "efe4c33e0f68ea7a3701650badf6753b85fef2100cac6bc187c8e443e61c53da" dependencies = [ "async-channel", "bytes", "crossbeam-channel", "futures-util", "histogram", - "indexmap 1.9.3", + "indexmap 2.1.0", "itertools", "libc", "log", @@ -4238,10 +4512,9 @@ dependencies = [ "pkcs8", "quinn", "quinn-proto", - "quinn-udp", - "rand 0.7.3", + "rand 0.8.5", "rcgen", - "rustls 0.20.9", + "rustls", "solana-metrics", "solana-perf", "solana-sdk", @@ -4252,9 +4525,9 @@ dependencies = [ [[package]] name = "solana-system-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf47ccfe21b717fa4a3d6c26d8d77a039648c456d3fc37ebf3e0c8ea95c5f37b" +checksum = "24147d17f13bef6548d15a7fc63eb8a3271523f7ffc91f13032944b0dc34f974" dependencies = [ "bincode", "log", @@ -4266,9 +4539,9 @@ dependencies = [ [[package]] name = "solana-thin-client" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222f5539a4b01a5374c919e78aca5d4472fa5af6e551bf9f4ddd97ca59374f6d" +checksum = "54e782aabf9443a36d65e74d70ce732cc844707a5fec5a498bcbd81d3de7598c" dependencies = [ "bincode", "log", @@ -4281,17 +4554,16 @@ dependencies = [ [[package]] name = "solana-tpu-client" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c0f954b48dda0a907dbdb54387459c8eb7e9c702f278bf70a2caf3ebc417c88" +checksum = "980bee30cbfe3c51f973da7fdcccb9df2c2d9b9175c06066b293499e02108fd4" dependencies = [ "async-trait", "bincode", "futures-util", - "indexmap 1.9.3", + "indexmap 2.1.0", "indicatif", "log", - "rand 0.7.3", "rayon", "solana-connection-cache", "solana-measure", @@ -4306,35 +4578,34 @@ dependencies = [ [[package]] name = "solana-transaction-status" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7992d9605a65967b5e40e6ef8e285a953888e4789f0f5e3fb7339bf018cbb677" +checksum = "4c180013e406418d593ce7b51da7007a638ace18261de14901b090e53a1d7025" dependencies = [ "Inflector", "base64 0.21.7", "bincode", "borsh 0.10.3", - "bs58", + "bs58 0.4.0", "lazy_static", "log", "serde", "serde_derive", "serde_json", "solana-account-decoder", - "solana-address-lookup-table-program", "solana-sdk", "spl-associated-token-account", "spl-memo", "spl-token", - "spl-token-2022 0.9.0", + "spl-token-2022 1.0.0", "thiserror", ] [[package]] name = "solana-udp-client" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4329dfe364cb276c7137b459e3737a27d6ae180f60d0aa2274d8be86cac3472c" +checksum = "ab995970a424c89b7966a01aec90cdf1685c49aacf38a5f463200fc273a7d86b" dependencies = [ "async-trait", "solana-connection-cache", @@ -4347,9 +4618,9 @@ dependencies = [ [[package]] name = "solana-version" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1931390daf0938c072c167611a263a8b95c13476d7fff7c8eb12789a981685b3" +checksum = "b32cc394aa7132ab7f270801b98bf47fa585ab93f1038e5be27e480d7b5b2dca" dependencies = [ "log", "rustc_version", @@ -4361,11 +4632,30 @@ dependencies = [ "solana-sdk", ] +[[package]] +name = "solana-vote" +version = "1.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6092058284f0e02274177c45a22032eb7288aa4f6f8003ed469b1a562cac3bd" +dependencies = [ + "crossbeam-channel", + "itertools", + "log", + "rustc_version", + "serde", + "serde_derive", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk", + "solana-vote-program", + "thiserror", +] + [[package]] name = "solana-vote-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25669860e2c5e821a8caa5372589289fbb6ac3084096133fdd1c6af6546536a2" +checksum = "589cad4dccb4392e23f5ae4ccdd1f0aaa10f2823b264b27c4feb6382f40f4fd4" dependencies = [ "bincode", "log", @@ -4385,12 +4675,11 @@ dependencies = [ [[package]] name = "solana-zk-token-proof-program" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1a6a21efae8933fbdafef2f913a1a5791b061fa3e902c145173d444d09fe31e" +checksum = "cc6b02ddeb2ab414b513b523aa678fac81109214f08d5c080165c15483a22cce" dependencies = [ "bytemuck", - "getrandom 0.1.16", "num-derive 0.3.3", "num-traits", "solana-program-runtime", @@ -4400,9 +4689,9 @@ dependencies = [ [[package]] name = "solana-zk-token-sdk" -version = "1.16.25" +version = "1.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1457c85ab70a518438b9ac2b0c56037b9f6693060dfb617bbb93c7116e4f0c22" +checksum = "03d932d7b13a223a6c1068d7061df7e9d2de14bfc0a874350eef19d59086b04a" dependencies = [ "aes-gcm-siv", "base64 0.21.7", @@ -4429,9 +4718,9 @@ dependencies = [ [[package]] name = "solana_rbpf" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17d4ba1e58947346e360fabde0697029d36ba83c42f669199b16a8931313cf29" +checksum = "3d457cc2ba742c120492a64b7fa60e22c575e891f6b55039f4d736568fb112a3" dependencies = [ "byteorder", "combine", @@ -4470,9 +4759,9 @@ dependencies = [ [[package]] name = "spl-associated-token-account" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385e31c29981488f2820b2022d8e731aae3b02e6e18e2fd854e4c9a94dc44fc3" +checksum = "992d9c64c2564cc8f63a4b508bf3ebcdf2254b0429b13cd1d31adb6162432a5f" dependencies = [ "assert_matches", "borsh 0.10.3", @@ -4480,7 +4769,7 @@ dependencies = [ "num-traits", "solana-program", "spl-token", - "spl-token-2022 0.9.0", + "spl-token-2022 1.0.0", "thiserror", ] @@ -4501,7 +4790,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fadbefec4f3c678215ca72bd71862697bb06b41fd77c0088902dd3203354387b" dependencies = [ - "quote 1.0.35", + "quote", "spl-discriminator-syn", "syn 2.0.48", ] @@ -4512,8 +4801,8 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e5f2044ca42c8938d54d1255ce599c79a1ffd86b677dfab695caa20f9ffc3f2" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "sha2 0.10.8", "syn 2.0.48", "thiserror", @@ -4569,8 +4858,8 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5269c8e868da17b6552ef35a51355a017bd8e0eae269c201fef830d35fa52c" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "sha2 0.10.8", "syn 2.0.48", ] @@ -4591,9 +4880,9 @@ dependencies = [ [[package]] name = "spl-tlv-account-resolution" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062e148d3eab7b165582757453632ffeef490c02c86a48bfdb4988f63eefb3b9" +checksum = "615d381f48ddd2bb3c57c7f7fb207591a2a05054639b18a62e785117dd7a8683" dependencies = [ "bytemuck", "solana-program", @@ -4642,9 +4931,9 @@ dependencies = [ [[package]] name = "spl-token-2022" -version = "0.9.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4abf34a65ba420584a0c35f3903f8d727d1f13ababbdc3f714c6b065a686e86" +checksum = "d697fac19fd74ff472dfcc13f0b442dd71403178ce1de7b5d16f83a33561c059" dependencies = [ "arrayref", "bytemuck", @@ -4652,16 +4941,31 @@ dependencies = [ "num-traits", "num_enum 0.7.2", "solana-program", + "solana-security-txt", "solana-zk-token-sdk", "spl-memo", "spl-pod", "spl-token", + "spl-token-group-interface", "spl-token-metadata-interface", - "spl-transfer-hook-interface 0.3.0", + "spl-transfer-hook-interface 0.4.1", "spl-type-length-value", "thiserror", ] +[[package]] +name = "spl-token-group-interface" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b889509d49fa74a4a033ca5dae6c2307e9e918122d97e58562f5c4ffa795c75d" +dependencies = [ + "bytemuck", + "solana-program", + "spl-discriminator", + "spl-pod", + "spl-program-error", +] + [[package]] name = "spl-token-metadata-interface" version = "0.2.0" @@ -4694,9 +4998,9 @@ dependencies = [ [[package]] name = "spl-transfer-hook-interface" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051d31803f873cabe71aec3c1b849f35248beae5d19a347d93a5c9cccc5d5a9b" +checksum = "7aabdb7c471566f6ddcee724beb8618449ea24b399e58d464d6b5bc7db550259" dependencies = [ "arrayref", "bytemuck", @@ -4704,7 +5008,7 @@ dependencies = [ "spl-discriminator", "spl-pod", "spl-program-error", - "spl-tlv-account-resolution 0.4.0", + "spl-tlv-account-resolution 0.5.1", "spl-type-length-value", ] @@ -4763,9 +5067,9 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck", - "proc-macro2 1.0.76", - "quote 1.0.35", + "heck 0.4.1", + "proc-macro2", + "quote", "rustversion", "syn 1.0.109", ] @@ -4776,9 +5080,9 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18" dependencies = [ - "heck", - "proc-macro2 1.0.76", - "quote 1.0.35", + "heck 0.4.1", + "proc-macro2", + "quote", "rustversion", "syn 2.0.48", ] @@ -4795,25 +5099,14 @@ 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.76", - "quote 1.0.35", + "proc-macro2", + "quote", "unicode-ident", ] @@ -4823,8 +5116,8 @@ version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "unicode-ident", ] @@ -4834,10 +5127,10 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", - "unicode-xid 0.2.4", + "unicode-xid", ] [[package]] @@ -4902,8 +5195,8 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee42b4e559f17bce0385ebf511a7beb67d5cc33c12c96b7f4e9789919d9c10f" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 1.0.109", ] @@ -4929,6 +5222,39 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "test-case" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb2550dd13afcd286853192af8601920d959b14c401fcece38071d53bf0768a8" +dependencies = [ + "test-case-macros", +] + +[[package]] +name = "test-case-core" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcb7fd841cd518e279be3d5a3eb0636409487998a4aff22f3de87b81e88384f" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "test-case-macros" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", + "test-case-core", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -4959,8 +5285,8 @@ version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -5051,7 +5377,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2", "tokio-macros", "windows-sys 0.48.0", ] @@ -5062,29 +5388,18 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls 0.20.9", - "tokio", - "webpki", -] - [[package]] name = "tokio-rustls" version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.10", + "rustls", "tokio", ] @@ -5117,18 +5432,17 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.17.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "rustls 0.20.9", + "rustls", "tokio", - "tokio-rustls 0.23.4", + "tokio-rustls", "tungstenite", - "webpki", - "webpki-roots 0.22.6", + "webpki-roots 0.25.3", ] [[package]] @@ -5221,8 +5535,8 @@ version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -5268,24 +5582,23 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.17.3" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ - "base64 0.13.1", "byteorder", "bytes", + "data-encoding", "http", "httparse", "log", "rand 0.8.5", - "rustls 0.20.9", - "sha-1", + "rustls", + "sha1", "thiserror", "url", "utf-8", - "webpki", - "webpki-roots 0.22.6", + "webpki-roots 0.24.0", ] [[package]] @@ -5316,16 +5629,16 @@ dependencies = [ ] [[package]] -name = "unicode-width" -version = "0.1.11" +name = "unicode-segmentation" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] -name = "unicode-xid" -version = "0.1.0" +name = "unicode-width" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "unicode-xid" @@ -5465,8 +5778,8 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", "wasm-bindgen-shared", ] @@ -5489,7 +5802,7 @@ version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ - "quote 1.0.35", + "quote", "wasm-bindgen-macro-support", ] @@ -5499,8 +5812,8 @@ version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -5522,23 +5835,13 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" -dependencies = [ - "ring 0.17.7", - "untrusted 0.9.0", -] - [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" dependencies = [ - "webpki", + "rustls-webpki", ] [[package]] @@ -5587,21 +5890,6 @@ dependencies = [ "windows-targets 0.52.0", ] -[[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.48.0" @@ -5650,12 +5938,6 @@ dependencies = [ "windows_x86_64_msvc 0.52.0", ] -[[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" @@ -5668,12 +5950,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" -[[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" @@ -5686,12 +5962,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" -[[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" @@ -5704,12 +5974,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" -[[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" @@ -5722,12 +5986,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" -[[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" @@ -5740,12 +5998,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" -[[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" @@ -5758,12 +6010,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" -[[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" @@ -5848,8 +6094,8 @@ version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] @@ -5868,8 +6114,8 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "proc-macro2 1.0.76", - "quote 1.0.35", + "proc-macro2", + "quote", "syn 2.0.48", ] diff --git a/README.md b/README.md index 974855ea..a77850b7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # Mpl Core -> [!WARNING] -> Metaplex Core is currently undergoing audit. Use in production at your own risk. - Digital Assets ## Documentation diff --git a/clients/js/README.md b/clients/js/README.md index 57047b31..5f2fc41e 100644 --- a/clients/js/README.md +++ b/clients/js/README.md @@ -38,138 +38,146 @@ A Umi-compatible JavaScript library for the project. 4. Examples ```ts // Create an asset - const assetAddress = generateSigner(umi); - const owner = generateSigner(umi); - - await createV1(umi, { - name: 'Test Asset', - uri: 'https://example.com/asset.json', - asset: assetAddress, - owner: owner.publicKey, // optional, will default to payer - }).sendAndConfirm(umi); - - // Create a collection - const collectionUpdateAuthority = generateSigner(umi); - const collectionAddress = generateSigner(umi); - await createCollectionV1(umi, { - name: 'Test Collection', - uri: 'https://example.com/collection.json', - collection: collectionAddress, - updateAuthority: collectionUpdateAuthority.publicKey, // optional, defaults to payer - }).sendAndConfirm(umi); - - // Create an asset in a collection, the authority must be the updateAuthority of the collection - await createV1(umi, { - name: 'Test Asset', - uri: 'https://example.com/asset.json', - asset: assetAddress, - collection: collectionAddress.publicKey, - authority: collectionUpdateAuthority, // optional, defaults to payer - }).sendAndConfirm(umi); - - // Transfer an asset - const recipient = generateSigner(umi); - await transferV1(umi, { - asset: assetAddress.publicKey, - newOwner: recipient.publicKey, - }).sendAndConfirm(umi); - - // Transfer an asset in a collection - await transferV1(umi, { - asset: assetAddress.publicKey, - newOwner: recipient.publicKey, - collection: collectionAddress.publicKey, - }).sendAndConfirm(umi); - - // Fetch an asset - const asset = await fetchAssetV1(umi, assetAddress.publicKey); - - // GPA fetch assets by owner - const assetsByOwner = await getAssetV1GpaBuilder(umi) - .whereField('key', Key.AssetV1) - .whereField('owner', owner.publicKey) - .getDeserialized(); - - // GPA fetch assets by collection - const assetsByCollection = await getAssetV1GpaBuilder(umi) - .whereField('key', Key.AssetV1) - .whereField( - 'updateAuthority', - updateAuthority('Collection', [collectionAddress.publicKey]) - ) - .getDeserialized(); - - // DAS API (RPC based indexing) fetch assets by owner/collection - // Coming soon + const assetAddress = generateSigner(umi); + const owner = generateSigner(umi); + + await create(umi, { + name: 'Test Asset', + uri: 'https://example.com/asset.json', + asset: assetAddress, + owner: owner.publicKey, // optional, will default to payer + }).sendAndConfirm(umi); + + // Fetch an asset + const asset = await fetchAssetV1(umi, assetAddress.publicKey); + + // Create a collection + const collectionUpdateAuthority = generateSigner(umi); + const collectionAddress = generateSigner(umi); + await createCollection(umi, { + name: 'Test Collection', + uri: 'https://example.com/collection.json', + collection: collectionAddress, + updateAuthority: collectionUpdateAuthority.publicKey, // optional, defaults to payer + }).sendAndConfirm(umi); + + // Fetch a collection + const collection = await fetchCollectionV1(umi, collectionAddress.publicKey); + + // Create an asset in a collection, the authority must be the updateAuthority of the collection + await create(umi, { + name: 'Test Asset', + uri: 'https://example.com/asset.json', + asset: assetAddress, + collection, + authority: collectionUpdateAuthority, // optional, defaults to payer + }).sendAndConfirm(umi); + + // Transfer an asset + const recipient = generateSigner(umi); + await transfer(umi, { + asset, + newOwner: recipient.publicKey, + }).sendAndConfirm(umi); + + // Transfer an asset in a collection + await transfer(umi, { + asset, + newOwner: recipient.publicKey, + collection, + }).sendAndConfirm(umi); + + // GPA fetch assets by owner + const assetsByOwner = await getAssetV1GpaBuilder(umi) + .whereField('key', Key.AssetV1) + .whereField('owner', owner.publicKey) + .getDeserialized(); + + // GPA fetch assets by collection + const assetsByCollection = await getAssetV1GpaBuilder(umi) + .whereField('key', Key.AssetV1) + .whereField( + 'updateAuthority', + updateAuthority('Collection', [collectionAddress.publicKey]) + ) + .getDeserialized(); + + // DAS API (RPC based indexing) fetch assets by owner/collection + // Coming soon ``` 5. Some advanced examples ```ts - // Freezing an asset - const assetAddress = generateSigner(umi); - const freezeDelegate = generateSigner(umi); - - await addPluginV1(umi, { - asset: assetAddress.publicKey, - // adds the owner-managed freeze plugin to the asset - plugin: createPlugin({ - type: 'FreezeDelegate', - data: { - frozen: true, - }, - }), + const umi = await createUmi(); + + // Freezing an asset + const assetAddress = generateSigner(umi); + const freezeDelegate = generateSigner(umi); + + await addPlugin(umi, { + asset: assetAddress.publicKey, + // adds the owner-managed freeze plugin to the asset + plugin: { + type: 'FreezeDelegate', + frozen: true, + // Optionally set the authority to a delegate who can unfreeze. If unset, this will be the Owner // This is functionally the same as calling addPlugin and approvePluginAuthority separately. // Freezing with a delegate is commonly used for escrowless staking programs. - initAuthority: addressPluginAuthority(freezeDelegate.publicKey), - }).sendAndConfirm(umi); - - // Unfreezing an asset with a delegate - // Revoking an authority will revert the authority back to the owner for owner-managed plugins - await revokePluginAuthorityV1(umi, { - asset: assetAddress.publicKey, - pluginType: PluginType.FreezeDelegate, - authority: freezeDelegate, - }).sendAndConfirm(umi); - - // Create a collection with royalties - const collectionAddress = generateSigner(umi); - const creator1 = generateSigner(umi); - const creator2 = generateSigner(umi); - - await createCollectionV1(umi, { - name: 'Test Collection', - uri: 'https://example.com/collection.json', - collection: collectionAddress, - plugins: [ - pluginAuthorityPair({ - type: 'Royalties', - data: { - basisPoints: 500, - creators: [ - { - address: creator1.publicKey, - percentage: 20, - }, - { - address: creator2.publicKey, - percentage: 80, - }, - ], - ruleSet: ruleSet('None'), // Compatibility rule set - }, - }), - ], - }).sendAndConfirm(umi); - - // Create an asset in a collection. - // Assets in a collection will inherit the collection's authority-managed plugins, in this case the royalties plugin - await createV1(umi, { - name: 'Test Asset', - uri: 'https://example.com/asset.json', - asset: assetAddress, - collection: collectionAddress.publicKey, - }).sendAndConfirm(umi); + authority: { + type: 'Address', + address: freezeDelegate.publicKey, + }, + } + }).sendAndConfirm(umi); + + // Unfreezing an asset with a delegate + // Revoking an authority will revert the authority back to the owner for owner-managed plugins + await revokePluginAuthority(umi, { + asset: assetAddress.publicKey, + plugin: { + type: 'FreezeDelegate', + }, + authority: freezeDelegate, + }).sendAndConfirm(umi); + + // Create a collection with royalties + const collectionAddress = generateSigner(umi); + const creator1 = generateSigner(umi); + const creator2 = generateSigner(umi); + + await createCollection(umi, { + name: 'Test Collection', + uri: 'https://example.com/collection.json', + collection: collectionAddress, + plugins: [ + { + type: 'Royalties', + basisPoints: 500, + creators: [ + { + address: creator1.publicKey, + percentage: 20, + }, + { + address: creator2.publicKey, + percentage: 80, + }, + ], + ruleSet: ruleSet('None'), // Compatibility rule set + + }, + ], + }).sendAndConfirm(umi); + + // Create an asset in a collection. + // Assets in a collection will inherit the collection's authority-managed plugins, in this case the royalties plugin + await create(umi, { + name: 'Test Asset', + uri: 'https://example.com/asset.json', + asset: assetAddress, + collection: await fetchCollectionV1(umi, collectionAddress.publicKey), + }).sendAndConfirm(umi); ``` You can learn more about this library's API by reading its generated [TypeDoc documentation](https://mpl-core-js-docs.vercel.app). diff --git a/clients/js/package.json b/clients/js/package.json index 35985f23..209f4b92 100644 --- a/clients/js/package.json +++ b/clients/js/package.json @@ -1,6 +1,6 @@ { "name": "@metaplex-foundation/mpl-core", - "version": "0.4.6", + "version": "0.4.7", "description": "Digital Assets", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -25,21 +25,20 @@ "repository": "https://github.com/metaplex-foundation/mpl-core.git", "author": "Metaplex Maintainers ", "license": "Apache-2.0", - "dependencies": {}, "peerDependencies": { "@metaplex-foundation/umi": ">=0.8.2 < 1", "@noble/hashes": "^1.3.1" }, "devDependencies": { - "@metaplex-foundation/mpl-toolbox": "^0.8.0", - "@ava/typescript": "^3.0.1", + "@ava/typescript": "^5.0.0", "@metaplex-foundation/mpl-core-oracle-example": "^0.0.1", + "@metaplex-foundation/mpl-toolbox": "^0.8.0", "@metaplex-foundation/umi": "^0.8.10", "@metaplex-foundation/umi-bundle-tests": "^0.8.10", "@solana/web3.js": "^1.73.0", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.46.1", - "ava": "^5.1.0", + "ava": "^6.1.3", "bs58": "5.0.0", "eslint": "^8.0.1", "eslint-config-airbnb-typescript": "^17.0.0", diff --git a/clients/js/pnpm-lock.yaml b/clients/js/pnpm-lock.yaml index df43c491..d09617b0 100644 --- a/clients/js/pnpm-lock.yaml +++ b/clients/js/pnpm-lock.yaml @@ -1,9 +1,5 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - dependencies: '@noble/hashes': specifier: ^1.3.1 @@ -11,8 +7,8 @@ dependencies: devDependencies: '@ava/typescript': - specifier: ^3.0.1 - version: 3.0.1 + specifier: ^5.0.0 + version: 5.0.0 '@metaplex-foundation/mpl-core-oracle-example': specifier: ^0.0.1 version: 0.0.1(@metaplex-foundation/umi@0.8.10)(@noble/hashes@1.3.1) @@ -35,8 +31,8 @@ devDependencies: specifier: ^5.46.1 version: 5.46.1(eslint@8.0.1)(typescript@4.9.4) ava: - specifier: ^5.1.0 - version: 5.1.0(@ava/typescript@3.0.1) + specifier: ^6.1.3 + version: 6.1.3(@ava/typescript@5.0.0) bs58: specifier: 5.0.0 version: 5.0.0 @@ -92,12 +88,12 @@ packages: '@jridgewell/trace-mapping': 0.3.25 dev: true - /@ava/typescript@3.0.1: - resolution: {integrity: sha512-/JXIUuKsvkaneaiA9ckk3ksFTqvu0mDNlChASrTe2BnDsvMbhQdPWyqQjJ9WRJWVhhs5TWn1/0Pp1G6Rv8Syrw==} - engines: {node: '>=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=17'} + /@ava/typescript@5.0.0: + resolution: {integrity: sha512-2twsQz2fUd95QK1MtKuEnjkiN47SKHZfi/vWj040EN6Eo2ZW3SNcAwncJqXXoMTYZTWtBRXYp3Fg8z+JkFI9aQ==} + engines: {node: ^18.18 || ^20.8 || ^21 || ^22} dependencies: escape-string-regexp: 5.0.0 - execa: 5.1.1 + execa: 8.0.1 dev: true /@babel/code-frame@7.23.5: @@ -2302,6 +2298,11 @@ packages: engines: {node: '>=10'} dev: true + /@sindresorhus/merge-streams@2.3.0: + resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} + engines: {node: '>=18'} + dev: true + /@solana/buffer-layout@4.0.1: resolution: {integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==} engines: {node: '>=5.10'} @@ -2777,6 +2778,28 @@ packages: - supports-color dev: true + /@vercel/nft@0.26.5: + resolution: {integrity: sha512-NHxohEqad6Ra/r4lGknO52uc/GrWILXAMs1BB4401GTqww0fw1bAqzpG1XHuDO+dprg4GvsD9ZLLSsdo78p9hQ==} + engines: {node: '>=16'} + hasBin: true + dependencies: + '@mapbox/node-pre-gyp': 1.0.11 + '@rollup/pluginutils': 4.2.1 + acorn: 8.11.3 + acorn-import-attributes: 1.9.5(acorn@8.11.3) + async-sema: 3.1.1 + bindings: 1.5.0 + estree-walker: 2.0.2 + glob: 7.2.3 + graceful-fs: 4.2.11 + micromatch: 4.0.5 + node-gyp-build: 4.8.1 + resolve-from: 5.0.0 + transitivePeerDependencies: + - encoding + - supports-color + dev: true + /@vercel/node-bridge@3.1.11: resolution: {integrity: sha512-LGbj+kPGgRnIlKo3949z01mLbHVi4BnRE7V5R6+J4E3f7xpQ12I9Wek10V7ivLB+LyS1+ATdjasdXAF4HOhqQw==} dev: true @@ -2895,6 +2918,14 @@ packages: negotiator: 0.6.3 dev: true + /acorn-import-attributes@1.9.5(acorn@8.11.3): + resolution: {integrity: sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==} + peerDependencies: + acorn: ^8 + dependencies: + acorn: 8.11.3 + dev: true + /acorn-jsx@5.3.2(acorn@8.11.3): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -2938,14 +2969,6 @@ packages: indent-string: 4.0.0 dev: true - /aggregate-error@4.0.1: - resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==} - engines: {node: '>=12'} - dependencies: - clean-stack: 4.2.0 - indent-string: 5.0.0 - dev: true - /ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -3142,9 +3165,9 @@ packages: resolution: {integrity: sha512-tLRNUXati5MFePdAk8dw7Qt7DpxPB60ofAgn8WRhW6a2rcimZnYBP9oxHiv0OHy+Wz7kPMG+t4LGdt31+4EmGg==} dev: true - /ava@5.1.0(@ava/typescript@3.0.1): - resolution: {integrity: sha512-e5VFrSQ0WBPyZJWRXVrO7RFOizFeNM0t2PORwrPvWtApgkORI6cvGnY3GX1G+lzpd0HjqNx5Jus22AhxVnUMNA==} - engines: {node: '>=14.19 <15 || >=16.15 <17 || >=18'} + /ava@6.1.3(@ava/typescript@5.0.0): + resolution: {integrity: sha512-tkKbpF1pIiC+q09wNU9OfyTDYZa8yuWvU2up3+lFJ3lr1RmnYh2GBpPwzYUEB0wvTPIUysGjcZLNZr7STDviRA==} + engines: {node: ^18.18 || ^20.8 || ^21 || ^22} hasBin: true peerDependencies: '@ava/typescript': '*' @@ -3152,46 +3175,41 @@ packages: '@ava/typescript': optional: true dependencies: - '@ava/typescript': 3.0.1 + '@ava/typescript': 5.0.0 + '@vercel/nft': 0.26.5 acorn: 8.11.3 acorn-walk: 8.3.2 ansi-styles: 6.2.1 arrgv: 1.0.2 arrify: 3.0.0 callsites: 4.1.0 - cbor: 8.1.0 + cbor: 9.0.2 chalk: 5.3.0 - chokidar: 3.6.0 chunkd: 2.0.1 - ci-info: 3.9.0 + ci-info: 4.0.0 ci-parallel-vars: 1.0.1 - clean-yaml-object: 0.1.0 - cli-truncate: 3.1.0 + cli-truncate: 4.0.0 code-excerpt: 4.0.0 common-path-prefix: 3.0.0 concordance: 5.0.4 currently-unhandled: 0.4.1 debug: 4.3.4 - del: 7.1.0 emittery: 1.0.3 - figures: 5.0.0 - globby: 13.2.2 + figures: 6.1.0 + globby: 14.0.1 ignore-by-default: 2.1.0 indent-string: 5.0.0 - is-error: 2.2.2 is-plain-object: 5.0.0 is-promise: 4.0.0 matcher: 5.0.0 - mem: 9.0.2 + memoize: 10.0.0 ms: 2.1.3 - p-event: 5.0.1 - p-map: 5.5.0 - picomatch: 2.3.1 - pkg-conf: 4.0.0 + p-map: 7.0.2 + package-config: 5.0.0 + picomatch: 3.0.1 plur: 5.1.0 - pretty-ms: 8.0.0 + pretty-ms: 9.0.0 resolve-cwd: 3.0.0 - slash: 3.0.0 stack-utils: 2.0.6 strip-ansi: 7.1.0 supertap: 3.0.1 @@ -3199,6 +3217,7 @@ packages: write-file-atomic: 5.0.1 yargs: 17.7.2 transitivePeerDependencies: + - encoding - supports-color dev: true @@ -3495,9 +3514,9 @@ packages: resolution: {integrity: sha512-LRAQHZ4yT1+f9LemSMeqdMpMxZcc4RMWdj4tiFe3G8tNkWK+E58g+/tzotb5cU6TbcVJLr4fySiAW7XmxQvZQA==} dev: true - /cbor@8.1.0: - resolution: {integrity: sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==} - engines: {node: '>=12.19'} + /cbor@9.0.2: + resolution: {integrity: sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ==} + engines: {node: '>=16'} dependencies: nofilter: 3.1.0 dev: true @@ -3572,8 +3591,8 @@ packages: resolution: {integrity: sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ==} dev: true - /ci-info@3.9.0: - resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} + /ci-info@4.0.0: + resolution: {integrity: sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==} engines: {node: '>=8'} dev: true @@ -3586,18 +3605,6 @@ packages: engines: {node: '>=6'} dev: true - /clean-stack@4.2.0: - resolution: {integrity: sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==} - engines: {node: '>=12'} - dependencies: - escape-string-regexp: 5.0.0 - dev: true - - /clean-yaml-object@0.1.0: - resolution: {integrity: sha512-3yONmlN9CSAkzNwnRCiJQ7Q2xK5mWuEfL3PuTZcAUzhObbXsfsnMptJzXwz93nc5zn9V9TwCVMmV7w4xsm43dw==} - engines: {node: '>=0.10.0'} - dev: true - /cli-cursor@3.1.0: resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} engines: {node: '>=8'} @@ -3610,12 +3617,12 @@ packages: engines: {node: '>=6'} dev: true - /cli-truncate@3.1.0: - resolution: {integrity: sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + /cli-truncate@4.0.0: + resolution: {integrity: sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==} + engines: {node: '>=18'} dependencies: slice-ansi: 5.0.0 - string-width: 5.1.2 + string-width: 7.1.0 dev: true /cli-width@3.0.0: @@ -3706,7 +3713,7 @@ packages: js-string-escape: 1.0.1 lodash: 4.17.21 md5-hex: 3.0.1 - semver: 7.6.0 + semver: 7.6.1 well-known-symbols: 2.0.0 dev: true @@ -3951,20 +3958,6 @@ packages: vm2: 3.9.19 dev: true - /del@7.1.0: - resolution: {integrity: sha512-v2KyNk7efxhlyHpjEvfyxaAihKKK0nWCuf6ZtqZcFFpQRG0bJ12Qsr0RpvsICMjAAZ8DOVCxrlqpxISlMHC4Kg==} - engines: {node: '>=14.16'} - dependencies: - globby: 13.2.2 - graceful-fs: 4.2.11 - is-glob: 4.0.3 - is-path-cwd: 3.0.0 - is-path-inside: 4.0.0 - p-map: 5.5.0 - rimraf: 3.0.2 - slash: 4.0.0 - dev: true - /delay@5.0.0: resolution: {integrity: sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==} engines: {node: '>=10'} @@ -4049,10 +4042,6 @@ packages: stream-shift: 1.0.3 dev: true - /eastasianwidth@0.2.0: - resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - dev: true - /edge-runtime@2.0.0: resolution: {integrity: sha512-TmRJhKi4mlM1e+zgF4CSzVU5gJ1sWj7ia+XhVgZ8PYyYUxk4PPjJU8qScpSLsAbdSxoBghLxdMuwuCzdYLd1sQ==} hasBin: true @@ -4081,12 +4070,12 @@ packages: engines: {node: '>=14.16'} dev: true - /emoji-regex@8.0.0: - resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + /emoji-regex@10.3.0: + resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==} dev: true - /emoji-regex@9.2.2: - resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + /emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} dev: true /emojis-list@3.0.0: @@ -4911,6 +4900,21 @@ packages: strip-final-newline: 2.0.0 dev: true + /execa@8.0.1: + resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} + engines: {node: '>=16.17'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 8.0.1 + human-signals: 5.0.0 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.3.0 + onetime: 6.0.0 + signal-exit: 4.1.0 + strip-final-newline: 3.0.0 + dev: true + /exit-hook@2.2.1: resolution: {integrity: sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==} engines: {node: '>=6'} @@ -5034,12 +5038,11 @@ packages: escape-string-regexp: 1.0.5 dev: true - /figures@5.0.0: - resolution: {integrity: sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==} - engines: {node: '>=14'} + /figures@6.1.0: + resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==} + engines: {node: '>=18'} dependencies: - escape-string-regexp: 5.0.0 - is-unicode-supported: 1.3.0 + is-unicode-supported: 2.0.0 dev: true /file-entry-cache@6.0.1: @@ -5080,6 +5083,11 @@ packages: - supports-color dev: true + /find-up-simple@1.0.0: + resolution: {integrity: sha512-q7Us7kcjj2VMePAa02hDAF6d+MzsdsAWEwYyOpwUtlerRBkOEPBCRZrAV4XfcSN8fHAgaD0hP7miwoay6DCprw==} + engines: {node: '>=18'} + dev: true + /find-up@5.0.0: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} @@ -5088,14 +5096,6 @@ packages: path-exists: 4.0.0 dev: true - /find-up@6.3.0: - resolution: {integrity: sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - locate-path: 7.2.0 - path-exists: 5.0.0 - dev: true - /flat-cache@3.2.0: resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} engines: {node: ^10.12.0 || >=12.0.0} @@ -5241,6 +5241,11 @@ packages: engines: {node: 6.* || 8.* || >= 10.*} dev: true + /get-east-asian-width@1.2.0: + resolution: {integrity: sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==} + engines: {node: '>=18'} + dev: true + /get-intrinsic@1.2.4: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} @@ -5269,6 +5274,11 @@ packages: engines: {node: '>=10'} dev: true + /get-stream@8.0.1: + resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} + engines: {node: '>=16'} + dev: true + /get-symbol-description@1.0.2: resolution: {integrity: sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==} engines: {node: '>= 0.4'} @@ -5366,15 +5376,16 @@ packages: slash: 3.0.0 dev: true - /globby@13.2.2: - resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + /globby@14.0.1: + resolution: {integrity: sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==} + engines: {node: '>=18'} dependencies: - dir-glob: 3.0.1 + '@sindresorhus/merge-streams': 2.3.0 fast-glob: 3.3.2 ignore: 5.3.1 - merge2: 1.4.1 - slash: 4.0.0 + path-type: 5.0.0 + slash: 5.1.0 + unicorn-magic: 0.1.0 dev: true /gopd@1.0.1: @@ -5549,6 +5560,11 @@ packages: engines: {node: '>=10.17.0'} dev: true + /human-signals@5.0.0: + resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} + engines: {node: '>=16.17.0'} + dev: true + /humanize-ms@1.2.1: resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} dependencies: @@ -5762,10 +5778,6 @@ packages: resolution: {integrity: sha512-YDoFpuZWu1VRXlsnlYMzKyVRITXj7Ej/V9gXQ2/pAe7X1J7M/RNOqaIYi6qUn+B7nGyB9pDXrv02dsB58d2ZAQ==} dev: true - /is-error@2.2.2: - resolution: {integrity: sha512-IOQqts/aHWbiisY5DuPJQ0gcbvaLFCa7fBa9xoLfxBZvQ+ZI/Zh9xoI7Gk+G64N0FdK4AbibytHht2tWgpJWLg==} - dev: true - /is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -5819,16 +5831,6 @@ packages: engines: {node: '>=0.12.0'} dev: true - /is-path-cwd@3.0.0: - resolution: {integrity: sha512-kyiNFFLU0Ampr6SDZitD/DwUo4Zs1nSdnygUBqsu3LooL00Qvb5j+UnvApUn/TTj1J3OuE6BTdQ5rudKmU2ZaA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - - /is-path-inside@4.0.0: - resolution: {integrity: sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==} - engines: {node: '>=12'} - dev: true - /is-plain-obj@2.1.0: resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} engines: {node: '>=8'} @@ -5879,6 +5881,11 @@ packages: engines: {node: '>=8'} dev: true + /is-stream@3.0.0: + resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /is-string@1.0.7: resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} engines: {node: '>= 0.4'} @@ -5905,9 +5912,9 @@ packages: engines: {node: '>=10'} dev: true - /is-unicode-supported@1.3.0: - resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} - engines: {node: '>=12'} + /is-unicode-supported@2.0.0: + resolution: {integrity: sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==} + engines: {node: '>=18'} dev: true /is-weakref@1.0.2: @@ -6132,13 +6139,6 @@ packages: p-locate: 5.0.0 dev: true - /locate-path@7.2.0: - resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-locate: 6.0.0 - dev: true - /lodash.camelcase@4.3.0: resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} dev: true @@ -6211,13 +6211,6 @@ packages: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} dev: true - /map-age-cleaner@0.1.3: - resolution: {integrity: sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==} - engines: {node: '>=6'} - dependencies: - p-defer: 1.0.0 - dev: true - /markdown-extensions@1.1.1: resolution: {integrity: sha512-WWC0ZuMzCyDHYCasEGs4IPvLyTGftYwh6wIEOULOF0HXcqZlhwRzrK0w2VUlxWA98xnvb/jszw4ZSkJ6ADpM6Q==} engines: {node: '>=0.10.0'} @@ -6380,12 +6373,11 @@ packages: engines: {node: '>= 0.6'} dev: true - /mem@9.0.2: - resolution: {integrity: sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A==} - engines: {node: '>=12.20'} + /memoize@10.0.0: + resolution: {integrity: sha512-H6cBLgsi6vMWOcCpvVCdFFnl3kerEXbrYh9q+lY6VXvQSmM6CkmV08VOwT+WE2tzIEqRPFfAq3fm4v/UIW6mSA==} + engines: {node: '>=18'} dependencies: - map-age-cleaner: 0.1.3 - mimic-fn: 4.0.0 + mimic-function: 5.0.1 dev: true /merge-descriptors@1.0.1: @@ -6713,6 +6705,11 @@ packages: engines: {node: '>=12'} dev: true + /mimic-function@5.0.1: + resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==} + engines: {node: '>=18'} + dev: true + /mimic-response@1.0.1: resolution: {integrity: sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==} engines: {node: '>=4'} @@ -6880,6 +6877,11 @@ packages: hasBin: true dev: true + /node-gyp-build@4.8.1: + resolution: {integrity: sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==} + hasBin: true + dev: true + /node-releases@2.0.14: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} dev: true @@ -6914,6 +6916,13 @@ packages: path-key: 3.1.1 dev: true + /npm-run-path@5.3.0: + resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + path-key: 4.0.0 + dev: true + /npmlog@5.0.1: resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} dependencies: @@ -6985,6 +6994,13 @@ packages: mimic-fn: 2.1.0 dev: true + /onetime@6.0.0: + resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} + engines: {node: '>=12'} + dependencies: + mimic-fn: 4.0.0 + dev: true + /optionator@0.8.3: resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==} engines: {node: '>= 0.8.0'} @@ -7038,18 +7054,6 @@ packages: engines: {node: '>=8'} dev: true - /p-defer@1.0.0: - resolution: {integrity: sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==} - engines: {node: '>=4'} - dev: true - - /p-event@5.0.1: - resolution: {integrity: sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-timeout: 5.1.0 - dev: true - /p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -7057,13 +7061,6 @@ packages: yocto-queue: 0.1.0 dev: true - /p-limit@4.0.0: - resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - yocto-queue: 1.0.0 - dev: true - /p-locate@5.0.0: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} @@ -7071,13 +7068,6 @@ packages: p-limit: 3.1.0 dev: true - /p-locate@6.0.0: - resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - p-limit: 4.0.0 - dev: true - /p-map@4.0.0: resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} engines: {node: '>=10'} @@ -7085,16 +7075,9 @@ packages: aggregate-error: 3.1.0 dev: true - /p-map@5.5.0: - resolution: {integrity: sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==} - engines: {node: '>=12'} - dependencies: - aggregate-error: 4.0.1 - dev: true - - /p-timeout@5.1.0: - resolution: {integrity: sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==} - engines: {node: '>=12'} + /p-map@7.0.2: + resolution: {integrity: sha512-z4cYYMMdKHzw4O5UkWJImbZynVIo0lSGTXc7bzB1e/rrDqkgGUNysK/o4bTr+0+xKvvLoTyGqYC4Fgljy9qe1Q==} + engines: {node: '>=18'} dev: true /pac-proxy-agent@5.0.0: @@ -7123,6 +7106,14 @@ packages: netmask: 2.0.2 dev: true + /package-config@5.0.0: + resolution: {integrity: sha512-GYTTew2slBcYdvRHqjhwaaydVMvn/qrGC323+nKclYioNSLTDUM/lGgtGTgyHVtYcozb+XkE8CNhwcraOmZ9Mg==} + engines: {node: '>=18'} + dependencies: + find-up-simple: 1.0.0 + load-json-file: 7.0.1 + dev: true + /pako@0.2.9: resolution: {integrity: sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==} dev: true @@ -7152,9 +7143,9 @@ packages: engines: {node: '>=6'} dev: true - /parse-ms@3.0.0: - resolution: {integrity: sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==} - engines: {node: '>=12'} + /parse-ms@4.0.0: + resolution: {integrity: sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==} + engines: {node: '>=18'} dev: true /parseurl@1.3.3: @@ -7171,11 +7162,6 @@ packages: engines: {node: '>=8'} dev: true - /path-exists@5.0.0: - resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - /path-is-absolute@1.0.1: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} @@ -7186,6 +7172,11 @@ packages: engines: {node: '>=8'} dev: true + /path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + dev: true + /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} dev: true @@ -7207,6 +7198,11 @@ packages: engines: {node: '>=8'} dev: true + /path-type@5.0.0: + resolution: {integrity: sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==} + engines: {node: '>=12'} + dev: true + /pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} dev: true @@ -7236,12 +7232,9 @@ packages: engines: {node: '>=8.6'} dev: true - /pkg-conf@4.0.0: - resolution: {integrity: sha512-7dmgi4UY4qk+4mj5Cd8v/GExPo0K+SlY+hulOSdfZ/T6jVH6//y7NtzZo5WrfhDBxuQ0jCa7fLZmNaNh7EWL/w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - find-up: 6.3.0 - load-json-file: 7.0.1 + /picomatch@3.0.1: + resolution: {integrity: sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==} + engines: {node: '>=10'} dev: true /pkg-types@1.0.3: @@ -7392,11 +7385,11 @@ packages: parse-ms: 2.1.0 dev: true - /pretty-ms@8.0.0: - resolution: {integrity: sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==} - engines: {node: '>=14.16'} + /pretty-ms@9.0.0: + resolution: {integrity: sha512-E9e9HJ9R9NasGOgPaPE8VMeiPKAyWR5jcFpNnwIejslIhWqdqOrb2wShBsncMPUb+BcCd2OPYfh7p2W6oemTng==} + engines: {node: '>=18'} dependencies: - parse-ms: 3.0.0 + parse-ms: 4.0.0 dev: true /process-nextick-args@2.0.1: @@ -7850,6 +7843,12 @@ packages: lru-cache: 6.0.0 dev: true + /semver@7.6.1: + resolution: {integrity: sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA==} + engines: {node: '>=10'} + hasBin: true + dev: true + /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -7968,9 +7967,9 @@ packages: engines: {node: '>=8'} dev: true - /slash@4.0.0: - resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} - engines: {node: '>=12'} + /slash@5.1.0: + resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} + engines: {node: '>=14.16'} dev: true /slice-ansi@5.0.0: @@ -8089,12 +8088,12 @@ packages: strip-ansi: 6.0.1 dev: true - /string-width@5.1.2: - resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} - engines: {node: '>=12'} + /string-width@7.1.0: + resolution: {integrity: sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==} + engines: {node: '>=18'} dependencies: - eastasianwidth: 0.2.0 - emoji-regex: 9.2.2 + emoji-regex: 10.3.0 + get-east-asian-width: 1.2.0 strip-ansi: 7.1.0 dev: true @@ -8171,6 +8170,11 @@ packages: engines: {node: '>=6'} dev: true + /strip-final-newline@3.0.0: + resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} + engines: {node: '>=12'} + dev: true + /strip-json-comments@3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} @@ -8560,6 +8564,11 @@ packages: engines: {node: '>=4'} dev: true + /unicorn-magic@0.1.0: + resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} + engines: {node: '>=18'} + dev: true + /unified@10.1.2: resolution: {integrity: sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==} dependencies: @@ -9048,11 +9057,10 @@ packages: engines: {node: '>=10'} dev: true - /yocto-queue@1.0.0: - resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} - engines: {node: '>=12.20'} - dev: true - /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} dev: true + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false diff --git a/clients/js/src/authority.ts b/clients/js/src/authority.ts index 720c6762..3a7d49c9 100644 --- a/clients/js/src/authority.ts +++ b/clients/js/src/authority.ts @@ -1,19 +1,34 @@ import { PublicKey } from '@metaplex-foundation/umi'; import { pluginAuthority } from './plugins'; -// Authorities data helpers +/** + * @deprecated use SDK v1 methods like `create` or `update` no longer require this helper + * @returns umi plugin authority with type 'None' + */ export function nonePluginAuthority() { return pluginAuthority('None'); } +/** + * @deprecated use SDK v1 methods like `create` or `update` no longer require this helper + * @returns umi plugin authority with type 'None' + */ export function ownerPluginAuthority() { return pluginAuthority('Owner'); } +/** + * @deprecated use SDK v1 methods like `create` or `update` no longer require this helper + * @returns umi plugin authority with type 'UpdateAuthority' + */ export function updatePluginAuthority() { return pluginAuthority('UpdateAuthority'); } +/** + * @deprecated use SDK v1 methods like `create` or `update` no longer require this helper + * @returns umi plugin authority with type 'Address' + */ export function addressPluginAuthority(address: PublicKey) { return pluginAuthority('Address', { address }); } diff --git a/clients/js/src/demo.ts b/clients/js/src/demo.ts index 761d6c5a..3c74a5f1 100644 --- a/clients/js/src/demo.ts +++ b/clients/js/src/demo.ts @@ -1,20 +1,17 @@ // @ts-nocheck import { createUmi, generateSigner } from '@metaplex-foundation/umi'; import { - PluginType, - addPluginV1, - createV1, - createCollectionV1, + create, + createCollection, fetchAssetV1, getAssetV1GpaBuilder, - addressPluginAuthority, - pluginAuthorityPair, - revokePluginAuthorityV1, ruleSet, - transferV1, + transfer, updateAuthority, - createPlugin, Key, + fetchCollectionV1, + addPlugin, + revokePluginAuthority, } from './index'; const example = async () => { @@ -24,49 +21,52 @@ const example = async () => { const assetAddress = generateSigner(umi); const owner = generateSigner(umi); - await createV1(umi, { + await create(umi, { name: 'Test Asset', uri: 'https://example.com/asset.json', asset: assetAddress, owner: owner.publicKey, // optional, will default to payer }).sendAndConfirm(umi); + // Fetch an asset + const asset = await fetchAssetV1(umi, assetAddress.publicKey); + // Create a collection const collectionUpdateAuthority = generateSigner(umi); const collectionAddress = generateSigner(umi); - await createCollectionV1(umi, { + await createCollection(umi, { name: 'Test Collection', uri: 'https://example.com/collection.json', collection: collectionAddress, updateAuthority: collectionUpdateAuthority.publicKey, // optional, defaults to payer }).sendAndConfirm(umi); + // Fetch a collection + const collection = await fetchCollectionV1(umi, collectionAddress.publicKey); + // Create an asset in a collection, the authority must be the updateAuthority of the collection - await createV1(umi, { + await create(umi, { name: 'Test Asset', uri: 'https://example.com/asset.json', asset: assetAddress, - collection: collectionAddress.publicKey, + collection, authority: collectionUpdateAuthority, // optional, defaults to payer }).sendAndConfirm(umi); // Transfer an asset const recipient = generateSigner(umi); - await transferV1(umi, { - asset: assetAddress.publicKey, + await transfer(umi, { + asset, newOwner: recipient.publicKey, }).sendAndConfirm(umi); // Transfer an asset in a collection - await transferV1(umi, { - asset: assetAddress.publicKey, + await transfer(umi, { + asset, newOwner: recipient.publicKey, - collection: collectionAddress.publicKey, + collection, }).sendAndConfirm(umi); - // Fetch an asset - const asset = await fetchAssetV1(umi, assetAddress.publicKey); - // GPA fetch assets by owner const assetsByOwner = await getAssetV1GpaBuilder(umi) .whereField('key', Key.AssetV1) @@ -93,26 +93,30 @@ const advancedExamples = async () => { const assetAddress = generateSigner(umi); const freezeDelegate = generateSigner(umi); - await addPluginV1(umi, { + await addPlugin(umi, { asset: assetAddress.publicKey, // adds the owner-managed freeze plugin to the asset - plugin: createPlugin({ + plugin: { type: 'FreezeDelegate', - data: { - frozen: true, + frozen: true, + + // Optionally set the authority to a delegate who can unfreeze. If unset, this will be the Owner + // This is functionally the same as calling addPlugin and approvePluginAuthority separately. + // Freezing with a delegate is commonly used for escrowless staking programs. + authority: { + type: 'Address', + address: freezeDelegate.publicKey, }, - }), - // Optionally set the authority to a delegate who can unfreeze. If unset, this will be the Owner - // This is functionally the same as calling addPlugin and approvePluginAuthority separately. - // Freezing with a delegate is commonly used for escrowless staking programs. - initAuthority: addressPluginAuthority(freezeDelegate.publicKey), + }, }).sendAndConfirm(umi); // Unfreezing an asset with a delegate // Revoking an authority will revert the authority back to the owner for owner-managed plugins - await revokePluginAuthorityV1(umi, { + await revokePluginAuthority(umi, { asset: assetAddress.publicKey, - pluginType: PluginType.FreezeDelegate, + plugin: { + type: 'FreezeDelegate', + }, authority: freezeDelegate, }).sendAndConfirm(umi); @@ -121,37 +125,35 @@ const advancedExamples = async () => { const creator1 = generateSigner(umi); const creator2 = generateSigner(umi); - await createCollectionV1(umi, { + await createCollection(umi, { name: 'Test Collection', uri: 'https://example.com/collection.json', collection: collectionAddress, plugins: [ - pluginAuthorityPair({ + { type: 'Royalties', - data: { - basisPoints: 500, - creators: [ - { - address: creator1.publicKey, - percentage: 20, - }, - { - address: creator2.publicKey, - percentage: 80, - }, - ], - ruleSet: ruleSet('None'), // Compatibility rule set - }, - }), + basisPoints: 500, + creators: [ + { + address: creator1.publicKey, + percentage: 20, + }, + { + address: creator2.publicKey, + percentage: 80, + }, + ], + ruleSet: ruleSet('None'), // Compatibility rule set + }, ], }).sendAndConfirm(umi); // Create an asset in a collection. // Assets in a collection will inherit the collection's authority-managed plugins, in this case the royalties plugin - await createV1(umi, { + await create(umi, { name: 'Test Asset', uri: 'https://example.com/asset.json', asset: assetAddress, - collection: collectionAddress.publicKey, + collection: await fetchCollectionV1(umi, collectionAddress.publicKey), }).sendAndConfirm(umi); }; diff --git a/clients/js/src/generated/types/addBlocker.ts b/clients/js/src/generated/types/addBlocker.ts new file mode 100644 index 00000000..1e94c222 --- /dev/null +++ b/clients/js/src/generated/types/addBlocker.ts @@ -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. + * + * @see https://github.com/metaplex-foundation/kinobi + */ + +import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; + +export type AddBlocker = {}; + +export type AddBlockerArgs = AddBlocker; + +export function getAddBlockerSerializer(): Serializer< + AddBlockerArgs, + AddBlocker +> { + return struct([], { description: 'AddBlocker' }) as Serializer< + AddBlockerArgs, + AddBlocker + >; +} diff --git a/clients/js/src/generated/types/immutableMetadata.ts b/clients/js/src/generated/types/immutableMetadata.ts new file mode 100644 index 00000000..fe3ca4e2 --- /dev/null +++ b/clients/js/src/generated/types/immutableMetadata.ts @@ -0,0 +1,22 @@ +/** + * 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. + * + * @see https://github.com/metaplex-foundation/kinobi + */ + +import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; + +export type ImmutableMetadata = {}; + +export type ImmutableMetadataArgs = ImmutableMetadata; + +export function getImmutableMetadataSerializer(): Serializer< + ImmutableMetadataArgs, + ImmutableMetadata +> { + return struct([], { + description: 'ImmutableMetadata', + }) as Serializer; +} diff --git a/clients/js/src/generated/types/index.ts b/clients/js/src/generated/types/index.ts index 2a27e0ba..8a62ffa6 100644 --- a/clients/js/src/generated/types/index.ts +++ b/clients/js/src/generated/types/index.ts @@ -6,6 +6,7 @@ * @see https://github.com/metaplex-foundation/kinobi */ +export * from './addBlocker'; export * from './attribute'; export * from './attributes'; export * from './baseDataStore'; @@ -43,6 +44,7 @@ export * from './freezeDelegate'; export * from './hashablePluginSchema'; export * from './hashedAssetSchema'; export * from './hookableLifecycleEvent'; +export * from './immutableMetadata'; export * from './key'; export * from './oracleValidation'; export * from './permanentBurnDelegate'; diff --git a/clients/js/src/generated/types/plugin.ts b/clients/js/src/generated/types/plugin.ts index 2d2d3352..64c4c394 100644 --- a/clients/js/src/generated/types/plugin.ts +++ b/clients/js/src/generated/types/plugin.ts @@ -15,6 +15,8 @@ import { tuple, } from '@metaplex-foundation/umi/serializers'; import { + AddBlocker, + AddBlockerArgs, Attributes, AttributesArgs, BaseMasterEdition, @@ -27,6 +29,8 @@ import { EditionArgs, FreezeDelegate, FreezeDelegateArgs, + ImmutableMetadata, + ImmutableMetadataArgs, PermanentBurnDelegate, PermanentBurnDelegateArgs, PermanentFreezeDelegate, @@ -37,12 +41,14 @@ import { TransferDelegateArgs, UpdateDelegate, UpdateDelegateArgs, + getAddBlockerSerializer, getAttributesSerializer, getBaseMasterEditionSerializer, getBaseRoyaltiesSerializer, getBurnDelegateSerializer, getEditionSerializer, getFreezeDelegateSerializer, + getImmutableMetadataSerializer, getPermanentBurnDelegateSerializer, getPermanentFreezeDelegateSerializer, getPermanentTransferDelegateSerializer, @@ -61,7 +67,9 @@ export type Plugin = | { __kind: 'PermanentTransferDelegate'; fields: [PermanentTransferDelegate] } | { __kind: 'PermanentBurnDelegate'; fields: [PermanentBurnDelegate] } | { __kind: 'Edition'; fields: [Edition] } - | { __kind: 'MasterEdition'; fields: [BaseMasterEdition] }; + | { __kind: 'MasterEdition'; fields: [BaseMasterEdition] } + | { __kind: 'AddBlocker'; fields: [AddBlocker] } + | { __kind: 'ImmutableMetadata'; fields: [ImmutableMetadata] }; export type PluginArgs = | { __kind: 'Royalties'; fields: [BaseRoyaltiesArgs] } @@ -77,7 +85,9 @@ export type PluginArgs = } | { __kind: 'PermanentBurnDelegate'; fields: [PermanentBurnDelegateArgs] } | { __kind: 'Edition'; fields: [EditionArgs] } - | { __kind: 'MasterEdition'; fields: [BaseMasterEditionArgs] }; + | { __kind: 'MasterEdition'; fields: [BaseMasterEditionArgs] } + | { __kind: 'AddBlocker'; fields: [AddBlockerArgs] } + | { __kind: 'ImmutableMetadata'; fields: [ImmutableMetadataArgs] }; export function getPluginSerializer(): Serializer { return dataEnum( @@ -148,6 +158,18 @@ export function getPluginSerializer(): Serializer { ['fields', tuple([getBaseMasterEditionSerializer()])], ]), ], + [ + 'AddBlocker', + struct>([ + ['fields', tuple([getAddBlockerSerializer()])], + ]), + ], + [ + 'ImmutableMetadata', + struct>([ + ['fields', tuple([getImmutableMetadataSerializer()])], + ]), + ], ], { description: 'Plugin' } ) as Serializer; @@ -201,6 +223,14 @@ export function plugin( kind: 'MasterEdition', data: GetDataEnumKindContent['fields'] ): GetDataEnumKind; +export function plugin( + kind: 'AddBlocker', + data: GetDataEnumKindContent['fields'] +): GetDataEnumKind; +export function plugin( + kind: 'ImmutableMetadata', + data: GetDataEnumKindContent['fields'] +): GetDataEnumKind; export function plugin( kind: K, data?: any diff --git a/clients/js/src/generated/types/pluginType.ts b/clients/js/src/generated/types/pluginType.ts index 6ce51bd3..759a518a 100644 --- a/clients/js/src/generated/types/pluginType.ts +++ b/clients/js/src/generated/types/pluginType.ts @@ -20,6 +20,8 @@ export enum PluginType { PermanentBurnDelegate, Edition, MasterEdition, + AddBlocker, + ImmutableMetadata, } export type PluginTypeArgs = PluginType; diff --git a/clients/js/src/instructions/addPlugin.ts b/clients/js/src/instructions/addPlugin.ts index f07062be..c9b10228 100644 --- a/clients/js/src/instructions/addPlugin.ts +++ b/clients/js/src/instructions/addPlugin.ts @@ -8,11 +8,15 @@ import { pluginAuthorityPairV2, } from '../plugins'; +export type AddPluginArgsPlugin = + | AddablePluginAuthorityPairArgsV2 + | ExternalPluginInitInfoArgs; + export type AddPluginArgs = Omit< Parameters[1], - 'plugin' + 'plugin' | 'initAuthority' > & { - plugin: AddablePluginAuthorityPairArgsV2 | ExternalPluginInitInfoArgs; + plugin: AddPluginArgsPlugin; }; export const addPlugin = ( diff --git a/clients/js/src/instructions/approvePluginAuthority.ts b/clients/js/src/instructions/approvePluginAuthority.ts index 15bec496..c4e3eaf4 100644 --- a/clients/js/src/instructions/approvePluginAuthority.ts +++ b/clients/js/src/instructions/approvePluginAuthority.ts @@ -1,39 +1,25 @@ import { Context } from '@metaplex-foundation/umi'; import { approvePluginAuthorityV1, PluginType } from '../generated'; -import { - isExternalPluginType, - PluginAuthority, - pluginAuthorityToBase, -} from '../plugins'; -import { ExternalPluginKey } from '../plugins/externalPluginKey'; +import { PluginAuthority, pluginAuthorityToBase } from '../plugins'; + +export type ApprovePluginAuthorityArgsPlugin = { + type: keyof typeof PluginType; +}; export type ApprovePluginAuthorityArgs = Omit< Parameters[1], 'pluginType' | 'newAuthority' > & { - plugin: - | { - type: keyof typeof PluginType; - } - | ExternalPluginKey; + plugin: ApprovePluginAuthorityArgsPlugin; newAuthority: PluginAuthority; }; export const approvePluginAuthority = ( context: Pick, { plugin, newAuthority, ...args }: ApprovePluginAuthorityArgs -) => { - if (isExternalPluginType(plugin)) { - // TODO implement this - // return approveExternalPluginAuthorityV1(context, { - // ...args, - // key: externalPluginKeyToBase(plugin as ExternalPluginKey), - // }); - } - - return approvePluginAuthorityV1(context, { +) => + approvePluginAuthorityV1(context, { ...args, pluginType: PluginType[plugin.type as keyof typeof PluginType], newAuthority: pluginAuthorityToBase(newAuthority), }); -}; diff --git a/clients/js/src/instructions/burn.ts b/clients/js/src/instructions/burn.ts index a551928f..1aa2b7d8 100644 --- a/clients/js/src/instructions/burn.ts +++ b/clients/js/src/instructions/burn.ts @@ -7,8 +7,8 @@ export type BurnArgs = Omit< Parameters[1], 'asset' | 'collection' > & { - asset: AssetV1; - collection?: CollectionV1; + asset: Pick; + collection?: Pick; }; export const burn = ( diff --git a/clients/js/src/instructions/collection/addCollectionPlugin.ts b/clients/js/src/instructions/collection/addCollectionPlugin.ts index ee5cb6e5..07877aa2 100644 --- a/clients/js/src/instructions/collection/addCollectionPlugin.ts +++ b/clients/js/src/instructions/collection/addCollectionPlugin.ts @@ -13,7 +13,7 @@ import { export type AddCollectionPluginArgs = Omit< Parameters[1], - 'plugin' + 'plugin' | 'initAuthority' > & { plugin: | Exclude diff --git a/clients/js/src/instructions/create.ts b/clients/js/src/instructions/create.ts index ab62fd2d..6390d268 100644 --- a/clients/js/src/instructions/create.ts +++ b/clients/js/src/instructions/create.ts @@ -3,7 +3,7 @@ import { CollectionV1, createV2, ExternalPluginSchema } from '../generated'; import { createExternalPluginInitInfo, findExtraAccounts, - PluginArgsV2, + PluginAuthorityPairArgsV2, pluginAuthorityPairV2, } from '../plugins'; import { deriveExternalPlugins } from '../helpers'; @@ -13,12 +13,16 @@ import { isExternalPluginType, } from '../plugins/externalPlugins'; +export type CreateArgsPlugin = + | PluginAuthorityPairArgsV2 + | ExternalPluginInitInfoArgs; + export type CreateArgs = Omit< Parameters[1], 'plugins' | 'externalPlugins' | 'collection' > & { - collection?: CollectionV1; - plugins?: (PluginArgsV2 | ExternalPluginInitInfoArgs)[]; + collection?: Pick; + plugins?: CreateArgsPlugin[]; }; export const create = ( @@ -33,7 +37,7 @@ export const create = ( }; const externalPlugins: ExternalPluginInitInfoArgs[] = []; - const firstPartyPlugins: PluginArgsV2[] = []; + const firstPartyPlugins: PluginAuthorityPairArgsV2[] = []; // Create dummy external plugins to resuse findExtraAccounts method plugins?.forEach((plugin) => { @@ -69,7 +73,7 @@ export const create = ( // Do nothing } } else { - firstPartyPlugins.push(plugin as PluginArgsV2); + firstPartyPlugins.push(plugin as PluginAuthorityPairArgsV2); } }); diff --git a/clients/js/src/instructions/removePlugin.ts b/clients/js/src/instructions/removePlugin.ts index 6b07c8c8..f29391b6 100644 --- a/clients/js/src/instructions/removePlugin.ts +++ b/clients/js/src/instructions/removePlugin.ts @@ -10,15 +10,17 @@ import { externalPluginKeyToBase, } from '../plugins/externalPluginKey'; +export type RemovePluginArgsPlugin = + | { + type: Exclude; + } + | ExternalPluginKey; + export type RemovePluginArgs = Omit< Parameters[1], 'pluginType' > & { - plugin: - | { - type: Exclude; - } - | ExternalPluginKey; + plugin: RemovePluginArgsPlugin; }; export const removePlugin = ( diff --git a/clients/js/src/instructions/revokePluginAuthority.ts b/clients/js/src/instructions/revokePluginAuthority.ts index 8ddf1a42..beae2ae1 100644 --- a/clients/js/src/instructions/revokePluginAuthority.ts +++ b/clients/js/src/instructions/revokePluginAuthority.ts @@ -1,33 +1,22 @@ import { Context } from '@metaplex-foundation/umi'; import { revokePluginAuthorityV1, PluginType } from '../generated'; -import { isExternalPluginType } from '../plugins'; -import { ExternalPluginKey } from '../plugins/externalPluginKey'; + +export type RevokePluginAuthorityArgsPlugin = { + type: keyof typeof PluginType; +}; export type RevokePluginAuthorityArgs = Omit< Parameters[1], 'pluginType' > & { - plugin: - | { - type: keyof typeof PluginType; - } - | ExternalPluginKey; + plugin: RevokePluginAuthorityArgsPlugin; }; export const revokePluginAuthority = ( context: Pick, { plugin, ...args }: RevokePluginAuthorityArgs -) => { - if (isExternalPluginType(plugin)) { - // TODO implement this - // return revokeExternalPluginAuthorityV1(context, { - // ...args, - // key: externalPluginKeyToBase(plugin as ExternalPluginKey), - // }); - } - - return revokePluginAuthorityV1(context, { +) => + revokePluginAuthorityV1(context, { ...args, pluginType: PluginType[plugin.type as keyof typeof PluginType], }); -}; diff --git a/clients/js/src/instructions/transfer.ts b/clients/js/src/instructions/transfer.ts index 7dd252e6..0b86c072 100644 --- a/clients/js/src/instructions/transfer.ts +++ b/clients/js/src/instructions/transfer.ts @@ -7,8 +7,8 @@ export type TransferArgs = Omit< Parameters[1], 'asset' | 'collection' > & { - asset: AssetV1; - collection?: CollectionV1; + asset: Pick; + collection?: Pick; }; export const transfer = ( diff --git a/clients/js/src/instructions/update.ts b/clients/js/src/instructions/update.ts index 8ad02cb5..b635a1b9 100644 --- a/clients/js/src/instructions/update.ts +++ b/clients/js/src/instructions/update.ts @@ -12,8 +12,8 @@ export type UpdateArgs = Omit< Parameters[1], 'asset' | 'collection' | 'newName' | 'newUri' > & { - asset: AssetV1; - collection?: CollectionV1; + asset: Pick; + collection?: Pick; name?: UpdateV1InstructionDataArgs['newName']; uri?: UpdateV1InstructionDataArgs['newUri']; }; diff --git a/clients/js/src/instructions/updatePlugin.ts b/clients/js/src/instructions/updatePlugin.ts index a50b00f5..34529f49 100644 --- a/clients/js/src/instructions/updatePlugin.ts +++ b/clients/js/src/instructions/updatePlugin.ts @@ -9,11 +9,15 @@ import { } from '../plugins'; import { ExternalPluginUpdateInfoArgs } from '../plugins/externalPlugins'; +export type UpdatePluginArgsPlugin = + | PluginArgsV2 + | ExternalPluginUpdateInfoArgs; + export type UpdatePluginArgs = Omit< Parameters[1], 'plugin' > & { - plugin: PluginArgsV2 | ExternalPluginUpdateInfoArgs; + plugin: UpdatePluginArgsPlugin; }; export const updatePlugin = ( diff --git a/clients/js/src/plugins/types.ts b/clients/js/src/plugins/types.ts index 3ef970b6..7cb8cd74 100644 --- a/clients/js/src/plugins/types.ts +++ b/clients/js/src/plugins/types.ts @@ -19,6 +19,8 @@ import { BasePluginAuthority, BaseRoyaltiesArgs, BaseMasterEditionArgs, + AddBlocker, + ImmutableMetadata, } from '../generated'; import { RoyaltiesArgs, RoyaltiesPlugin } from './royalties'; import { PluginAuthority } from './pluginAuthority'; @@ -76,6 +78,12 @@ export type CreatePluginArgs = | { type: 'MasterEdition'; data: BaseMasterEditionArgs; + } + | { + type: 'ImmutableMetadata'; + } + | { + type: 'AddBlocker'; }; export type AuthorityArgsV2 = { @@ -117,7 +125,13 @@ export type AddablePluginArgsV2 = } & AttributesArgs) | ({ type: 'MasterEdition'; - } & MasterEditionArgs); + } & MasterEditionArgs) + | { + type: 'ImmutableMetadata'; + } + | { + type: 'AddBlocker'; + }; export type PluginArgsV2 = AddablePluginArgsV2 | CreateOnlyPluginArgsV2; export type PluginAuthorityPairArgsV2 = PluginArgsV2 & AuthorityArgsV2; @@ -136,6 +150,8 @@ export type PermanentTransferDelegatePlugin = BasePlugin & export type PermanentBurnDelegatePlugin = BasePlugin & PermanentBurnDelegate; export type EditionPlugin = BasePlugin & Edition; export type MasterEditionPlugin = BasePlugin & MasterEdition; +export type AddBlockerPlugin = BasePlugin & AddBlocker; +export type ImmutableMetadataPlugin = BasePlugin & ImmutableMetadata; export type PluginsList = { royalties?: RoyaltiesPlugin; @@ -149,4 +165,6 @@ export type PluginsList = { permanentBurnDelegate?: PermanentBurnDelegatePlugin; edition?: EditionPlugin; masterEdition?: MasterEditionPlugin; + addBlocker?: AddBlockerPlugin; + immutableMetadata?: ImmutableMetadataPlugin; }; diff --git a/clients/js/test/_setupRaw.ts b/clients/js/test/_setupRaw.ts index b0a2f632..77b97003 100644 --- a/clients/js/test/_setupRaw.ts +++ b/clients/js/test/_setupRaw.ts @@ -22,6 +22,7 @@ import { PluginsList, PluginAuthorityPairArgs, UpdateAuthority, + ExternalPluginsList, } from '../src'; export const createUmi = async () => (await basecreateUmi()).use(mplCore()); @@ -144,7 +145,8 @@ export const assertAsset = async ( updateAuthority?: UpdateAuthority; name?: string | RegExp; uri?: string | RegExp; - } & PluginsList + } & PluginsList & + ExternalPluginsList ) => { const { asset, owner, name, uri, ...rest } = input; const assetAddress = publicKey(input.asset); @@ -178,7 +180,8 @@ export const assertCollection = async ( uri?: string | RegExp; numMinted?: number; currentSize?: number; - } & PluginsList + } & PluginsList & + ExternalPluginsList ) => { const { collection, name, uri, updateAuthority, ...rest } = input; diff --git a/clients/js/test/_setupSdk.ts b/clients/js/test/_setupSdk.ts index 343df0ae..b2ecd281 100644 --- a/clients/js/test/_setupSdk.ts +++ b/clients/js/test/_setupSdk.ts @@ -42,9 +42,10 @@ export const createAsset = async ( ? publicKey(input.updateAuthority) : undefined; - const col = (input.collection as PublicKey)?.__publicKey - ? await fetchCollectionV1(umi, input.collection as PublicKey) - : (input.collection as CollectionV1 | undefined); + const col = + typeof input.collection === 'string' + ? await fetchCollectionV1(umi, input.collection as PublicKey) + : (input.collection as CollectionV1 | undefined); await create(umi, { owner, diff --git a/clients/js/test/externalPlugins/oracle.test.ts b/clients/js/test/externalPlugins/oracle.test.ts index 7b3d4580..55a554af 100644 --- a/clients/js/test/externalPlugins/oracle.test.ts +++ b/clients/js/test/externalPlugins/oracle.test.ts @@ -27,8 +27,10 @@ import { generateSignerWithSol } from '@metaplex-foundation/umi-bundle-tests'; import { assertAsset, assertBurned, + assertCollection, createUmi as baseCreateUmi, DEFAULT_ASSET, + DEFAULT_COLLECTION, } from '../_setupRaw'; import { createAsset, createAssetWithCollection } from '../_setupSdk'; import { @@ -41,6 +43,7 @@ import { update, addPlugin, updatePlugin, + fetchAssetV1, } from '../../src'; const createUmi = async () => @@ -113,6 +116,22 @@ test('it can use fixed address oracle to deny update', async (t) => { asset: asset.publicKey, owner: umi.identity.publicKey, name: 'new name 2', + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + update: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); }); @@ -190,6 +209,27 @@ test('it can use fixed address oracle to deny update via collection', async (t) owner: umi.identity.publicKey, name: 'new name 2', }); + + await assertCollection(t, umi, { + ...DEFAULT_COLLECTION, + collection: collection.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + update: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], + }); }); test('it can use fixed address oracle to deny transfer', async (t) => { @@ -260,6 +300,22 @@ test('it can use fixed address oracle to deny transfer', async (t) => { ...DEFAULT_ASSET, asset: asset.publicKey, owner: newOwner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); }); @@ -320,6 +376,7 @@ test('it cannot add oracle with no lifecycle checks to asset', async (t) => { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: undefined, }); }); @@ -344,11 +401,26 @@ test('it cannot update oracle to have no lifecycle checks', async (t) => { ], }); - // TODO: Add external plugin validation. await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); // Oracle with no lifecycle checks @@ -370,11 +442,26 @@ test('it cannot update oracle to have no lifecycle checks', async (t) => { await t.throwsAsync(result, { name: 'RequiresLifecycleCheck' }); - // TODO: Add external plugin validation. await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); }); @@ -441,6 +528,7 @@ test('it cannot add oracle to asset that can approve', async (t) => { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: undefined, }); // Oracle with `CheckResult.CAN_APPROVE` @@ -464,6 +552,7 @@ test('it cannot add oracle to asset that can approve', async (t) => { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: undefined, }); }); @@ -480,6 +569,7 @@ test('it cannot add oracle to asset that can approve in addition to reject', asy ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: undefined, }); // Oracle with `CheckResult.CAN_APPROVE` @@ -503,6 +593,7 @@ test('it cannot add oracle to asset that can approve in addition to reject', asy ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: undefined, }); }); @@ -527,11 +618,26 @@ test('it cannot update oracle to approve', async (t) => { ], }); - // TODO: Add external plugin validation. await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); const result = updatePlugin(umi, { @@ -554,11 +660,26 @@ test('it cannot update oracle to approve', async (t) => { await t.throwsAsync(result, { name: 'OracleCanRejectOnly' }); - // TODO: Add external plugin validation. await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); }); @@ -583,11 +704,26 @@ test('it cannot update oracle to approve in addition to reject', async (t) => { ], }); - // TODO: Add external plugin validation. await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); const result = updatePlugin(umi, { @@ -610,11 +746,26 @@ test('it cannot update oracle to approve in addition to reject', async (t) => { await t.throwsAsync(result, { name: 'OracleCanRejectOnly' }); - // TODO: Add external plugin validation. await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); }); @@ -656,6 +807,7 @@ test('it cannot add oracle to asset that can listen', async (t) => { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: undefined, }); // Oracle with `CheckResult.CAN_LISTEN` @@ -679,6 +831,7 @@ test('it cannot add oracle to asset that can listen', async (t) => { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: undefined, }); }); @@ -703,11 +856,26 @@ test('it cannot update oracle to listen', async (t) => { ], }); - // TODO: Add external plugin validation. await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); const result = updatePlugin(umi, { @@ -730,11 +898,26 @@ test('it cannot update oracle to listen', async (t) => { await t.throwsAsync(result, { name: 'OracleCanRejectOnly' }); - // TODO: Add external plugin validation. await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, owner: owner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); }); @@ -788,6 +971,22 @@ test('it cannot use fixed address oracle to deny transfer if not registered for ...DEFAULT_ASSET, asset: asset.publicKey, owner: newOwner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + create: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); }); @@ -866,6 +1065,22 @@ test('it can use fixed address oracle to deny create', async (t) => { ...DEFAULT_ASSET, asset: assetSigner.publicKey, owner: umi.identity.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account.publicKey, + lifecycleChecks: { + create: [CheckResult.CAN_REJECT], + }, + pda: undefined, + }, + ], }); }); @@ -1018,6 +1233,24 @@ test('it can use preconfigured program pda oracle to deny update', async (t) => asset: asset.publicKey, owner: umi.identity.publicKey, name: 'new name 2', + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, + lifecycleChecks: { + update: [CheckResult.CAN_REJECT], + }, + pda: { + type: 'PreconfiguredProgram', + }, + }, + ], }); }); @@ -1103,6 +1336,24 @@ test('it can use preconfigured collection pda oracle to deny update', async (t) updateAuthority: { type: 'Collection', address: collection.publicKey }, owner: umi.identity.publicKey, name: 'new name 2', + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, + lifecycleChecks: { + update: [CheckResult.CAN_REJECT], + }, + pda: { + type: 'PreconfiguredCollection', + }, + }, + ], }); }); @@ -1161,6 +1412,24 @@ test('it can use preconfigured owner pda oracle to deny burn', async (t) => { ...DEFAULT_ASSET, asset: asset.publicKey, owner, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, + lifecycleChecks: { + burn: [CheckResult.CAN_REJECT], + }, + pda: { + type: 'PreconfiguredOwner', + }, + }, + ], }); await preconfiguredOwnerPdaSet(umi, { @@ -1261,6 +1530,24 @@ test('it can use preconfigured recipient pda oracle to deny transfer', async (t) ...DEFAULT_ASSET, asset: asset.publicKey, owner: newOwner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: { + type: 'PreconfiguredRecipient', + }, + }, + ], }); }); @@ -1339,6 +1626,24 @@ test('it can use preconfigured asset pda oracle to deny update', async (t) => { asset: asset.publicKey, owner: umi.identity.publicKey, name: 'new name 2', + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, + lifecycleChecks: { + update: [CheckResult.CAN_REJECT], + }, + pda: { + type: 'PreconfiguredAsset', + }, + }, + ], }); }); @@ -1452,6 +1757,35 @@ test('it can use custom pda (all seeds) oracle to deny transfer', async (t) => { ...DEFAULT_ASSET, asset: asset.publicKey, owner: newOwner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: { + type: 'CustomPda', + seeds: [ + { type: 'Collection' }, + { type: 'Owner' }, + { type: 'Recipient' }, + { type: 'Asset' }, + { type: 'Address', pubkey: seedPubkey }, + { + type: 'Bytes', + bytes: new Uint8Array(Buffer.from('example-seed-bytes', 'utf8')), + }, + ], + }, + }, + ], }); }); @@ -1555,6 +1889,37 @@ test('it can use custom pda (typical) oracle to deny transfer', async (t) => { ...DEFAULT_ASSET, asset: asset.publicKey, owner: newOwner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + pda: { + type: 'CustomPda', + seeds: [ + { + type: 'Bytes', + bytes: new Uint8Array(Buffer.from('prefix-seed-bytes', 'utf8')), + }, + { type: 'Collection' }, + { + type: 'Bytes', + bytes: new Uint8Array( + Buffer.from('additional-bytes-seed-bytes', 'utf8') + ), + }, + ], + }, + }, + ], }); }); @@ -1688,6 +2053,25 @@ test('it can use preconfigured asset pda custom offset oracle to deny update', a asset: asset.publicKey, owner: umi.identity.publicKey, name: 'new name 2', + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Custom', + offset: 48n, + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: MPL_CORE_ORACLE_EXAMPLE_PROGRAM_ID, + lifecycleChecks: { + update: [CheckResult.CAN_REJECT], + }, + pda: { + type: 'PreconfiguredAsset', + }, + }, + ], }); }); @@ -1786,5 +2170,221 @@ test('it can use one fixed address oracle to deny transfer when a second oracle ...DEFAULT_ASSET, asset: asset.publicKey, owner: newOwner.publicKey, + oracles: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account1.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + }, + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + authority: { + type: 'UpdateAuthority', + }, + baseAddress: account2.publicKey, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + }, + ], + }); +}); + +test('it can update asset to different size name with oracle', async (t) => { + const umi = await createUmi(); + const oracleSigner = generateSigner(umi); + await fixedAccountInit(umi, { + signer: umi.identity, + account: oracleSigner, + args: { + oracleData: { + __kind: 'V1', + create: ExternalValidationResult.Pass, + transfer: ExternalValidationResult.Pass, + burn: ExternalValidationResult.Pass, + update: ExternalValidationResult.Rejected, + }, + }, + }).sendAndConfirm(umi); + + const asset = generateSigner(umi); + await create(umi, { + asset, + name: 'Test name', + uri: 'https://example.com', + plugins: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + lifecycleChecks: { + update: [CheckResult.CAN_REJECT], + }, + baseAddress: oracleSigner.publicKey, + }, + ], + }).sendAndConfirm(umi); + + await fixedAccountSet(umi, { + signer: umi.identity, + account: oracleSigner.publicKey, + args: { + oracleData: { + __kind: 'V1', + create: ExternalValidationResult.Pass, + transfer: ExternalValidationResult.Pass, + burn: ExternalValidationResult.Pass, + update: ExternalValidationResult.Pass, + }, + }, + }).sendAndConfirm(umi); + + const a = await fetchAssetV1(umi, asset.publicKey); + + await update(umi, { + asset: a, + name: 'name 2', + }).sendAndConfirm(umi); + + await assertAsset(t, umi, { + uri: 'https://example.com', + name: 'name 2', + owner: umi.identity.publicKey, + asset: asset.publicKey, + oracles: [ + { + authority: { + type: 'UpdateAuthority', + }, + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + lifecycleChecks: { + update: [CheckResult.CAN_REJECT], + }, + baseAddress: oracleSigner.publicKey, + pda: undefined, + }, + ], + }); +}); + +test('it can update oracle to different size external plugin', async (t) => { + const umi = await createUmi(); + const oracleSigner = generateSigner(umi); + await fixedAccountInit(umi, { + signer: umi.identity, + account: oracleSigner, + args: { + oracleData: { + __kind: 'V1', + create: ExternalValidationResult.Pass, + transfer: ExternalValidationResult.Pass, + burn: ExternalValidationResult.Pass, + update: ExternalValidationResult.Rejected, + }, + }, + }).sendAndConfirm(umi); + + const asset = generateSigner(umi); + await create(umi, { + asset, + name: 'Test name', + uri: 'https://example.com', + plugins: [ + { + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + lifecycleChecks: { + create: [CheckResult.CAN_REJECT], + update: [CheckResult.CAN_REJECT], + transfer: [CheckResult.CAN_REJECT], + burn: [CheckResult.CAN_REJECT], + }, + baseAddress: oracleSigner.publicKey, + }, + ], + }).sendAndConfirm(umi); + + await assertAsset(t, umi, { + uri: 'https://example.com', + name: 'Test name', + owner: umi.identity.publicKey, + asset: asset.publicKey, + oracles: [ + { + authority: { + type: 'UpdateAuthority', + }, + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + lifecycleChecks: { + create: [CheckResult.CAN_REJECT], + update: [CheckResult.CAN_REJECT], + transfer: [CheckResult.CAN_REJECT], + burn: [CheckResult.CAN_REJECT], + }, + baseAddress: oracleSigner.publicKey, + pda: undefined, + }, + ], + }); + + await updatePlugin(umi, { + asset: asset.publicKey, + + plugin: { + key: { + type: 'Oracle', + baseAddress: oracleSigner.publicKey, + }, + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + }, + }).sendAndConfirm(umi); + + await assertAsset(t, umi, { + uri: 'https://example.com', + name: 'Test name', + owner: umi.identity.publicKey, + asset: asset.publicKey, + oracles: [ + { + authority: { + type: 'UpdateAuthority', + }, + type: 'Oracle', + resultsOffset: { + type: 'Anchor', + }, + lifecycleChecks: { + transfer: [CheckResult.CAN_REJECT], + }, + baseAddress: oracleSigner.publicKey, + pda: undefined, + }, + ], }); }); diff --git a/clients/js/test/plugins/asset/addBlocker.test.ts b/clients/js/test/plugins/asset/addBlocker.test.ts new file mode 100644 index 00000000..515976c7 --- /dev/null +++ b/clients/js/test/plugins/asset/addBlocker.test.ts @@ -0,0 +1,170 @@ +import test from 'ava'; +import { generateSigner } from '@metaplex-foundation/umi'; + +import { addPlugin } from '../../../src'; +import { DEFAULT_ASSET, assertAsset, createUmi } from '../../_setupRaw'; +import { createAsset } from '../../_setupSdk'; + +test('it cannot add UA-managed plugin if addBlocker had been added on creation', async (t) => { + // Given a Umi instance and a new signer. + const umi = await createUmi(); + + const asset = await createAsset(umi, { + plugins: [ + { + type: 'AddBlocker', + }, + ], + }); + + const result = addPlugin(umi, { + asset: asset.publicKey, + plugin: { + type: 'Attributes', + attributeList: [], + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); + +test('it can add plugins unless AddBlocker is added', async (t) => { + const umi = await createUmi(); + const asset = await createAsset(umi); + + await addPlugin(umi, { + asset: asset.publicKey, + plugin: { + type: 'Attributes', + + attributeList: [], + }, + }).sendAndConfirm(umi); + + await addPlugin(umi, { + asset: asset.publicKey, + plugin: { + type: 'AddBlocker', + }, + }).sendAndConfirm(umi); + + await assertAsset(t, umi, { + ...DEFAULT_ASSET, + asset: asset.publicKey, + owner: umi.identity.publicKey, + attributes: { + authority: { + type: 'UpdateAuthority', + }, + attributeList: [], + }, + addBlocker: { + authority: { + type: 'UpdateAuthority', + }, + }, + }); + + const result = addPlugin(umi, { + asset: asset.publicKey, + plugin: { + type: 'Attributes', + + attributeList: [], + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); + +test('it can add owner-managed plugins even if AddBlocker had been added', async (t) => { + // Given a Umi instance and a new signer. + const umi = await createUmi(); + + const asset = await createAsset(umi, { + plugins: [ + { + type: 'AddBlocker', + }, + ], + }); + + await addPlugin(umi, { + asset: asset.publicKey, + plugin: { type: 'FreezeDelegate', frozen: false }, + }).sendAndConfirm(umi); + + await assertAsset(t, umi, { + ...DEFAULT_ASSET, + asset: asset.publicKey, + owner: umi.identity.publicKey, + freezeDelegate: { + authority: { + type: 'Owner', + }, + frozen: false, + }, + addBlocker: { + authority: { + type: 'UpdateAuthority', + }, + }, + }); +}); + +test('it states that UA is the only one who can add the AddBlocker', async (t) => { + const umi = await createUmi(); + const updateAuthority = generateSigner(umi); + const randomUser = generateSigner(umi); + const asset = await createAsset(umi, { + updateAuthority: updateAuthority.publicKey, + }); + + // random keypair can't add AddBlocker + let result = addPlugin(umi, { + authority: randomUser, + asset: asset.publicKey, + plugin: { + type: 'AddBlocker', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'NoApprovals', + }); + + // Owner can't add AddBlocker + result = addPlugin(umi, { + authority: umi.identity, + asset: asset.publicKey, + plugin: { + type: 'AddBlocker', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'NoApprovals', + }); + + // UA CAN add AddBlocker + await addPlugin(umi, { + authority: updateAuthority, + asset: asset.publicKey, + plugin: { type: 'AddBlocker' }, + }).sendAndConfirm(umi); + + await assertAsset(t, umi, { + ...DEFAULT_ASSET, + asset: asset.publicKey, + owner: umi.identity.publicKey, + addBlocker: { + authority: { + type: 'UpdateAuthority', + }, + }, + }); +}); diff --git a/clients/js/test/plugins/asset/immutableMetadata.test.ts b/clients/js/test/plugins/asset/immutableMetadata.test.ts new file mode 100644 index 00000000..7662c115 --- /dev/null +++ b/clients/js/test/plugins/asset/immutableMetadata.test.ts @@ -0,0 +1,118 @@ +import test from 'ava'; +import { generateSigner } from '@metaplex-foundation/umi'; + +import { addPlugin, update } from '../../../src'; +import { DEFAULT_ASSET, assertAsset, createUmi } from '../../_setupRaw'; +import { createAsset } from '../../_setupSdk'; + +test('it can prevent the asset from metadata updating', async (t) => { + // Given a Umi instance and a new signer. + const umi = await createUmi(); + + const asset = await createAsset(umi, { + plugins: [ + { + type: 'ImmutableMetadata', + }, + ], + }); + + const result = update(umi, { + asset, + name: 'bread', + uri: 'https://example.com/bread', + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); + +test('it can mutate its metadata unless ImmutableMetadata plugin is added', async (t) => { + const umi = await createUmi(); + const asset = await createAsset(umi); + + await update(umi, { + asset, + name: 'Test Bread 2', + uri: 'https://example.com/bread2', + }).sendAndConfirm(umi); + + await assertAsset(t, umi, { + asset: asset.publicKey, + owner: umi.identity.publicKey, + updateAuthority: { type: 'Address', address: umi.identity.publicKey }, + name: 'Test Bread 2', + uri: 'https://example.com/bread2', + }); + + await addPlugin(umi, { + asset: asset.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + const result = update(umi, { + asset, + name: 'Test Bread 3', + uri: 'https://example.com/bread3', + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); + +test('it states that UA is the only one who can add the ImmutableMetadata', async (t) => { + const umi = await createUmi(); + const updateAuthority = generateSigner(umi); + const randomUser = generateSigner(umi); + const asset = await createAsset(umi, { + updateAuthority: updateAuthority.publicKey, + }); + + // random keypair can't add ImmutableMetadata + let result = addPlugin(umi, { + authority: randomUser, + asset: asset.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'NoApprovals', + }); + + // Owner can't add ImmutableMetadata + result = addPlugin(umi, { + authority: umi.identity, + asset: asset.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'NoApprovals', + }); + + // UA CAN add ImmutableMetadata + await addPlugin(umi, { + authority: updateAuthority, + asset: asset.publicKey, + plugin: { type: 'ImmutableMetadata' }, + }).sendAndConfirm(umi); + + await assertAsset(t, umi, { + ...DEFAULT_ASSET, + asset: asset.publicKey, + owner: umi.identity.publicKey, + immutableMetadata: { + authority: { + type: 'UpdateAuthority', + }, + }, + }); +}); diff --git a/clients/js/test/plugins/collection/addBlocker.test.ts b/clients/js/test/plugins/collection/addBlocker.test.ts new file mode 100644 index 00000000..f5ef6f47 --- /dev/null +++ b/clients/js/test/plugins/collection/addBlocker.test.ts @@ -0,0 +1,160 @@ +import test from 'ava'; + +import { generateSigner } from '@metaplex-foundation/umi'; +import { + DEFAULT_COLLECTION, + assertCollection, + createUmi, +} from '../../_setupRaw'; +import { createAsset, createCollection } from '../../_setupSdk'; +import { addCollectionPlugin, addPlugin } from '../../../src'; + +test('it can add addBlocker to collection', async (t) => { + const umi = await createUmi(); + const collection = await createCollection(umi); + + await addCollectionPlugin(umi, { + collection: collection.publicKey, + plugin: { + type: 'AddBlocker', + }, + }).sendAndConfirm(umi); + + await assertCollection(t, umi, { + ...DEFAULT_COLLECTION, + collection: collection.publicKey, + updateAuthority: umi.identity.publicKey, + addBlocker: { + authority: { + type: 'UpdateAuthority', + }, + }, + }); +}); + +test('it cannot add UA-managed plugin to a collection if addBlocker had been added on creation', async (t) => { + const umi = await createUmi(); + const collection = await createCollection(umi, { + plugins: [ + { + type: 'AddBlocker', + }, + ], + }); + + const result = addCollectionPlugin(umi, { + collection: collection.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); + +test('it cannot add UA-managed plugin to an asset in a collection if addBlocker had been added on creation', async (t) => { + const umi = await createUmi(); + const collection = await createCollection(umi, { + plugins: [ + { + type: 'AddBlocker', + }, + ], + }); + const asset = await createAsset(umi, { + collection: collection.publicKey, + }); + + const result = addPlugin(umi, { + collection: collection.publicKey, + asset: asset.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); + +test('it prevents plugins from being added to both collection and plugins when collection is created with AddBlocker', async (t) => { + const umi = await createUmi(); + const updateAuthority = generateSigner(umi); + const collection = await createCollection(umi, { + plugins: [ + { + type: 'AddBlocker', + authority: { + type: 'UpdateAuthority', + }, + }, + ], + updateAuthority, + }); + const asset = await createAsset(umi, { + collection: collection.publicKey, + authority: updateAuthority, + }); + + let result = addCollectionPlugin(umi, { + collection: collection.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); + + result = addPlugin(umi, { + collection: collection.publicKey, + asset: asset.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); + +test('it prevents plugins from being added to both collection and plugins when AddBlocker is added to a collection', async (t) => { + const umi = await createUmi(); + const collection = await createCollection(umi); + const asset = await createAsset(umi, { collection: collection.publicKey }); + + await addCollectionPlugin(umi, { + collection: collection.publicKey, + plugin: { + type: 'AddBlocker', + }, + }).sendAndConfirm(umi); + + let result = addCollectionPlugin(umi, { + collection: collection.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); + + result = addPlugin(umi, { + collection: collection.publicKey, + asset: asset.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); diff --git a/clients/js/test/plugins/collection/immutableMetadata.test.ts b/clients/js/test/plugins/collection/immutableMetadata.test.ts new file mode 100644 index 00000000..f58e810d --- /dev/null +++ b/clients/js/test/plugins/collection/immutableMetadata.test.ts @@ -0,0 +1,152 @@ +import test from 'ava'; +import { generateSigner } from '@metaplex-foundation/umi'; + +import { + DEFAULT_COLLECTION, + assertCollection, + createUmi, +} from '../../_setupRaw'; +import { addCollectionPlugin, update, updateCollection } from '../../../src'; +import { createAsset, createCollection } from '../../_setupSdk'; + +test('it can add immutableMetadata to collection', async (t) => { + const umi = await createUmi(); + const collection = await createCollection(umi); + + await addCollectionPlugin(umi, { + collection: collection.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await assertCollection(t, umi, { + ...DEFAULT_COLLECTION, + collection: collection.publicKey, + updateAuthority: umi.identity.publicKey, + immutableMetadata: { + authority: { + type: 'UpdateAuthority', + }, + }, + }); +}); + +test('it can prevent collection assets metadata from being updated', async (t) => { + const umi = await createUmi(); + const collection = await createCollection(umi); + + await addCollectionPlugin(umi, { + collection: collection.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + const asset = await createAsset(umi, { + collection: collection.publicKey, + }); + + const result = update(umi, { + collection, + asset, + name: 'Test Bread 3', + uri: 'https://example.com/bread3', + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); + +test('it states that UA is the only one who can add the ImmutableMetadata', async (t) => { + const umi = await createUmi(); + const updateAuthority = generateSigner(umi); + const randomUser = generateSigner(umi); + const collection = await createCollection(umi, { updateAuthority }); + + // random keypair can't add ImmutableMetadata + let result = addCollectionPlugin(umi, { + authority: randomUser, + collection: collection.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); + + // Payer for the the collection can't add ImmutableMetadata + result = addCollectionPlugin(umi, { + authority: umi.identity, + collection: collection.publicKey, + plugin: { + type: 'ImmutableMetadata', + }, + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); + + // UA CAN add ImmutableMetadata + await addCollectionPlugin(umi, { + authority: updateAuthority, + collection: collection.publicKey, + plugin: { type: 'ImmutableMetadata' }, + }).sendAndConfirm(umi); + + await assertCollection(t, umi, { + ...DEFAULT_COLLECTION, + collection: collection.publicKey, + immutableMetadata: { + authority: { + type: 'UpdateAuthority', + }, + }, + }); +}); + +test('it prevents both collection and asset from their meta updating when ImmutableMetadata is added', async (t) => { + const umi = await createUmi(); + const updateAuthority = generateSigner(umi); + const collection = await createCollection(umi, { + plugins: [ + { + type: 'ImmutableMetadata', + authority: { + type: 'UpdateAuthority', + }, + }, + ], + updateAuthority, + }); + const asset = await createAsset(umi, { + collection: collection.publicKey, + authority: updateAuthority, + }); + + let result = update(umi, { + collection, + asset, + name: 'Test Bread 2', + uri: 'https://example.com/bread2', + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); + + result = updateCollection(umi, { + authority: updateAuthority, + collection: collection.publicKey, + name: 'Test', + uri: 'Test', + }).sendAndConfirm(umi); + + await t.throwsAsync(result, { + name: 'InvalidAuthority', + }); +}); diff --git a/clients/rust/Cargo.toml b/clients/rust/Cargo.toml index 8ccf50bd..4121aed3 100644 --- a/clients/rust/Cargo.toml +++ b/clients/rust/Cargo.toml @@ -2,7 +2,7 @@ name = "mpl-core" description = "A flexible digital asset standard for Solana" repository = "https://github.com/metaplex-foundation/mpl-core" -version = "0.5.1" +version = "0.6.0" edition = "2021" readme = "README.md" license-file = "../../LICENSE" @@ -13,6 +13,7 @@ crate-type = ["cdylib", "lib"] [features] test-sbf = [] serde = ["dep:serde", "dep:serde_with"] +anchor = ["dep:anchor-lang"] [dependencies] borsh = "^0.10" @@ -23,6 +24,7 @@ serde_with = { version = "^3.0", optional = true } solana-program = "> 1.14, < 1.18" thiserror = "^1.0" base64 = "0.22.0" +anchor-lang = { version = "0.30.0", optional = true } [dev-dependencies] assert_matches = "1.5.0" diff --git a/clients/rust/src/generated/accounts/base_asset_v1.rs b/clients/rust/src/generated/accounts/base_asset_v1.rs index 371867ed..ddf2ebb0 100644 --- a/clients/rust/src/generated/accounts/base_asset_v1.rs +++ b/clients/rust/src/generated/accounts/base_asset_v1.rs @@ -7,12 +7,16 @@ use crate::generated::types::Key; use crate::generated::types::UpdateAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct BaseAssetV1 { pub key: Key, #[cfg_attr( diff --git a/clients/rust/src/generated/accounts/base_collection_v1.rs b/clients/rust/src/generated/accounts/base_collection_v1.rs index 09e157e3..ec75e71d 100644 --- a/clients/rust/src/generated/accounts/base_collection_v1.rs +++ b/clients/rust/src/generated/accounts/base_collection_v1.rs @@ -6,12 +6,16 @@ //! use crate::generated::types::Key; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct BaseCollectionV1 { pub key: Key, #[cfg_attr( diff --git a/clients/rust/src/generated/accounts/hashed_asset_v1.rs b/clients/rust/src/generated/accounts/hashed_asset_v1.rs index 1b87fc03..6237c78b 100644 --- a/clients/rust/src/generated/accounts/hashed_asset_v1.rs +++ b/clients/rust/src/generated/accounts/hashed_asset_v1.rs @@ -6,11 +6,15 @@ //! use crate::generated::types::Key; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct HashedAssetV1 { pub key: Key, pub hash: [u8; 32], diff --git a/clients/rust/src/generated/accounts/plugin_header_v1.rs b/clients/rust/src/generated/accounts/plugin_header_v1.rs index 386ac39b..f8928370 100644 --- a/clients/rust/src/generated/accounts/plugin_header_v1.rs +++ b/clients/rust/src/generated/accounts/plugin_header_v1.rs @@ -6,11 +6,15 @@ //! use crate::generated::types::Key; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct PluginHeaderV1 { pub key: Key, pub plugin_registry_offset: u64, diff --git a/clients/rust/src/generated/accounts/plugin_registry_v1.rs b/clients/rust/src/generated/accounts/plugin_registry_v1.rs index 55dfd242..89ecb74e 100644 --- a/clients/rust/src/generated/accounts/plugin_registry_v1.rs +++ b/clients/rust/src/generated/accounts/plugin_registry_v1.rs @@ -8,11 +8,15 @@ use crate::generated::types::ExternalRegistryRecord; use crate::generated::types::Key; use crate::generated::types::RegistryRecord; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct PluginRegistryV1 { pub key: Key, pub registry: Vec, diff --git a/clients/rust/src/generated/instructions/add_collection_external_plugin_v1.rs b/clients/rust/src/generated/instructions/add_collection_external_plugin_v1.rs index 9fd37ae9..6b4b5994 100644 --- a/clients/rust/src/generated/instructions/add_collection_external_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/add_collection_external_plugin_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::ExternalPluginInitInfo; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct AddCollectionExternalPluginV1 { @@ -84,7 +86,8 @@ impl AddCollectionExternalPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct AddCollectionExternalPluginV1InstructionData { discriminator: u8, } @@ -95,8 +98,10 @@ impl AddCollectionExternalPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct AddCollectionExternalPluginV1InstructionArgs { pub init_info: ExternalPluginInitInfo, } diff --git a/clients/rust/src/generated/instructions/add_collection_plugin_v1.rs b/clients/rust/src/generated/instructions/add_collection_plugin_v1.rs index 8ed472af..bc2ac73b 100644 --- a/clients/rust/src/generated/instructions/add_collection_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/add_collection_plugin_v1.rs @@ -7,8 +7,10 @@ use crate::generated::types::Plugin; use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct AddCollectionPluginV1 { @@ -85,7 +87,8 @@ impl AddCollectionPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct AddCollectionPluginV1InstructionData { discriminator: u8, } @@ -96,8 +99,10 @@ impl AddCollectionPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct AddCollectionPluginV1InstructionArgs { pub plugin: Plugin, pub init_authority: Option, diff --git a/clients/rust/src/generated/instructions/add_external_plugin_v1.rs b/clients/rust/src/generated/instructions/add_external_plugin_v1.rs index 014b1f55..2548bf87 100644 --- a/clients/rust/src/generated/instructions/add_external_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/add_external_plugin_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::ExternalPluginInitInfo; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct AddExternalPluginV1 { @@ -95,7 +97,8 @@ impl AddExternalPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct AddExternalPluginV1InstructionData { discriminator: u8, } @@ -106,8 +109,10 @@ impl AddExternalPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct AddExternalPluginV1InstructionArgs { pub init_info: ExternalPluginInitInfo, } diff --git a/clients/rust/src/generated/instructions/add_plugin_v1.rs b/clients/rust/src/generated/instructions/add_plugin_v1.rs index cdf2bb69..41f5ad6c 100644 --- a/clients/rust/src/generated/instructions/add_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/add_plugin_v1.rs @@ -7,8 +7,10 @@ use crate::generated::types::Plugin; use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct AddPluginV1 { @@ -94,7 +96,8 @@ impl AddPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct AddPluginV1InstructionData { discriminator: u8, } @@ -105,8 +108,10 @@ impl AddPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct AddPluginV1InstructionArgs { pub plugin: Plugin, pub init_authority: Option, diff --git a/clients/rust/src/generated/instructions/approve_collection_plugin_authority_v1.rs b/clients/rust/src/generated/instructions/approve_collection_plugin_authority_v1.rs index 0a117ef1..673bcfe0 100644 --- a/clients/rust/src/generated/instructions/approve_collection_plugin_authority_v1.rs +++ b/clients/rust/src/generated/instructions/approve_collection_plugin_authority_v1.rs @@ -7,8 +7,10 @@ use crate::generated::types::PluginAuthority; use crate::generated::types::PluginType; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct ApproveCollectionPluginAuthorityV1 { @@ -85,7 +87,8 @@ impl ApproveCollectionPluginAuthorityV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct ApproveCollectionPluginAuthorityV1InstructionData { discriminator: u8, } @@ -96,8 +99,10 @@ impl ApproveCollectionPluginAuthorityV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct ApproveCollectionPluginAuthorityV1InstructionArgs { pub plugin_type: PluginType, pub new_authority: PluginAuthority, diff --git a/clients/rust/src/generated/instructions/approve_plugin_authority_v1.rs b/clients/rust/src/generated/instructions/approve_plugin_authority_v1.rs index a259c598..d8277e68 100644 --- a/clients/rust/src/generated/instructions/approve_plugin_authority_v1.rs +++ b/clients/rust/src/generated/instructions/approve_plugin_authority_v1.rs @@ -7,8 +7,10 @@ use crate::generated::types::PluginAuthority; use crate::generated::types::PluginType; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct ApprovePluginAuthorityV1 { @@ -96,7 +98,8 @@ impl ApprovePluginAuthorityV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct ApprovePluginAuthorityV1InstructionData { discriminator: u8, } @@ -107,8 +110,10 @@ impl ApprovePluginAuthorityV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct ApprovePluginAuthorityV1InstructionArgs { pub plugin_type: PluginType, pub new_authority: PluginAuthority, diff --git a/clients/rust/src/generated/instructions/burn_collection_v1.rs b/clients/rust/src/generated/instructions/burn_collection_v1.rs index 65d86f20..95450532 100644 --- a/clients/rust/src/generated/instructions/burn_collection_v1.rs +++ b/clients/rust/src/generated/instructions/burn_collection_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::CompressionProof; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct BurnCollectionV1 { @@ -76,7 +78,8 @@ impl BurnCollectionV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct BurnCollectionV1InstructionData { discriminator: u8, } @@ -87,8 +90,10 @@ impl BurnCollectionV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct BurnCollectionV1InstructionArgs { pub compression_proof: Option, } diff --git a/clients/rust/src/generated/instructions/burn_v1.rs b/clients/rust/src/generated/instructions/burn_v1.rs index 02d1dcde..ca904d32 100644 --- a/clients/rust/src/generated/instructions/burn_v1.rs +++ b/clients/rust/src/generated/instructions/burn_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::CompressionProof; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct BurnV1 { @@ -100,7 +102,8 @@ impl BurnV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct BurnV1InstructionData { discriminator: u8, } @@ -111,8 +114,10 @@ impl BurnV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct BurnV1InstructionArgs { pub compression_proof: Option, } diff --git a/clients/rust/src/generated/instructions/collect.rs b/clients/rust/src/generated/instructions/collect.rs index 3593b4f1..ba986da7 100644 --- a/clients/rust/src/generated/instructions/collect.rs +++ b/clients/rust/src/generated/instructions/collect.rs @@ -5,8 +5,10 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct Collect { @@ -45,7 +47,8 @@ impl Collect { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct CollectInstructionData { discriminator: u8, } diff --git a/clients/rust/src/generated/instructions/compress_v1.rs b/clients/rust/src/generated/instructions/compress_v1.rs index ddee8f22..2608e7fc 100644 --- a/clients/rust/src/generated/instructions/compress_v1.rs +++ b/clients/rust/src/generated/instructions/compress_v1.rs @@ -5,8 +5,10 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct CompressV1 { @@ -86,7 +88,8 @@ impl CompressV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct CompressV1InstructionData { discriminator: u8, } diff --git a/clients/rust/src/generated/instructions/create_collection_v1.rs b/clients/rust/src/generated/instructions/create_collection_v1.rs index 7c6a08af..612c1d3b 100644 --- a/clients/rust/src/generated/instructions/create_collection_v1.rs +++ b/clients/rust/src/generated/instructions/create_collection_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::PluginAuthorityPair; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct CreateCollectionV1 { @@ -72,7 +74,8 @@ impl CreateCollectionV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct CreateCollectionV1InstructionData { discriminator: u8, } @@ -83,8 +86,10 @@ impl CreateCollectionV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct CreateCollectionV1InstructionArgs { pub name: String, pub uri: String, diff --git a/clients/rust/src/generated/instructions/create_collection_v2.rs b/clients/rust/src/generated/instructions/create_collection_v2.rs index ca98b331..26ba05ed 100644 --- a/clients/rust/src/generated/instructions/create_collection_v2.rs +++ b/clients/rust/src/generated/instructions/create_collection_v2.rs @@ -7,8 +7,10 @@ use crate::generated::types::ExternalPluginInitInfo; use crate::generated::types::PluginAuthorityPair; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct CreateCollectionV2 { @@ -73,7 +75,8 @@ impl CreateCollectionV2 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct CreateCollectionV2InstructionData { discriminator: u8, } @@ -84,8 +87,10 @@ impl CreateCollectionV2InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct CreateCollectionV2InstructionArgs { pub name: String, pub uri: String, diff --git a/clients/rust/src/generated/instructions/create_v1.rs b/clients/rust/src/generated/instructions/create_v1.rs index ccbcd918..c3aec2ef 100644 --- a/clients/rust/src/generated/instructions/create_v1.rs +++ b/clients/rust/src/generated/instructions/create_v1.rs @@ -7,8 +7,10 @@ use crate::generated::types::DataState; use crate::generated::types::PluginAuthorityPair; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct CreateV1 { @@ -119,7 +121,8 @@ impl CreateV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct CreateV1InstructionData { discriminator: u8, } @@ -130,8 +133,10 @@ impl CreateV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct CreateV1InstructionArgs { pub data_state: DataState, pub name: String, diff --git a/clients/rust/src/generated/instructions/create_v2.rs b/clients/rust/src/generated/instructions/create_v2.rs index 44eadb28..7b048c89 100644 --- a/clients/rust/src/generated/instructions/create_v2.rs +++ b/clients/rust/src/generated/instructions/create_v2.rs @@ -8,8 +8,10 @@ use crate::generated::types::DataState; use crate::generated::types::ExternalPluginInitInfo; use crate::generated::types::PluginAuthorityPair; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct CreateV2 { @@ -120,7 +122,8 @@ impl CreateV2 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct CreateV2InstructionData { discriminator: u8, } @@ -131,8 +134,10 @@ impl CreateV2InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct CreateV2InstructionArgs { pub data_state: DataState, pub name: String, diff --git a/clients/rust/src/generated/instructions/decompress_v1.rs b/clients/rust/src/generated/instructions/decompress_v1.rs index c634069e..b0d20eb1 100644 --- a/clients/rust/src/generated/instructions/decompress_v1.rs +++ b/clients/rust/src/generated/instructions/decompress_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::CompressionProof; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct DecompressV1 { @@ -93,7 +95,8 @@ impl DecompressV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct DecompressV1InstructionData { discriminator: u8, } @@ -104,8 +107,10 @@ impl DecompressV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct DecompressV1InstructionArgs { pub compression_proof: CompressionProof, } diff --git a/clients/rust/src/generated/instructions/remove_collection_external_plugin_v1.rs b/clients/rust/src/generated/instructions/remove_collection_external_plugin_v1.rs index 757e37ca..9dde3d8a 100644 --- a/clients/rust/src/generated/instructions/remove_collection_external_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/remove_collection_external_plugin_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::ExternalPluginKey; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct RemoveCollectionExternalPluginV1 { @@ -84,7 +86,8 @@ impl RemoveCollectionExternalPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct RemoveCollectionExternalPluginV1InstructionData { discriminator: u8, } @@ -95,8 +98,10 @@ impl RemoveCollectionExternalPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct RemoveCollectionExternalPluginV1InstructionArgs { pub key: ExternalPluginKey, } diff --git a/clients/rust/src/generated/instructions/remove_collection_plugin_v1.rs b/clients/rust/src/generated/instructions/remove_collection_plugin_v1.rs index 036df350..beff3b2d 100644 --- a/clients/rust/src/generated/instructions/remove_collection_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/remove_collection_plugin_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::PluginType; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct RemoveCollectionPluginV1 { @@ -84,7 +86,8 @@ impl RemoveCollectionPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct RemoveCollectionPluginV1InstructionData { discriminator: u8, } @@ -95,8 +98,10 @@ impl RemoveCollectionPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct RemoveCollectionPluginV1InstructionArgs { pub plugin_type: PluginType, } diff --git a/clients/rust/src/generated/instructions/remove_external_plugin_v1.rs b/clients/rust/src/generated/instructions/remove_external_plugin_v1.rs index a6204334..106f9cf6 100644 --- a/clients/rust/src/generated/instructions/remove_external_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/remove_external_plugin_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::ExternalPluginKey; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct RemoveExternalPluginV1 { @@ -95,7 +97,8 @@ impl RemoveExternalPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct RemoveExternalPluginV1InstructionData { discriminator: u8, } @@ -106,8 +109,10 @@ impl RemoveExternalPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct RemoveExternalPluginV1InstructionArgs { pub key: ExternalPluginKey, } diff --git a/clients/rust/src/generated/instructions/remove_plugin_v1.rs b/clients/rust/src/generated/instructions/remove_plugin_v1.rs index 82a7d727..0b069144 100644 --- a/clients/rust/src/generated/instructions/remove_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/remove_plugin_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::PluginType; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct RemovePluginV1 { @@ -93,7 +95,8 @@ impl RemovePluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct RemovePluginV1InstructionData { discriminator: u8, } @@ -104,8 +107,10 @@ impl RemovePluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct RemovePluginV1InstructionArgs { pub plugin_type: PluginType, } diff --git a/clients/rust/src/generated/instructions/revoke_collection_plugin_authority_v1.rs b/clients/rust/src/generated/instructions/revoke_collection_plugin_authority_v1.rs index 32c33832..3b6c7fce 100644 --- a/clients/rust/src/generated/instructions/revoke_collection_plugin_authority_v1.rs +++ b/clients/rust/src/generated/instructions/revoke_collection_plugin_authority_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::PluginType; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct RevokeCollectionPluginAuthorityV1 { @@ -84,7 +86,8 @@ impl RevokeCollectionPluginAuthorityV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct RevokeCollectionPluginAuthorityV1InstructionData { discriminator: u8, } @@ -95,8 +98,10 @@ impl RevokeCollectionPluginAuthorityV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct RevokeCollectionPluginAuthorityV1InstructionArgs { pub plugin_type: PluginType, } diff --git a/clients/rust/src/generated/instructions/revoke_plugin_authority_v1.rs b/clients/rust/src/generated/instructions/revoke_plugin_authority_v1.rs index bd6b1c2a..9b194290 100644 --- a/clients/rust/src/generated/instructions/revoke_plugin_authority_v1.rs +++ b/clients/rust/src/generated/instructions/revoke_plugin_authority_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::PluginType; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct RevokePluginAuthorityV1 { @@ -95,7 +97,8 @@ impl RevokePluginAuthorityV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct RevokePluginAuthorityV1InstructionData { discriminator: u8, } @@ -106,8 +109,10 @@ impl RevokePluginAuthorityV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct RevokePluginAuthorityV1InstructionArgs { pub plugin_type: PluginType, } diff --git a/clients/rust/src/generated/instructions/transfer_v1.rs b/clients/rust/src/generated/instructions/transfer_v1.rs index 8fb04cdd..35eb244c 100644 --- a/clients/rust/src/generated/instructions/transfer_v1.rs +++ b/clients/rust/src/generated/instructions/transfer_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::CompressionProof; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct TransferV1 { @@ -106,7 +108,8 @@ impl TransferV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct TransferV1InstructionData { discriminator: u8, } @@ -117,8 +120,10 @@ impl TransferV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct TransferV1InstructionArgs { pub compression_proof: Option, } diff --git a/clients/rust/src/generated/instructions/update_collection_external_plugin_v1.rs b/clients/rust/src/generated/instructions/update_collection_external_plugin_v1.rs index 39856c84..8e1a3f2b 100644 --- a/clients/rust/src/generated/instructions/update_collection_external_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/update_collection_external_plugin_v1.rs @@ -7,8 +7,10 @@ use crate::generated::types::ExternalPluginKey; use crate::generated::types::ExternalPluginUpdateInfo; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct UpdateCollectionExternalPluginV1 { @@ -85,7 +87,8 @@ impl UpdateCollectionExternalPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct UpdateCollectionExternalPluginV1InstructionData { discriminator: u8, } @@ -96,8 +99,10 @@ impl UpdateCollectionExternalPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct UpdateCollectionExternalPluginV1InstructionArgs { pub key: ExternalPluginKey, pub update_info: ExternalPluginUpdateInfo, diff --git a/clients/rust/src/generated/instructions/update_collection_plugin_v1.rs b/clients/rust/src/generated/instructions/update_collection_plugin_v1.rs index f5dbfe0f..dcdceea4 100644 --- a/clients/rust/src/generated/instructions/update_collection_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/update_collection_plugin_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::Plugin; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct UpdateCollectionPluginV1 { @@ -84,7 +86,8 @@ impl UpdateCollectionPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct UpdateCollectionPluginV1InstructionData { discriminator: u8, } @@ -95,8 +98,10 @@ impl UpdateCollectionPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct UpdateCollectionPluginV1InstructionArgs { pub plugin: Plugin, } diff --git a/clients/rust/src/generated/instructions/update_collection_v1.rs b/clients/rust/src/generated/instructions/update_collection_v1.rs index 7ed50069..7213b870 100644 --- a/clients/rust/src/generated/instructions/update_collection_v1.rs +++ b/clients/rust/src/generated/instructions/update_collection_v1.rs @@ -5,8 +5,10 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct UpdateCollectionV1 { @@ -96,7 +98,8 @@ impl UpdateCollectionV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct UpdateCollectionV1InstructionData { discriminator: u8, } @@ -107,8 +110,10 @@ impl UpdateCollectionV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct UpdateCollectionV1InstructionArgs { pub new_name: Option, pub new_uri: Option, diff --git a/clients/rust/src/generated/instructions/update_external_plugin_v1.rs b/clients/rust/src/generated/instructions/update_external_plugin_v1.rs index abca5489..09faadb6 100644 --- a/clients/rust/src/generated/instructions/update_external_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/update_external_plugin_v1.rs @@ -7,8 +7,10 @@ use crate::generated::types::ExternalPluginKey; use crate::generated::types::ExternalPluginUpdateInfo; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct UpdateExternalPluginV1 { @@ -96,7 +98,8 @@ impl UpdateExternalPluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct UpdateExternalPluginV1InstructionData { discriminator: u8, } @@ -107,8 +110,10 @@ impl UpdateExternalPluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct UpdateExternalPluginV1InstructionArgs { pub key: ExternalPluginKey, pub update_info: ExternalPluginUpdateInfo, diff --git a/clients/rust/src/generated/instructions/update_plugin_v1.rs b/clients/rust/src/generated/instructions/update_plugin_v1.rs index 8e894d08..c8201f28 100644 --- a/clients/rust/src/generated/instructions/update_plugin_v1.rs +++ b/clients/rust/src/generated/instructions/update_plugin_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::Plugin; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct UpdatePluginV1 { @@ -93,7 +95,8 @@ impl UpdatePluginV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct UpdatePluginV1InstructionData { discriminator: u8, } @@ -104,8 +107,10 @@ impl UpdatePluginV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct UpdatePluginV1InstructionArgs { pub plugin: Plugin, } diff --git a/clients/rust/src/generated/instructions/update_v1.rs b/clients/rust/src/generated/instructions/update_v1.rs index 62ccd844..67de196b 100644 --- a/clients/rust/src/generated/instructions/update_v1.rs +++ b/clients/rust/src/generated/instructions/update_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::UpdateAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct UpdateV1 { @@ -93,7 +95,8 @@ impl UpdateV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct UpdateV1InstructionData { discriminator: u8, } @@ -104,8 +107,10 @@ impl UpdateV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct UpdateV1InstructionArgs { pub new_name: Option, pub new_uri: Option, diff --git a/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs index cb65b31b..acf3f3cf 100644 --- a/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::ExternalPluginKey; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct WriteCollectionExternalPluginDataV1 { @@ -84,7 +86,8 @@ impl WriteCollectionExternalPluginDataV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct WriteCollectionExternalPluginDataV1InstructionData { discriminator: u8, } @@ -95,8 +98,10 @@ impl WriteCollectionExternalPluginDataV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct WriteCollectionExternalPluginDataV1InstructionArgs { pub key: ExternalPluginKey, pub data: Vec, diff --git a/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs index 023923f7..e9166487 100644 --- a/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs @@ -6,8 +6,10 @@ //! use crate::generated::types::ExternalPluginKey; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; /// Accounts. pub struct WriteExternalPluginDataV1 { @@ -95,7 +97,8 @@ impl WriteExternalPluginDataV1 { } } -#[derive(BorshDeserialize, BorshSerialize)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] pub struct WriteExternalPluginDataV1InstructionData { discriminator: u8, } @@ -106,8 +109,10 @@ impl WriteExternalPluginDataV1InstructionData { } } -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct WriteExternalPluginDataV1InstructionArgs { pub key: ExternalPluginKey, pub data: Vec, diff --git a/clients/rust/src/generated/types/add_blocker.rs b/clients/rust/src/generated/types/add_blocker.rs new file mode 100644 index 00000000..ec184a62 --- /dev/null +++ b/clients/rust/src/generated/types/add_blocker.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] +//! + +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; + +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct AddBlocker {} diff --git a/clients/rust/src/generated/types/attribute.rs b/clients/rust/src/generated/types/attribute.rs index 0f6097c0..76fb96b6 100644 --- a/clients/rust/src/generated/types/attribute.rs +++ b/clients/rust/src/generated/types/attribute.rs @@ -5,11 +5,15 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Attribute { pub key: String, pub value: String, diff --git a/clients/rust/src/generated/types/attributes.rs b/clients/rust/src/generated/types/attributes.rs index 835c72f2..00391279 100644 --- a/clients/rust/src/generated/types/attributes.rs +++ b/clients/rust/src/generated/types/attributes.rs @@ -6,11 +6,15 @@ //! use crate::generated::types::Attribute; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Attributes { pub attribute_list: Vec, } diff --git a/clients/rust/src/generated/types/burn_delegate.rs b/clients/rust/src/generated/types/burn_delegate.rs index a201926e..483e8077 100644 --- a/clients/rust/src/generated/types/burn_delegate.rs +++ b/clients/rust/src/generated/types/burn_delegate.rs @@ -5,9 +5,13 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct BurnDelegate {} diff --git a/clients/rust/src/generated/types/compression_proof.rs b/clients/rust/src/generated/types/compression_proof.rs index 91a227ac..117ae310 100644 --- a/clients/rust/src/generated/types/compression_proof.rs +++ b/clients/rust/src/generated/types/compression_proof.rs @@ -7,12 +7,16 @@ use crate::generated::types::HashablePluginSchema; use crate::generated::types::UpdateAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct CompressionProof { #[cfg_attr( feature = "serde", diff --git a/clients/rust/src/generated/types/creator.rs b/clients/rust/src/generated/types/creator.rs index 677c3d58..38cad3fa 100644 --- a/clients/rust/src/generated/types/creator.rs +++ b/clients/rust/src/generated/types/creator.rs @@ -5,12 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Creator { #[cfg_attr( feature = "serde", diff --git a/clients/rust/src/generated/types/data_state.rs b/clients/rust/src/generated/types/data_state.rs index c3f910a7..76276ed1 100644 --- a/clients/rust/src/generated/types/data_state.rs +++ b/clients/rust/src/generated/types/data_state.rs @@ -5,14 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use num_derive::FromPrimitive; -#[derive( - BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, -)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] pub enum DataState { AccountState, LedgerState, diff --git a/clients/rust/src/generated/types/data_store.rs b/clients/rust/src/generated/types/data_store.rs index 0bac10cb..b7ad38e2 100644 --- a/clients/rust/src/generated/types/data_store.rs +++ b/clients/rust/src/generated/types/data_store.rs @@ -7,11 +7,15 @@ use crate::generated::types::ExternalPluginSchema; use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct DataStore { pub data_authority: PluginAuthority, pub schema: ExternalPluginSchema, diff --git a/clients/rust/src/generated/types/data_store_init_info.rs b/clients/rust/src/generated/types/data_store_init_info.rs index 8704d8fa..d03a5fd2 100644 --- a/clients/rust/src/generated/types/data_store_init_info.rs +++ b/clients/rust/src/generated/types/data_store_init_info.rs @@ -7,11 +7,15 @@ use crate::generated::types::ExternalPluginSchema; use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct DataStoreInitInfo { pub data_authority: PluginAuthority, pub init_plugin_authority: Option, diff --git a/clients/rust/src/generated/types/data_store_update_info.rs b/clients/rust/src/generated/types/data_store_update_info.rs index 7a1b3e2e..c6a31437 100644 --- a/clients/rust/src/generated/types/data_store_update_info.rs +++ b/clients/rust/src/generated/types/data_store_update_info.rs @@ -6,11 +6,15 @@ //! use crate::generated::types::ExternalPluginSchema; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct DataStoreUpdateInfo { pub schema: Option, } diff --git a/clients/rust/src/generated/types/edition.rs b/clients/rust/src/generated/types/edition.rs index e662e858..c0ab58b3 100644 --- a/clients/rust/src/generated/types/edition.rs +++ b/clients/rust/src/generated/types/edition.rs @@ -5,11 +5,15 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Edition { pub number: u32, } diff --git a/clients/rust/src/generated/types/external_check_result.rs b/clients/rust/src/generated/types/external_check_result.rs index 0a35b470..344adc52 100644 --- a/clients/rust/src/generated/types/external_check_result.rs +++ b/clients/rust/src/generated/types/external_check_result.rs @@ -5,11 +5,15 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct ExternalCheckResult { pub flags: u32, } diff --git a/clients/rust/src/generated/types/external_plugin.rs b/clients/rust/src/generated/types/external_plugin.rs index b1a78f69..2dc1b48a 100644 --- a/clients/rust/src/generated/types/external_plugin.rs +++ b/clients/rust/src/generated/types/external_plugin.rs @@ -8,11 +8,15 @@ use crate::generated::types::DataStore; use crate::generated::types::LifecycleHook; use crate::generated::types::Oracle; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum ExternalPlugin { LifecycleHook(LifecycleHook), Oracle(Oracle), diff --git a/clients/rust/src/generated/types/external_plugin_init_info.rs b/clients/rust/src/generated/types/external_plugin_init_info.rs index e0ba2a6f..20a838d5 100644 --- a/clients/rust/src/generated/types/external_plugin_init_info.rs +++ b/clients/rust/src/generated/types/external_plugin_init_info.rs @@ -8,11 +8,15 @@ use crate::generated::types::DataStoreInitInfo; use crate::generated::types::LifecycleHookInitInfo; use crate::generated::types::OracleInitInfo; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum ExternalPluginInitInfo { LifecycleHook(LifecycleHookInitInfo), Oracle(OracleInitInfo), diff --git a/clients/rust/src/generated/types/external_plugin_key.rs b/clients/rust/src/generated/types/external_plugin_key.rs index 1ad4c2c5..7550c7ef 100644 --- a/clients/rust/src/generated/types/external_plugin_key.rs +++ b/clients/rust/src/generated/types/external_plugin_key.rs @@ -6,12 +6,16 @@ //! use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum ExternalPluginKey { #[cfg_attr( feature = "serde", diff --git a/clients/rust/src/generated/types/external_plugin_schema.rs b/clients/rust/src/generated/types/external_plugin_schema.rs index c75e7616..164be69d 100644 --- a/clients/rust/src/generated/types/external_plugin_schema.rs +++ b/clients/rust/src/generated/types/external_plugin_schema.rs @@ -5,14 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use num_derive::FromPrimitive; -#[derive( - BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, -)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] pub enum ExternalPluginSchema { Binary, Json, diff --git a/clients/rust/src/generated/types/external_plugin_type.rs b/clients/rust/src/generated/types/external_plugin_type.rs index 8f3795c6..4235e42e 100644 --- a/clients/rust/src/generated/types/external_plugin_type.rs +++ b/clients/rust/src/generated/types/external_plugin_type.rs @@ -5,14 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use num_derive::FromPrimitive; -#[derive( - BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, -)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] pub enum ExternalPluginType { LifecycleHook, Oracle, diff --git a/clients/rust/src/generated/types/external_plugin_update_info.rs b/clients/rust/src/generated/types/external_plugin_update_info.rs index 264b9cf5..0641197c 100644 --- a/clients/rust/src/generated/types/external_plugin_update_info.rs +++ b/clients/rust/src/generated/types/external_plugin_update_info.rs @@ -8,11 +8,15 @@ use crate::generated::types::DataStoreUpdateInfo; use crate::generated::types::LifecycleHookUpdateInfo; use crate::generated::types::OracleUpdateInfo; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum ExternalPluginUpdateInfo { LifecycleHook(LifecycleHookUpdateInfo), Oracle(OracleUpdateInfo), diff --git a/clients/rust/src/generated/types/external_registry_record.rs b/clients/rust/src/generated/types/external_registry_record.rs index 78df2627..63146d39 100644 --- a/clients/rust/src/generated/types/external_registry_record.rs +++ b/clients/rust/src/generated/types/external_registry_record.rs @@ -9,11 +9,15 @@ use crate::generated::types::ExternalCheckResult; use crate::generated::types::ExternalPluginType; use crate::generated::types::HookableLifecycleEvent; use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct ExternalRegistryRecord { pub plugin_type: ExternalPluginType, pub authority: PluginAuthority, diff --git a/clients/rust/src/generated/types/external_validation_result.rs b/clients/rust/src/generated/types/external_validation_result.rs index d24f011d..a97b5912 100644 --- a/clients/rust/src/generated/types/external_validation_result.rs +++ b/clients/rust/src/generated/types/external_validation_result.rs @@ -5,14 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use num_derive::FromPrimitive; -#[derive( - BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, -)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] pub enum ExternalValidationResult { Approved, Rejected, diff --git a/clients/rust/src/generated/types/extra_account.rs b/clients/rust/src/generated/types/extra_account.rs index b1d9413c..8ebab8ec 100644 --- a/clients/rust/src/generated/types/extra_account.rs +++ b/clients/rust/src/generated/types/extra_account.rs @@ -6,12 +6,16 @@ //! use crate::generated::types::Seed; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum ExtraAccount { PreconfiguredProgram { is_signer: bool, diff --git a/clients/rust/src/generated/types/freeze_delegate.rs b/clients/rust/src/generated/types/freeze_delegate.rs index 012858db..288cb267 100644 --- a/clients/rust/src/generated/types/freeze_delegate.rs +++ b/clients/rust/src/generated/types/freeze_delegate.rs @@ -5,11 +5,15 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct FreezeDelegate { pub frozen: bool, } diff --git a/clients/rust/src/generated/types/hashable_plugin_schema.rs b/clients/rust/src/generated/types/hashable_plugin_schema.rs index 6ec12ff9..20285757 100644 --- a/clients/rust/src/generated/types/hashable_plugin_schema.rs +++ b/clients/rust/src/generated/types/hashable_plugin_schema.rs @@ -7,11 +7,15 @@ use crate::generated::types::Plugin; use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct HashablePluginSchema { pub index: u64, pub authority: PluginAuthority, diff --git a/clients/rust/src/generated/types/hashed_asset_schema.rs b/clients/rust/src/generated/types/hashed_asset_schema.rs index 2bc0f967..032abbbf 100644 --- a/clients/rust/src/generated/types/hashed_asset_schema.rs +++ b/clients/rust/src/generated/types/hashed_asset_schema.rs @@ -5,11 +5,15 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct HashedAssetSchema { pub asset_hash: [u8; 32], pub plugin_hashes: Vec<[u8; 32]>, diff --git a/clients/rust/src/generated/types/hookable_lifecycle_event.rs b/clients/rust/src/generated/types/hookable_lifecycle_event.rs index 2fcfe611..51e2288b 100644 --- a/clients/rust/src/generated/types/hookable_lifecycle_event.rs +++ b/clients/rust/src/generated/types/hookable_lifecycle_event.rs @@ -5,14 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use num_derive::FromPrimitive; -#[derive( - BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, -)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] pub enum HookableLifecycleEvent { Create, Transfer, diff --git a/clients/rust/src/generated/types/immutable_metadata.rs b/clients/rust/src/generated/types/immutable_metadata.rs new file mode 100644 index 00000000..9607042e --- /dev/null +++ b/clients/rust/src/generated/types/immutable_metadata.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] +//! + +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; + +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct ImmutableMetadata {} diff --git a/clients/rust/src/generated/types/key.rs b/clients/rust/src/generated/types/key.rs index 451a6393..b6e4313d 100644 --- a/clients/rust/src/generated/types/key.rs +++ b/clients/rust/src/generated/types/key.rs @@ -5,14 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use num_derive::FromPrimitive; -#[derive( - BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, -)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] pub enum Key { Uninitialized, AssetV1, diff --git a/clients/rust/src/generated/types/lifecycle_hook.rs b/clients/rust/src/generated/types/lifecycle_hook.rs index ace6a650..f625972e 100644 --- a/clients/rust/src/generated/types/lifecycle_hook.rs +++ b/clients/rust/src/generated/types/lifecycle_hook.rs @@ -8,12 +8,16 @@ use crate::generated::types::ExternalPluginSchema; use crate::generated::types::ExtraAccount; use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct LifecycleHook { #[cfg_attr( feature = "serde", diff --git a/clients/rust/src/generated/types/lifecycle_hook_init_info.rs b/clients/rust/src/generated/types/lifecycle_hook_init_info.rs index b0ec20a9..b6516a35 100644 --- a/clients/rust/src/generated/types/lifecycle_hook_init_info.rs +++ b/clients/rust/src/generated/types/lifecycle_hook_init_info.rs @@ -10,12 +10,16 @@ use crate::generated::types::ExternalPluginSchema; use crate::generated::types::ExtraAccount; use crate::generated::types::HookableLifecycleEvent; use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct LifecycleHookInitInfo { #[cfg_attr( feature = "serde", diff --git a/clients/rust/src/generated/types/lifecycle_hook_update_info.rs b/clients/rust/src/generated/types/lifecycle_hook_update_info.rs index 0613f475..382a342c 100644 --- a/clients/rust/src/generated/types/lifecycle_hook_update_info.rs +++ b/clients/rust/src/generated/types/lifecycle_hook_update_info.rs @@ -9,11 +9,15 @@ use crate::generated::types::ExternalCheckResult; use crate::generated::types::ExternalPluginSchema; use crate::generated::types::ExtraAccount; use crate::generated::types::HookableLifecycleEvent; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct LifecycleHookUpdateInfo { pub lifecycle_checks: Option>, pub extra_accounts: Option>, diff --git a/clients/rust/src/generated/types/master_edition.rs b/clients/rust/src/generated/types/master_edition.rs index 566c8d77..e39ebeb2 100644 --- a/clients/rust/src/generated/types/master_edition.rs +++ b/clients/rust/src/generated/types/master_edition.rs @@ -5,11 +5,15 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct MasterEdition { pub max_supply: Option, pub name: Option, diff --git a/clients/rust/src/generated/types/mod.rs b/clients/rust/src/generated/types/mod.rs index f926895a..291d366e 100644 --- a/clients/rust/src/generated/types/mod.rs +++ b/clients/rust/src/generated/types/mod.rs @@ -5,6 +5,7 @@ //! [https://github.com/metaplex-foundation/kinobi] //! +pub(crate) mod r#add_blocker; pub(crate) mod r#attribute; pub(crate) mod r#attributes; pub(crate) mod r#burn_delegate; @@ -29,6 +30,7 @@ pub(crate) mod r#freeze_delegate; pub(crate) mod r#hashable_plugin_schema; pub(crate) mod r#hashed_asset_schema; pub(crate) mod r#hookable_lifecycle_event; +pub(crate) mod r#immutable_metadata; pub(crate) mod r#key; pub(crate) mod r#lifecycle_hook; pub(crate) mod r#lifecycle_hook_init_info; @@ -55,6 +57,7 @@ pub(crate) mod r#update_delegate; pub(crate) mod r#validation_result; pub(crate) mod r#validation_results_offset; +pub use self::r#add_blocker::*; pub use self::r#attribute::*; pub use self::r#attributes::*; pub use self::r#burn_delegate::*; @@ -79,6 +82,7 @@ pub use self::r#freeze_delegate::*; pub use self::r#hashable_plugin_schema::*; pub use self::r#hashed_asset_schema::*; pub use self::r#hookable_lifecycle_event::*; +pub use self::r#immutable_metadata::*; pub use self::r#key::*; pub use self::r#lifecycle_hook::*; pub use self::r#lifecycle_hook_init_info::*; diff --git a/clients/rust/src/generated/types/oracle.rs b/clients/rust/src/generated/types/oracle.rs index 2a95fa48..cd004210 100644 --- a/clients/rust/src/generated/types/oracle.rs +++ b/clients/rust/src/generated/types/oracle.rs @@ -7,12 +7,16 @@ use crate::generated::types::ExtraAccount; use crate::generated::types::ValidationResultsOffset; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Oracle { #[cfg_attr( feature = "serde", diff --git a/clients/rust/src/generated/types/oracle_init_info.rs b/clients/rust/src/generated/types/oracle_init_info.rs index f6b73825..71fb3233 100644 --- a/clients/rust/src/generated/types/oracle_init_info.rs +++ b/clients/rust/src/generated/types/oracle_init_info.rs @@ -10,12 +10,16 @@ use crate::generated::types::ExtraAccount; use crate::generated::types::HookableLifecycleEvent; use crate::generated::types::PluginAuthority; use crate::generated::types::ValidationResultsOffset; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct OracleInitInfo { #[cfg_attr( feature = "serde", diff --git a/clients/rust/src/generated/types/oracle_update_info.rs b/clients/rust/src/generated/types/oracle_update_info.rs index 9813f5a0..a7868ffe 100644 --- a/clients/rust/src/generated/types/oracle_update_info.rs +++ b/clients/rust/src/generated/types/oracle_update_info.rs @@ -9,11 +9,15 @@ use crate::generated::types::ExternalCheckResult; use crate::generated::types::ExtraAccount; use crate::generated::types::HookableLifecycleEvent; use crate::generated::types::ValidationResultsOffset; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct OracleUpdateInfo { pub lifecycle_checks: Option>, pub pda: Option, diff --git a/clients/rust/src/generated/types/oracle_validation.rs b/clients/rust/src/generated/types/oracle_validation.rs index c971c96c..543223ba 100644 --- a/clients/rust/src/generated/types/oracle_validation.rs +++ b/clients/rust/src/generated/types/oracle_validation.rs @@ -6,11 +6,15 @@ //! use crate::generated::types::ExternalValidationResult; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum OracleValidation { V1 { create: ExternalValidationResult, diff --git a/clients/rust/src/generated/types/permanent_burn_delegate.rs b/clients/rust/src/generated/types/permanent_burn_delegate.rs index 93caf612..5bd0f153 100644 --- a/clients/rust/src/generated/types/permanent_burn_delegate.rs +++ b/clients/rust/src/generated/types/permanent_burn_delegate.rs @@ -5,9 +5,13 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct PermanentBurnDelegate {} diff --git a/clients/rust/src/generated/types/permanent_freeze_delegate.rs b/clients/rust/src/generated/types/permanent_freeze_delegate.rs index cba42b08..58d4270d 100644 --- a/clients/rust/src/generated/types/permanent_freeze_delegate.rs +++ b/clients/rust/src/generated/types/permanent_freeze_delegate.rs @@ -5,11 +5,15 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct PermanentFreezeDelegate { pub frozen: bool, } diff --git a/clients/rust/src/generated/types/permanent_transfer_delegate.rs b/clients/rust/src/generated/types/permanent_transfer_delegate.rs index 81dfb376..927e548d 100644 --- a/clients/rust/src/generated/types/permanent_transfer_delegate.rs +++ b/clients/rust/src/generated/types/permanent_transfer_delegate.rs @@ -5,9 +5,13 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct PermanentTransferDelegate {} diff --git a/clients/rust/src/generated/types/plugin.rs b/clients/rust/src/generated/types/plugin.rs index 57a77a63..b6b8db9d 100644 --- a/clients/rust/src/generated/types/plugin.rs +++ b/clients/rust/src/generated/types/plugin.rs @@ -5,10 +5,12 @@ //! [https://github.com/metaplex-foundation/kinobi] //! +use crate::generated::types::AddBlocker; use crate::generated::types::Attributes; use crate::generated::types::BurnDelegate; use crate::generated::types::Edition; use crate::generated::types::FreezeDelegate; +use crate::generated::types::ImmutableMetadata; use crate::generated::types::MasterEdition; use crate::generated::types::PermanentBurnDelegate; use crate::generated::types::PermanentFreezeDelegate; @@ -16,11 +18,15 @@ use crate::generated::types::PermanentTransferDelegate; use crate::generated::types::Royalties; use crate::generated::types::TransferDelegate; use crate::generated::types::UpdateDelegate; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Plugin { Royalties(Royalties), FreezeDelegate(FreezeDelegate), @@ -33,4 +39,6 @@ pub enum Plugin { PermanentBurnDelegate(PermanentBurnDelegate), Edition(Edition), MasterEdition(MasterEdition), + AddBlocker(AddBlocker), + ImmutableMetadata(ImmutableMetadata), } diff --git a/clients/rust/src/generated/types/plugin_authority.rs b/clients/rust/src/generated/types/plugin_authority.rs index 07b06f72..2a771e0a 100644 --- a/clients/rust/src/generated/types/plugin_authority.rs +++ b/clients/rust/src/generated/types/plugin_authority.rs @@ -5,12 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum PluginAuthority { None, Owner, diff --git a/clients/rust/src/generated/types/plugin_authority_pair.rs b/clients/rust/src/generated/types/plugin_authority_pair.rs index 117523a5..77569fa0 100644 --- a/clients/rust/src/generated/types/plugin_authority_pair.rs +++ b/clients/rust/src/generated/types/plugin_authority_pair.rs @@ -7,11 +7,15 @@ use crate::generated::types::Plugin; use crate::generated::types::PluginAuthority; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct PluginAuthorityPair { pub plugin: Plugin, pub authority: Option, diff --git a/clients/rust/src/generated/types/plugin_type.rs b/clients/rust/src/generated/types/plugin_type.rs index d6d4518c..638bf44a 100644 --- a/clients/rust/src/generated/types/plugin_type.rs +++ b/clients/rust/src/generated/types/plugin_type.rs @@ -5,14 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use num_derive::FromPrimitive; -#[derive( - BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, -)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] pub enum PluginType { Royalties, FreezeDelegate, @@ -25,4 +27,6 @@ pub enum PluginType { PermanentBurnDelegate, Edition, MasterEdition, + AddBlocker, + ImmutableMetadata, } diff --git a/clients/rust/src/generated/types/registry_record.rs b/clients/rust/src/generated/types/registry_record.rs index 90ac6658..007c8831 100644 --- a/clients/rust/src/generated/types/registry_record.rs +++ b/clients/rust/src/generated/types/registry_record.rs @@ -7,11 +7,15 @@ use crate::generated::types::PluginAuthority; use crate::generated::types::PluginType; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct RegistryRecord { pub plugin_type: PluginType, pub authority: PluginAuthority, diff --git a/clients/rust/src/generated/types/royalties.rs b/clients/rust/src/generated/types/royalties.rs index d9d04892..4635b556 100644 --- a/clients/rust/src/generated/types/royalties.rs +++ b/clients/rust/src/generated/types/royalties.rs @@ -7,11 +7,15 @@ use crate::generated::types::Creator; use crate::generated::types::RuleSet; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Royalties { pub basis_points: u16, pub creators: Vec, diff --git a/clients/rust/src/generated/types/rule_set.rs b/clients/rust/src/generated/types/rule_set.rs index dbe34b51..584d719a 100644 --- a/clients/rust/src/generated/types/rule_set.rs +++ b/clients/rust/src/generated/types/rule_set.rs @@ -5,12 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum RuleSet { None, #[cfg_attr( diff --git a/clients/rust/src/generated/types/seed.rs b/clients/rust/src/generated/types/seed.rs index 99d6dabd..3234936f 100644 --- a/clients/rust/src/generated/types/seed.rs +++ b/clients/rust/src/generated/types/seed.rs @@ -5,12 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Seed { Collection, Owner, diff --git a/clients/rust/src/generated/types/transfer_delegate.rs b/clients/rust/src/generated/types/transfer_delegate.rs index 89716c84..282bb2da 100644 --- a/clients/rust/src/generated/types/transfer_delegate.rs +++ b/clients/rust/src/generated/types/transfer_delegate.rs @@ -5,9 +5,13 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct TransferDelegate {} diff --git a/clients/rust/src/generated/types/update_authority.rs b/clients/rust/src/generated/types/update_authority.rs index 4ede9d33..97032a2f 100644 --- a/clients/rust/src/generated/types/update_authority.rs +++ b/clients/rust/src/generated/types/update_authority.rs @@ -5,12 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum UpdateAuthority { None, #[cfg_attr( diff --git a/clients/rust/src/generated/types/update_delegate.rs b/clients/rust/src/generated/types/update_delegate.rs index dedcb944..1e19c5d0 100644 --- a/clients/rust/src/generated/types/update_delegate.rs +++ b/clients/rust/src/generated/types/update_delegate.rs @@ -5,12 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct UpdateDelegate { #[cfg_attr( feature = "serde", diff --git a/clients/rust/src/generated/types/validation_result.rs b/clients/rust/src/generated/types/validation_result.rs index 2a4a59d5..fe5f499a 100644 --- a/clients/rust/src/generated/types/validation_result.rs +++ b/clients/rust/src/generated/types/validation_result.rs @@ -5,14 +5,16 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; use num_derive::FromPrimitive; -#[derive( - BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, -)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] pub enum ValidationResult { Approved, Rejected, diff --git a/clients/rust/src/generated/types/validation_results_offset.rs b/clients/rust/src/generated/types/validation_results_offset.rs index 15de75cb..357a3ae7 100644 --- a/clients/rust/src/generated/types/validation_results_offset.rs +++ b/clients/rust/src/generated/types/validation_results_offset.rs @@ -5,11 +5,15 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use borsh::BorshDeserialize; -use borsh::BorshSerialize; +#[cfg(feature = "anchor")] +use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; +#[cfg(not(feature = "anchor"))] +use borsh::{BorshDeserialize, BorshSerialize}; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] +#[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum ValidationResultsOffset { NoOffset, Anchor, diff --git a/clients/rust/src/hooked/advanced_types.rs b/clients/rust/src/hooked/advanced_types.rs index f2e26cc9..5475f9d8 100644 --- a/clients/rust/src/hooked/advanced_types.rs +++ b/clients/rust/src/hooked/advanced_types.rs @@ -5,10 +5,10 @@ use std::{cmp::Ordering, io::ErrorKind}; use crate::{ accounts::{BaseAssetV1, BaseCollectionV1, PluginHeaderV1}, types::{ - Attributes, BurnDelegate, DataStore, Edition, ExternalCheckResult, ExternalPlugin, - ExternalPluginKey, FreezeDelegate, Key, LifecycleHook, MasterEdition, Oracle, - PermanentBurnDelegate, PermanentFreezeDelegate, PermanentTransferDelegate, PluginAuthority, - Royalties, TransferDelegate, UpdateDelegate, + AddBlocker, Attributes, BurnDelegate, DataStore, Edition, ExternalCheckResult, + ExternalPlugin, ExternalPluginKey, FreezeDelegate, ImmutableMetadata, Key, LifecycleHook, + MasterEdition, Oracle, PermanentBurnDelegate, PermanentFreezeDelegate, + PermanentTransferDelegate, PluginAuthority, Royalties, TransferDelegate, UpdateDelegate, }, }; @@ -132,6 +132,18 @@ pub struct MasterEditionPlugin { pub master_edition: MasterEdition, } +#[derive(Debug, Eq, PartialEq, Clone)] +pub struct AddBlockerPlugin { + pub base: BasePlugin, + pub add_blocker: AddBlocker, +} + +#[derive(Debug, Eq, PartialEq, Clone)] +pub struct ImmutableMetadataPlugin { + pub base: BasePlugin, + pub immutable_metadata: ImmutableMetadata, +} + #[derive(Debug, Default)] pub struct PluginsList { pub royalties: Option, @@ -145,6 +157,8 @@ pub struct PluginsList { pub permanent_burn_delegate: Option, pub edition: Option, pub master_edition: Option, + pub add_blocker: Option, + pub immutable_metadata: Option, } #[derive(Debug, Default)] diff --git a/clients/rust/src/hooked/mod.rs b/clients/rust/src/hooked/mod.rs index cc7c9ae8..ecf95a51 100644 --- a/clients/rust/src/hooked/mod.rs +++ b/clients/rust/src/hooked/mod.rs @@ -35,6 +35,8 @@ impl From<&Plugin> for PluginType { Plugin::PermanentBurnDelegate(_) => PluginType::PermanentBurnDelegate, Plugin::Edition(_) => PluginType::Edition, Plugin::MasterEdition(_) => PluginType::MasterEdition, + Plugin::AddBlocker(_) => PluginType::AddBlocker, + Plugin::ImmutableMetadata(_) => PluginType::ImmutableMetadata, } } } diff --git a/clients/rust/src/hooked/plugin.rs b/clients/rust/src/hooked/plugin.rs index c24f3bd5..ef98c6a8 100644 --- a/clients/rust/src/hooked/plugin.rs +++ b/clients/rust/src/hooked/plugin.rs @@ -8,11 +8,12 @@ use crate::{ types::{ ExternalPlugin, ExternalPluginType, Plugin, PluginAuthority, PluginType, RegistryRecord, }, - AttributesPlugin, BaseAuthority, BasePlugin, BurnDelegatePlugin, DataBlob, EditionPlugin, - ExternalPluginsList, ExternalRegistryRecordSafe, FreezeDelegatePlugin, MasterEditionPlugin, - PermanentBurnDelegatePlugin, PermanentFreezeDelegatePlugin, PermanentTransferDelegatePlugin, - PluginRegistryV1Safe, PluginsList, RegistryRecordSafe, RoyaltiesPlugin, SolanaAccount, - TransferDelegatePlugin, UpdateDelegatePlugin, + AddBlockerPlugin, AttributesPlugin, BaseAuthority, BasePlugin, BurnDelegatePlugin, DataBlob, + EditionPlugin, ExternalPluginsList, ExternalRegistryRecordSafe, FreezeDelegatePlugin, + ImmutableMetadataPlugin, MasterEditionPlugin, PermanentBurnDelegatePlugin, + PermanentFreezeDelegatePlugin, PermanentTransferDelegatePlugin, PluginRegistryV1Safe, + PluginsList, RegistryRecordSafe, RoyaltiesPlugin, SolanaAccount, TransferDelegatePlugin, + UpdateDelegatePlugin, }; /// Fetch the plugin from the registry. @@ -193,6 +194,15 @@ pub(crate) fn registry_records_to_plugin_list( master_edition, }) } + Plugin::AddBlocker(add_blocker) => { + acc.add_blocker = Some(AddBlockerPlugin { base, add_blocker }) + } + Plugin::ImmutableMetadata(immutable_metadata) => { + acc.immutable_metadata = Some(ImmutableMetadataPlugin { + base, + immutable_metadata, + }) + } } } Ok(acc) diff --git a/idls/mpl_core.json b/idls/mpl_core.json index 2bad21c5..a9619d18 100644 --- a/idls/mpl_core.json +++ b/idls/mpl_core.json @@ -2081,6 +2081,13 @@ ] } }, + { + "name": "AddBlocker", + "type": { + "kind": "struct", + "fields": [] + } + }, { "name": "Attribute", "type": { @@ -2210,6 +2217,13 @@ ] } }, + { + "name": "ImmutableMetadata", + "type": { + "kind": "struct", + "fields": [] + } + }, { "name": "ExternalCheckResult", "type": { @@ -3407,6 +3421,22 @@ "defined": "MasterEdition" } ] + }, + { + "name": "AddBlocker", + "fields": [ + { + "defined": "AddBlocker" + } + ] + }, + { + "name": "ImmutableMetadata", + "fields": [ + { + "defined": "ImmutableMetadata" + } + ] } ] } @@ -3448,6 +3478,12 @@ }, { "name": "MasterEdition" + }, + { + "name": "AddBlocker" + }, + { + "name": "ImmutableMetadata" } ] } diff --git a/package.json b/package.json index 3bf7441f..ae48530c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "devDependencies": { "@metaplex-foundation/amman": "^0.12.1", - "@metaplex-foundation/kinobi": "^0.18.5", + "@metaplex-foundation/kinobi": "0.18.8-alpha.0", "@metaplex-foundation/shank-js": "^0.1.7", "typescript": "^4.9.4" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d2f6ea82..890ec97b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ devDependencies: specifier: ^0.12.1 version: 0.12.1(typescript@4.9.4) '@metaplex-foundation/kinobi': - specifier: ^0.18.5 - version: 0.18.5(fastestsmallesttextencoderdecoder@1.0.22) + specifier: 0.18.8-alpha.0 + version: 0.18.8-alpha.0(fastestsmallesttextencoderdecoder@1.0.22) '@metaplex-foundation/shank-js': specifier: ^0.1.7 version: 0.1.7 @@ -89,11 +89,11 @@ packages: resolution: {integrity: sha512-S9RulC2fFCFOQraz61bij+5YCHhSO9llJegK8c8Y6731fSi6snUSQJdCUqYS8AIgR0TKbQvdvgSyIIdbDFZbBA==} dev: true - /@metaplex-foundation/kinobi@0.18.5(fastestsmallesttextencoderdecoder@1.0.22): - resolution: {integrity: sha512-qh4h4xGB+PHR5o4rcZki+wsIeZYi6R9SRV5UMqGi/rfDJXk0ckAZ+fxdam+mCc4N8HWLLWmEJbF5gx8E5K0fOA==} + /@metaplex-foundation/kinobi@0.18.8-alpha.0(fastestsmallesttextencoderdecoder@1.0.22): + resolution: {integrity: sha512-0ghdmyGnz1j6yDX52lWJOY63AvkSnxbNSYsHgn1sFnMrnnAK3O3EuaFpZdj5j0C2dRB1a+dGw2Kte7GkuPZL2A==} dependencies: '@noble/hashes': 1.4.0 - '@prettier/sync': 0.5.1(prettier@3.2.5) + '@prettier/sync': 0.5.2(prettier@3.2.5) '@solana/codecs-strings': 2.0.0-preview.1(fastestsmallesttextencoderdecoder@1.0.22) chalk: 4.1.2 json-stable-stringify: 1.1.1 @@ -136,12 +136,12 @@ packages: engines: {node: '>= 16'} dev: true - /@prettier/sync@0.5.1(prettier@3.2.5): - resolution: {integrity: sha512-tpF+A1e4ynO2U4fTH21Sjgm9EYENmqg4zmJCMLrmLVfzIzuDc1cKGXyxrxbFgcH8qQRfowyDCZFAUukwhiZlsw==} + /@prettier/sync@0.5.2(prettier@3.2.5): + resolution: {integrity: sha512-Yb569su456XNx5BsH/Vyem7xD6g/y9iLmLUzRKM1a/dhU/D7HqqvkAG72znulXlMXztbV0iiu9O5AL8K98TzZQ==} peerDependencies: prettier: '*' dependencies: - make-synchronized: 0.2.8 + make-synchronized: 0.2.9 prettier: 3.2.5 dev: true @@ -908,8 +908,8 @@ packages: yallist: 4.0.0 dev: true - /make-synchronized@0.2.8: - resolution: {integrity: sha512-jtXnKYCxjmGaXiZhXbDbGPbh4YyTvIIbOgcQjtAboc4RSm9k3nyhTFvFQB0cfs7QFKuZXKe2D2RvOkv1c+vpxg==} + /make-synchronized@0.2.9: + resolution: {integrity: sha512-4wczOs8SLuEdpEvp3vGo83wh8rjJ78UsIk7DIX5fxdfmfMJGog4bQzxfvOwq7Q3yCHLC4jp1urPHIxRS/A93gA==} dev: true /map-stream@0.1.0: diff --git a/programs/mpl-core/Cargo.toml b/programs/mpl-core/Cargo.toml index d952ef8f..f9e89769 100644 --- a/programs/mpl-core/Cargo.toml +++ b/programs/mpl-core/Cargo.toml @@ -15,10 +15,10 @@ shank = "0.4.2" modular-bitfield = "0.11.2" num-derive = "^0.3" num-traits = "^0.2" -solana-program = "^1.16" +solana-program = "^1.17" thiserror = "^1.0" bytemuck = "1.14.1" -mpl-utils = "0.3.3" +mpl-utils = "0.3.5" spl-noop = { version = "0.2.0", features = ["cpi"] } podded = "0.5.1" strum = { version = "0.26.1", features = ["derive"] } diff --git a/programs/mpl-core/src/plugins/add_blocker.rs b/programs/mpl-core/src/plugins/add_blocker.rs new file mode 100644 index 00000000..813923bd --- /dev/null +++ b/programs/mpl-core/src/plugins/add_blocker.rs @@ -0,0 +1,40 @@ +use borsh::{BorshDeserialize, BorshSerialize}; +use solana_program::program_error::ProgramError; + +use crate::state::{Authority, DataBlob}; + +use super::{PluginType, PluginValidation, PluginValidationContext, ValidationResult}; + +/// The AddBlocker plugin prevents any plugin except for owner-managed plugins from being added. +/// The default authority for this plugin is None. + +#[repr(C)] +#[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq, Default)] +pub struct AddBlocker {} + +impl DataBlob for AddBlocker { + fn get_initial_size() -> usize { + 0 + } + + fn get_size(&self) -> usize { + 0 + } +} + +impl PluginValidation for AddBlocker { + fn validate_add_plugin( + &self, + ctx: &PluginValidationContext, + ) -> Result { + if let Some(plugin) = ctx.target_plugin { + if plugin.manager() == Authority::Owner + || PluginType::from(plugin) == PluginType::AddBlocker + { + return Ok(ValidationResult::Pass); + } + } + + Ok(ValidationResult::Rejected) + } +} diff --git a/programs/mpl-core/src/plugins/immutable_metadata.rs b/programs/mpl-core/src/plugins/immutable_metadata.rs new file mode 100644 index 00000000..fb9d1107 --- /dev/null +++ b/programs/mpl-core/src/plugins/immutable_metadata.rs @@ -0,0 +1,33 @@ +use borsh::{BorshDeserialize, BorshSerialize}; +use solana_program::program_error::ProgramError; + +use crate::state::DataBlob; + +use super::{PluginValidation, PluginValidationContext, ValidationResult}; + +/// The immutable metadata plugin allows its authority to prevent plugin's meta from changing. +/// The default authority for this plugin is None. + +#[repr(C)] +#[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq, Default)] +pub struct ImmutableMetadata {} + +impl DataBlob for ImmutableMetadata { + fn get_initial_size() -> usize { + 0 + } + + fn get_size(&self) -> usize { + 0 + } +} + +impl PluginValidation for ImmutableMetadata { + /// Validate the update lifecycle action. + fn validate_update( + &self, + _ctx: &PluginValidationContext, + ) -> Result { + Ok(ValidationResult::Rejected) + } +} diff --git a/programs/mpl-core/src/plugins/lifecycle.rs b/programs/mpl-core/src/plugins/lifecycle.rs index 02033f7f..0ae06008 100644 --- a/programs/mpl-core/src/plugins/lifecycle.rs +++ b/programs/mpl-core/src/plugins/lifecycle.rs @@ -74,6 +74,7 @@ impl PluginType { /// Check permissions for the add plugin lifecycle event. pub fn check_add_plugin(plugin_type: &PluginType) -> CheckResult { match plugin_type { + PluginType::AddBlocker => CheckResult::CanReject, PluginType::Royalties => CheckResult::CanReject, PluginType::UpdateDelegate => CheckResult::CanApprove, PluginType::PermanentFreezeDelegate => CheckResult::CanReject, @@ -137,6 +138,7 @@ impl PluginType { pub fn check_update(plugin_type: &PluginType) -> CheckResult { #[allow(clippy::match_single_binding)] match plugin_type { + PluginType::ImmutableMetadata => CheckResult::CanReject, PluginType::UpdateDelegate => CheckResult::CanApprove, _ => CheckResult::None, } @@ -230,6 +232,10 @@ impl Plugin { } Plugin::Edition(edition) => edition.validate_add_plugin(ctx), Plugin::MasterEdition(master_edition) => master_edition.validate_add_plugin(ctx), + Plugin::AddBlocker(add_blocker) => add_blocker.validate_add_plugin(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_add_plugin(ctx) + } } } @@ -264,6 +270,10 @@ impl Plugin { } Plugin::Edition(edition) => edition.validate_remove_plugin(ctx), Plugin::MasterEdition(master_edition) => master_edition.validate_remove_plugin(ctx), + Plugin::AddBlocker(add_blocker) => add_blocker.validate_remove_plugin(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_remove_plugin(ctx) + } } } @@ -304,6 +314,10 @@ impl Plugin { Plugin::MasterEdition(master_edition) => { master_edition.validate_approve_plugin_authority(ctx) } + Plugin::AddBlocker(add_blocker) => add_blocker.validate_approve_plugin_authority(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_approve_plugin_authority(ctx) + } } } @@ -343,6 +357,10 @@ impl Plugin { Plugin::MasterEdition(master_edition) => { master_edition.validate_revoke_plugin_authority(ctx) } + Plugin::AddBlocker(add_blocker) => add_blocker.validate_revoke_plugin_authority(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_revoke_plugin_authority(ctx) + } } } @@ -367,6 +385,10 @@ impl Plugin { Plugin::PermanentBurnDelegate(permanent_burn) => permanent_burn.validate_create(ctx), Plugin::Edition(edition) => edition.validate_create(ctx), Plugin::MasterEdition(master_edition) => master_edition.validate_create(ctx), + Plugin::AddBlocker(add_blocker) => add_blocker.validate_create(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_create(ctx) + } } } @@ -391,6 +413,10 @@ impl Plugin { Plugin::PermanentBurnDelegate(permanent_burn) => permanent_burn.validate_update(ctx), Plugin::Edition(edition) => edition.validate_update(ctx), Plugin::MasterEdition(master_edition) => master_edition.validate_update(ctx), + Plugin::AddBlocker(add_blocker) => add_blocker.validate_update(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_update(ctx) + } } } @@ -428,6 +454,10 @@ impl Plugin { } Plugin::Edition(edition) => edition.validate_update_plugin(ctx), Plugin::MasterEdition(master_edition) => master_edition.validate_update_plugin(ctx), + Plugin::AddBlocker(add_blocker) => add_blocker.validate_update_plugin(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_update_plugin(ctx) + } }?; match (&base_result, &result) { @@ -471,6 +501,8 @@ impl Plugin { Plugin::PermanentBurnDelegate(permanent_burn) => permanent_burn.validate_burn(ctx), Plugin::Edition(edition) => edition.validate_burn(ctx), Plugin::MasterEdition(master_edition) => master_edition.validate_burn(ctx), + Plugin::AddBlocker(add_blocker) => add_blocker.validate_burn(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => immutable_metadata.validate_burn(ctx), } } @@ -495,6 +527,10 @@ impl Plugin { Plugin::PermanentBurnDelegate(burn_transfer) => burn_transfer.validate_transfer(ctx), Plugin::Edition(edition) => edition.validate_transfer(ctx), Plugin::MasterEdition(master_edition) => master_edition.validate_transfer(ctx), + Plugin::AddBlocker(add_blocker) => add_blocker.validate_transfer(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_transfer(ctx) + } } } @@ -519,6 +555,10 @@ impl Plugin { Plugin::PermanentBurnDelegate(burn_transfer) => burn_transfer.validate_compress(ctx), Plugin::Edition(edition) => edition.validate_compress(ctx), Plugin::MasterEdition(master_edition) => master_edition.validate_compress(ctx), + Plugin::AddBlocker(add_blocker) => add_blocker.validate_compress(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_compress(ctx) + } } } @@ -545,6 +585,10 @@ impl Plugin { } Plugin::Edition(edition) => edition.validate_decompress(ctx), Plugin::MasterEdition(master_edition) => master_edition.validate_decompress(ctx), + Plugin::AddBlocker(add_blocker) => add_blocker.validate_decompress(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_decompress(ctx) + } } } @@ -575,6 +619,10 @@ impl Plugin { Plugin::MasterEdition(master_edition) => { master_edition.validate_add_external_plugin(ctx) } + Plugin::AddBlocker(add_blocker) => add_blocker.validate_add_external_plugin(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_add_external_plugin(ctx) + } } } @@ -605,6 +653,10 @@ impl Plugin { Plugin::MasterEdition(master_edition) => { master_edition.validate_remove_external_plugin(ctx) } + Plugin::AddBlocker(add_blocker) => add_blocker.validate_remove_external_plugin(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_remove_external_plugin(ctx) + } } } @@ -646,6 +698,10 @@ impl Plugin { Plugin::MasterEdition(master_edition) => { master_edition.validate_update_external_plugin(ctx) } + Plugin::AddBlocker(add_blocker) => add_blocker.validate_update_external_plugin(ctx), + Plugin::ImmutableMetadata(immutable_metadata) => { + immutable_metadata.validate_update_external_plugin(ctx) + } }?; match (&base_result, &result) { diff --git a/programs/mpl-core/src/plugins/mod.rs b/programs/mpl-core/src/plugins/mod.rs index d09156ce..fedd2caa 100644 --- a/programs/mpl-core/src/plugins/mod.rs +++ b/programs/mpl-core/src/plugins/mod.rs @@ -1,9 +1,11 @@ +mod add_blocker; mod attributes; mod burn_delegate; mod data_store; mod edition; mod external_plugins; mod freeze_delegate; +mod immutable_metadata; mod lifecycle; mod lifecycle_hook; @@ -21,12 +23,14 @@ mod transfer; mod update_delegate; mod utils; +pub use add_blocker::*; pub use attributes::*; pub use burn_delegate::*; pub use data_store::*; pub use edition::*; pub use external_plugins::*; pub use freeze_delegate::*; +pub use immutable_metadata::*; pub use lifecycle::*; pub use lifecycle_hook::*; pub use master_edition::*; @@ -79,6 +83,10 @@ pub enum Plugin { Edition(Edition), /// Master Edition plugin allows creators to specify the max supply and master edition details MasterEdition(MasterEdition), + /// AddBlocker plugin. Prevents plugins from being added. + AddBlocker(AddBlocker), + /// ImmutableMetadata plugin. Makes metadata of the asset immutable. + ImmutableMetadata(ImmutableMetadata), } impl Plugin { @@ -145,6 +153,10 @@ pub enum PluginType { Edition, /// The Master Edition plugin. MasterEdition, + /// AddBlocker plugin. + AddBlocker, + /// ImmutableMetadata plugin. + ImmutableMetadata, } impl DataBlob for PluginType { @@ -160,6 +172,8 @@ impl DataBlob for PluginType { impl From<&Plugin> for PluginType { fn from(plugin: &Plugin) -> Self { match plugin { + Plugin::AddBlocker(_) => PluginType::AddBlocker, + Plugin::ImmutableMetadata(_) => PluginType::ImmutableMetadata, Plugin::Royalties(_) => PluginType::Royalties, Plugin::FreezeDelegate(_) => PluginType::FreezeDelegate, Plugin::BurnDelegate(_) => PluginType::BurnDelegate, @@ -179,6 +193,8 @@ impl PluginType { /// Get the default authority for a plugin which defines who must allow the plugin to be created. pub fn manager(&self) -> Authority { match self { + PluginType::AddBlocker => Authority::UpdateAuthority, + PluginType::ImmutableMetadata => Authority::UpdateAuthority, PluginType::Royalties => Authority::UpdateAuthority, PluginType::FreezeDelegate => Authority::Owner, PluginType::BurnDelegate => Authority::Owner, diff --git a/programs/mpl-core/src/processor/update.rs b/programs/mpl-core/src/processor/update.rs index a3facc58..bda8ca6f 100644 --- a/programs/mpl-core/src/processor/update.rs +++ b/programs/mpl-core/src/processor/update.rs @@ -9,7 +9,7 @@ use crate::{ instruction::accounts::{UpdateCollectionV1Accounts, UpdateV1Accounts}, plugins::{ ExternalPlugin, HookableLifecycleEvent, Plugin, PluginHeaderV1, PluginRegistryV1, - PluginType, RegistryRecord, + PluginType, }, state::{AssetV1, CollectionV1, DataBlob, Key, SolanaAccount, UpdateAuthority}, utils::{ @@ -236,20 +236,24 @@ fn process_update<'a, T: DataBlob + SolanaAccount>( ); plugin_header.save(account, new_core_size as usize)?; - plugin_registry.registry = plugin_registry - .registry - .iter_mut() - .map(|record| { - let new_offset = (record.offset as isize) - .checked_add(size_diff) - .ok_or(MplCoreError::NumericalOverflow)?; - Ok(RegistryRecord { - plugin_type: record.plugin_type, - offset: new_offset as usize, - authority: record.authority, - }) - }) - .collect::, MplCoreError>>()?; + + // Move offsets for existing registry records. + for record in &mut plugin_registry.external_registry { + let new_offset = (record.offset as isize) + .checked_add(size_diff) + .ok_or(MplCoreError::NumericalOverflow)?; + + record.offset = new_offset as usize; + } + + for record in &mut plugin_registry.registry { + let new_offset = (record.offset as isize) + .checked_add(size_diff) + .ok_or(MplCoreError::NumericalOverflow)?; + + record.offset = new_offset as usize; + } + plugin_registry.save(account, new_registry_offset as usize)?; } else { resize_or_reallocate_account(account, payer, system_program, core.get_size())?; diff --git a/programs/mpl-core/src/processor/update_external_plugin.rs b/programs/mpl-core/src/processor/update_external_plugin.rs index e100b1b3..f5eaf667 100644 --- a/programs/mpl-core/src/processor/update_external_plugin.rs +++ b/programs/mpl-core/src/processor/update_external_plugin.rs @@ -10,8 +10,8 @@ use crate::{ UpdateCollectionExternalPluginV1Accounts, UpdateExternalPluginV1Accounts, }, plugins::{ - fetch_wrapped_external_plugin, find_external_plugin, ExternalPluginKey, - ExternalPluginUpdateInfo, Plugin, PluginType, + fetch_wrapped_external_plugin, find_external_plugin, ExternalPlugin, ExternalPluginKey, + ExternalPluginUpdateInfo, Plugin, PluginHeaderV1, PluginRegistryV1, PluginType, }, state::{AssetV1, CollectionV1, DataBlob, Key, SolanaAccount}, utils::{ @@ -76,92 +76,20 @@ pub(crate) fn update_external_plugin<'a>( None, )?; - let mut plugin_registry = plugin_registry.ok_or(MplCoreError::PluginsNotInitialized)?; - let mut plugin_header = plugin_header.ok_or(MplCoreError::PluginsNotInitialized)?; - - let plugin_registry_clone = plugin_registry.clone(); - let (_, record) = find_external_plugin(&plugin_registry_clone, &args.key, ctx.accounts.asset)?; - let mut registry_record = record.ok_or(MplCoreError::PluginNotFound)?.clone(); - registry_record.update(&args.update_info)?; - - let mut new_plugin = plugin.clone(); - new_plugin.update(&args.update_info); - - let plugin_data = plugin.try_to_vec()?; - let new_plugin_data = new_plugin.try_to_vec()?; - - // The difference in size between the new and old account which is used to calculate the new size of the account. - let plugin_size = plugin_data.len() as isize; - let size_diff = (new_plugin_data.len() as isize) - .checked_sub(plugin_size) - .ok_or(MplCoreError::NumericalOverflow)?; - - // The new size of the account. - let new_size = (ctx.accounts.asset.data_len() as isize) - .checked_add(size_diff) - .ok_or(MplCoreError::NumericalOverflow)?; - - // The new offset of the plugin registry is the old offset plus the size difference. - let registry_offset = plugin_header.plugin_registry_offset; - let new_registry_offset = (registry_offset as isize) - .checked_add(size_diff) - .ok_or(MplCoreError::NumericalOverflow)?; - plugin_header.plugin_registry_offset = new_registry_offset as usize; - - // The offset of the first plugin is the plugin offset plus the size of the plugin. - let next_plugin_offset = (registry_record.offset as isize) - .checked_add(plugin_size) - .ok_or(MplCoreError::NumericalOverflow)?; - - let new_next_plugin_offset = next_plugin_offset - .checked_add(size_diff) - .ok_or(MplCoreError::NumericalOverflow)?; - - // //TODO: This is memory intensive, we should use memmove instead probably. - let src = - ctx.accounts.asset.data.borrow()[(next_plugin_offset as usize)..registry_offset].to_vec(); + // Increment sequence number and save only if it is `Some(_)`. + asset.increment_seq_and_save(ctx.accounts.asset)?; - resize_or_reallocate_account( + process_update_external_plugin( + asset, + plugin, + args.key, + args.update_info, + plugin_header, + plugin_registry, ctx.accounts.asset, ctx.accounts.payer, ctx.accounts.system_program, - new_size as usize, - )?; - - sol_memcpy( - &mut ctx.accounts.asset.data.borrow_mut()[(new_next_plugin_offset as usize)..], - &src, - src.len(), - ); - - plugin_header.save(ctx.accounts.asset, asset.get_size())?; - - // Move offsets for existing registry records. - for record in &mut plugin_registry.external_registry { - if registry_record.offset < record.offset { - record - .offset - .checked_add(size_diff as usize) - .ok_or(MplCoreError::NumericalOverflow)?; - } - } - - for record in &mut plugin_registry.registry { - if registry_record.offset < record.offset { - record - .offset - .checked_add(size_diff as usize) - .ok_or(MplCoreError::NumericalOverflow)?; - } - } - - plugin_registry.save(ctx.accounts.asset, new_registry_offset as usize)?; - new_plugin.save(ctx.accounts.asset, registry_record.offset)?; - - // Increment sequence number and save only if it is `Some(_)`. - asset.increment_seq_and_save(ctx.accounts.asset)?; - - process_update_external_plugin() + ) } #[repr(C)] @@ -212,17 +140,41 @@ pub(crate) fn update_collection_external_plugin<'a>( None, )?; + process_update_external_plugin( + collection, + plugin, + args.key, + args.update_info, + plugin_header, + plugin_registry, + ctx.accounts.collection, + ctx.accounts.payer, + ctx.accounts.system_program, + ) +} + +#[allow(clippy::too_many_arguments)] +fn process_update_external_plugin<'a, T: DataBlob + SolanaAccount>( + core: T, + plugin: ExternalPlugin, + key: ExternalPluginKey, + update_info: ExternalPluginUpdateInfo, + plugin_header: Option, + plugin_registry: Option, + account: &AccountInfo<'a>, + payer: &AccountInfo<'a>, + system_program: &AccountInfo<'a>, +) -> ProgramResult { let mut plugin_registry = plugin_registry.ok_or(MplCoreError::PluginsNotInitialized)?; let mut plugin_header = plugin_header.ok_or(MplCoreError::PluginsNotInitialized)?; let plugin_registry_clone = plugin_registry.clone(); - let (_, record) = - find_external_plugin(&plugin_registry_clone, &args.key, ctx.accounts.collection)?; + let (_, record) = find_external_plugin(&plugin_registry_clone, &key, account)?; let mut registry_record = record.ok_or(MplCoreError::PluginNotFound)?.clone(); - registry_record.update(&args.update_info)?; + registry_record.update(&update_info)?; let mut new_plugin = plugin.clone(); - new_plugin.update(&args.update_info); + new_plugin.update(&update_info); let plugin_data = plugin.try_to_vec()?; let new_plugin_data = new_plugin.try_to_vec()?; @@ -234,7 +186,7 @@ pub(crate) fn update_collection_external_plugin<'a>( .ok_or(MplCoreError::NumericalOverflow)?; // The new size of the account. - let new_size = (ctx.accounts.collection.data_len() as isize) + let new_size = (account.data_len() as isize) .checked_add(size_diff) .ok_or(MplCoreError::NumericalOverflow)?; @@ -255,50 +207,41 @@ pub(crate) fn update_collection_external_plugin<'a>( .ok_or(MplCoreError::NumericalOverflow)?; // //TODO: This is memory intensive, we should use memmove instead probably. - let src = ctx.accounts.collection.data.borrow()[(next_plugin_offset as usize)..registry_offset] - .to_vec(); + let src = account.data.borrow()[(next_plugin_offset as usize)..registry_offset].to_vec(); - resize_or_reallocate_account( - ctx.accounts.collection, - ctx.accounts.payer, - ctx.accounts.system_program, - new_size as usize, - )?; + resize_or_reallocate_account(account, payer, system_program, new_size as usize)?; sol_memcpy( - &mut ctx.accounts.collection.data.borrow_mut()[(new_next_plugin_offset as usize)..], + &mut account.data.borrow_mut()[(new_next_plugin_offset as usize)..], &src, src.len(), ); - plugin_header.save(ctx.accounts.collection, collection.get_size())?; + plugin_header.save(account, core.get_size())?; // Move offsets for existing registry records. for record in &mut plugin_registry.external_registry { if registry_record.offset < record.offset { - record - .offset - .checked_add(size_diff as usize) + let new_offset = (record.offset as isize) + .checked_add(size_diff) .ok_or(MplCoreError::NumericalOverflow)?; + + record.offset = new_offset as usize; } } for record in &mut plugin_registry.registry { if registry_record.offset < record.offset { - record - .offset - .checked_add(size_diff as usize) + let new_offset = (record.offset as isize) + .checked_add(size_diff) .ok_or(MplCoreError::NumericalOverflow)?; + + record.offset = new_offset as usize; } } - plugin_registry.save(ctx.accounts.collection, new_registry_offset as usize)?; - new_plugin.save(ctx.accounts.collection, registry_record.offset)?; - - process_update_external_plugin() -} + plugin_registry.save(account, new_registry_offset as usize)?; + new_plugin.save(account, registry_record.offset)?; -//TODO -fn process_update_external_plugin() -> ProgramResult { Ok(()) } diff --git a/programs/mpl-core/src/processor/update_plugin.rs b/programs/mpl-core/src/processor/update_plugin.rs index cc1d39d5..b1ed0114 100644 --- a/programs/mpl-core/src/processor/update_plugin.rs +++ b/programs/mpl-core/src/processor/update_plugin.rs @@ -7,7 +7,7 @@ use solana_program::{ use crate::{ error::MplCoreError, instruction::accounts::{UpdateCollectionPluginV1Accounts, UpdatePluginV1Accounts}, - plugins::{Plugin, PluginType, RegistryRecord}, + plugins::{Plugin, PluginHeaderV1, PluginRegistryV1, PluginType}, state::{AssetV1, CollectionV1, DataBlob, Key, SolanaAccount}, utils::{ load_key, resize_or_reallocate_account, resolve_authority, validate_asset_permissions, @@ -65,93 +65,18 @@ pub(crate) fn update_plugin<'a>( None, )?; - let mut plugin_registry = plugin_registry.ok_or(MplCoreError::PluginsNotInitialized)?; - let mut plugin_header = plugin_header.ok_or(MplCoreError::PluginsNotInitialized)?; - - let plugin_registry_clone = plugin_registry.clone(); - let plugin_type: PluginType = (&args.plugin).into(); - let registry_record = plugin_registry_clone - .registry - .iter() - .find(|record| record.plugin_type == plugin_type) - .ok_or(MplCoreError::PluginNotFound)?; - - let plugin = Plugin::load(ctx.accounts.asset, registry_record.offset)?; - let plugin_data = plugin.try_to_vec()?; - let new_plugin_data = args.plugin.try_to_vec()?; - - // The difference in size between the new and old account which is used to calculate the new size of the account. - let plugin_size = plugin_data.len() as isize; - let size_diff = (new_plugin_data.len() as isize) - .checked_sub(plugin_size) - .ok_or(MplCoreError::NumericalOverflow)?; - - // The new size of the account. - let new_size = (ctx.accounts.asset.data_len() as isize) - .checked_add(size_diff) - .ok_or(MplCoreError::NumericalOverflow)?; - - // The new offset of the plugin registry is the old offset plus the size difference. - let registry_offset = plugin_header.plugin_registry_offset; - let new_registry_offset = (registry_offset as isize) - .checked_add(size_diff) - .ok_or(MplCoreError::NumericalOverflow)?; - plugin_header.plugin_registry_offset = new_registry_offset as usize; - - // The offset of the first plugin is the plugin offset plus the size of the plugin. - let next_plugin_offset = (registry_record.offset as isize) - .checked_add(plugin_size) - .ok_or(MplCoreError::NumericalOverflow)?; - - let new_next_plugin_offset = next_plugin_offset - .checked_add(size_diff) - .ok_or(MplCoreError::NumericalOverflow)?; - - // //TODO: This is memory intensive, we should use memmove instead probably. - let src = - ctx.accounts.asset.data.borrow()[(next_plugin_offset as usize)..registry_offset].to_vec(); + // Increment sequence number and save only if it is `Some(_)`. + asset.increment_seq_and_save(ctx.accounts.asset)?; - resize_or_reallocate_account( + process_update_plugin( + asset, + args.plugin, + plugin_header, + plugin_registry, ctx.accounts.asset, ctx.accounts.payer, ctx.accounts.system_program, - new_size as usize, - )?; - - sol_memcpy( - &mut ctx.accounts.asset.data.borrow_mut()[(new_next_plugin_offset as usize)..], - &src, - src.len(), - ); - - plugin_header.save(ctx.accounts.asset, asset.get_size())?; - plugin_registry.registry = plugin_registry - .registry - .clone() - .iter_mut() - .map(|record| { - let new_offset = if record.offset > registry_record.offset { - (record.offset as isize) - .checked_add(size_diff) - .ok_or(MplCoreError::NumericalOverflow)? - } else { - record.offset as isize - }; - Ok(RegistryRecord { - plugin_type: record.plugin_type, - offset: new_offset as usize, - authority: record.authority, - }) - }) - .collect::, MplCoreError>>()?; - plugin_registry.save(ctx.accounts.asset, new_registry_offset as usize)?; - args.plugin - .save(ctx.accounts.asset, registry_record.offset)?; - - // Increment sequence number and save only if it is `Some(_)`. - asset.increment_seq_and_save(ctx.accounts.asset)?; - - process_update_plugin() + ) } #[repr(C)] @@ -196,22 +121,40 @@ pub(crate) fn update_collection_plugin<'a>( None, )?; - // let (collection, plugin_header, plugin_registry) = - // fetch_core_data::(ctx.accounts.collection)?; + process_update_plugin( + collection, + args.plugin, + plugin_header, + plugin_registry, + ctx.accounts.collection, + ctx.accounts.payer, + ctx.accounts.system_program, + ) +} + +fn process_update_plugin<'a, T: DataBlob + SolanaAccount>( + core: T, + new_plugin: Plugin, + plugin_header: Option, + plugin_registry: Option, + account: &AccountInfo<'a>, + payer: &AccountInfo<'a>, + system_program: &AccountInfo<'a>, +) -> ProgramResult { let mut plugin_registry = plugin_registry.ok_or(MplCoreError::PluginsNotInitialized)?; let mut plugin_header = plugin_header.ok_or(MplCoreError::PluginsNotInitialized)?; let plugin_registry_clone = plugin_registry.clone(); - let plugin_type: PluginType = (&args.plugin).into(); + let plugin_type: PluginType = (&new_plugin).into(); let registry_record = plugin_registry_clone .registry .iter() .find(|record| record.plugin_type == plugin_type) .ok_or(MplCoreError::PluginNotFound)?; - let plugin = Plugin::load(ctx.accounts.collection, registry_record.offset)?; + let plugin = Plugin::load(account, registry_record.offset)?; let plugin_data = plugin.try_to_vec()?; - let new_plugin_data = args.plugin.try_to_vec()?; + let new_plugin_data = new_plugin.try_to_vec()?; // The difference in size between the new and old account which is used to calculate the new size of the account. let plugin_size = plugin_data.len() as isize; @@ -220,7 +163,7 @@ pub(crate) fn update_collection_plugin<'a>( .ok_or(MplCoreError::NumericalOverflow)?; // The new size of the account. - let new_size = (ctx.accounts.collection.data_len() as isize) + let new_size = (account.data_len() as isize) .checked_add(size_diff) .ok_or(MplCoreError::NumericalOverflow)?; @@ -241,50 +184,41 @@ pub(crate) fn update_collection_plugin<'a>( .ok_or(MplCoreError::NumericalOverflow)?; // //TODO: This is memory intensive, we should use memmove instead probably. - let src = ctx.accounts.collection.data.borrow()[(next_plugin_offset as usize)..registry_offset] - .to_vec(); + let src = account.data.borrow()[(next_plugin_offset as usize)..registry_offset].to_vec(); - resize_or_reallocate_account( - ctx.accounts.collection, - ctx.accounts.payer, - ctx.accounts.system_program, - new_size as usize, - )?; + resize_or_reallocate_account(account, payer, system_program, new_size as usize)?; sol_memcpy( - &mut ctx.accounts.collection.data.borrow_mut()[(new_next_plugin_offset as usize)..], + &mut account.data.borrow_mut()[(new_next_plugin_offset as usize)..], &src, src.len(), ); - plugin_header.save(ctx.accounts.collection, collection.get_size())?; - plugin_registry.registry = plugin_registry - .registry - .clone() - .iter_mut() - .map(|record| { - let new_offset = if record.offset > registry_record.offset { - (record.offset as isize) - .checked_add(size_diff) - .ok_or(MplCoreError::NumericalOverflow)? - } else { - record.offset as isize - }; - Ok(RegistryRecord { - plugin_type: record.plugin_type, - offset: new_offset as usize, - authority: record.authority, - }) - }) - .collect::, MplCoreError>>()?; - plugin_registry.save(ctx.accounts.collection, new_registry_offset as usize)?; - args.plugin - .save(ctx.accounts.collection, registry_record.offset)?; - - process_update_plugin() -} + plugin_header.save(account, core.get_size())?; + + // Move offsets for existing registry records. + for record in &mut plugin_registry.external_registry { + if registry_record.offset < record.offset { + let new_offset = (record.offset as isize) + .checked_add(size_diff) + .ok_or(MplCoreError::NumericalOverflow)?; + + record.offset = new_offset as usize; + } + } + + for record in &mut plugin_registry.registry { + if registry_record.offset < record.offset { + let new_offset = (record.offset as isize) + .checked_add(size_diff) + .ok_or(MplCoreError::NumericalOverflow)?; + + record.offset = new_offset as usize; + } + } + + plugin_registry.save(account, new_registry_offset as usize)?; + new_plugin.save(account, registry_record.offset)?; -//TODO -fn process_update_plugin() -> ProgramResult { Ok(()) }