├── .github ├── .env ├── file-filters.yml └── workflows │ ├── benchmark-summary.yml │ ├── benchmark.yml │ ├── build-programs.yml │ ├── build-rust-client.yml │ ├── create-release.yml │ ├── deploy-program.yml │ ├── main.yml │ ├── publish-js-client.yml │ ├── publish-rust-client.yml │ ├── test-js-client.yml │ ├── test-programs.yml │ └── test-rust-client.yml ├── .gitignore ├── .husky └── pre-commit ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── clients ├── js │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc.json │ ├── CONTRIBUTING.md │ ├── README.md │ ├── bench │ │ ├── _setup.ts │ │ ├── create.ts │ │ ├── marketplace.ts │ │ └── transfer.ts │ ├── package.json │ ├── pnpm-lock.yaml │ ├── src │ │ ├── authority.ts │ │ ├── demo.ts │ │ ├── generated │ │ │ ├── accounts │ │ │ │ ├── assetSigner.ts │ │ │ │ ├── assetV1.ts │ │ │ │ ├── collectionV1.ts │ │ │ │ ├── hashedAssetV1.ts │ │ │ │ ├── index.ts │ │ │ │ ├── pluginHeaderV1.ts │ │ │ │ └── pluginRegistryV1.ts │ │ │ ├── errors │ │ │ │ ├── index.ts │ │ │ │ └── mplCore.ts │ │ │ ├── index.ts │ │ │ ├── instructions │ │ │ │ ├── addCollectionExternalPluginAdapterV1.ts │ │ │ │ ├── addCollectionPluginV1.ts │ │ │ │ ├── addExternalPluginAdapterV1.ts │ │ │ │ ├── addPluginV1.ts │ │ │ │ ├── approveCollectionPluginAuthorityV1.ts │ │ │ │ ├── approvePluginAuthorityV1.ts │ │ │ │ ├── burnCollectionV1.ts │ │ │ │ ├── burnV1.ts │ │ │ │ ├── collect.ts │ │ │ │ ├── compressV1.ts │ │ │ │ ├── createCollectionV1.ts │ │ │ │ ├── createCollectionV2.ts │ │ │ │ ├── createV1.ts │ │ │ │ ├── createV2.ts │ │ │ │ ├── decompressV1.ts │ │ │ │ ├── executeV1.ts │ │ │ │ ├── index.ts │ │ │ │ ├── removeCollectionExternalPluginAdapterV1.ts │ │ │ │ ├── removeCollectionPluginV1.ts │ │ │ │ ├── removeExternalPluginAdapterV1.ts │ │ │ │ ├── removePluginV1.ts │ │ │ │ ├── revokeCollectionPluginAuthorityV1.ts │ │ │ │ ├── revokePluginAuthorityV1.ts │ │ │ │ ├── transferV1.ts │ │ │ │ ├── updateCollectionExternalPluginAdapterV1.ts │ │ │ │ ├── updateCollectionInfoV1.ts │ │ │ │ ├── updateCollectionPluginV1.ts │ │ │ │ ├── updateCollectionV1.ts │ │ │ │ ├── updateExternalPluginAdapterV1.ts │ │ │ │ ├── updatePluginV1.ts │ │ │ │ ├── updateV1.ts │ │ │ │ ├── updateV2.ts │ │ │ │ ├── writeCollectionExternalPluginAdapterDataV1.ts │ │ │ │ └── writeExternalPluginAdapterDataV1.ts │ │ │ ├── programs │ │ │ │ ├── index.ts │ │ │ │ └── mplCore.ts │ │ │ ├── shared │ │ │ │ └── index.ts │ │ │ └── types │ │ │ │ ├── addBlocker.ts │ │ │ │ ├── assetV1AccountData.ts │ │ │ │ ├── attribute.ts │ │ │ │ ├── attributes.ts │ │ │ │ ├── autograph.ts │ │ │ │ ├── autographSignature.ts │ │ │ │ ├── baseAppData.ts │ │ │ │ ├── baseAppDataInitInfo.ts │ │ │ │ ├── baseAppDataUpdateInfo.ts │ │ │ │ ├── baseDataSection.ts │ │ │ │ ├── baseDataSectionInitInfo.ts │ │ │ │ ├── baseDataSectionUpdateInfo.ts │ │ │ │ ├── baseExternalPluginAdapterInitInfo.ts │ │ │ │ ├── baseExternalPluginAdapterKey.ts │ │ │ │ ├── baseExternalPluginAdapterUpdateInfo.ts │ │ │ │ ├── baseExtraAccount.ts │ │ │ │ ├── baseLifecycleHook.ts │ │ │ │ ├── baseLifecycleHookInitInfo.ts │ │ │ │ ├── baseLifecycleHookUpdateInfo.ts │ │ │ │ ├── baseLinkedAppData.ts │ │ │ │ ├── baseLinkedAppDataInitInfo.ts │ │ │ │ ├── baseLinkedAppDataUpdateInfo.ts │ │ │ │ ├── baseLinkedDataKey.ts │ │ │ │ ├── baseLinkedLifecycleHook.ts │ │ │ │ ├── baseLinkedLifecycleHookInitInfo.ts │ │ │ │ ├── baseLinkedLifecycleHookUpdateInfo.ts │ │ │ │ ├── baseMasterEdition.ts │ │ │ │ ├── baseOracle.ts │ │ │ │ ├── baseOracleInitInfo.ts │ │ │ │ ├── baseOracleUpdateInfo.ts │ │ │ │ ├── basePluginAuthority.ts │ │ │ │ ├── baseRoyalties.ts │ │ │ │ ├── baseRuleSet.ts │ │ │ │ ├── baseSeed.ts │ │ │ │ ├── baseUpdateAuthority.ts │ │ │ │ ├── baseValidationResultsOffset.ts │ │ │ │ ├── bubblegumV2.ts │ │ │ │ ├── burnDelegate.ts │ │ │ │ ├── collectionV1AccountData.ts │ │ │ │ ├── compressionProof.ts │ │ │ │ ├── creator.ts │ │ │ │ ├── dataState.ts │ │ │ │ ├── edition.ts │ │ │ │ ├── externalCheckResult.ts │ │ │ │ ├── externalPluginAdapter.ts │ │ │ │ ├── externalPluginAdapterSchema.ts │ │ │ │ ├── externalPluginAdapterType.ts │ │ │ │ ├── externalRegistryRecord.ts │ │ │ │ ├── externalValidationResult.ts │ │ │ │ ├── freezeDelegate.ts │ │ │ │ ├── hashablePluginSchema.ts │ │ │ │ ├── hashedAssetSchema.ts │ │ │ │ ├── hookableLifecycleEvent.ts │ │ │ │ ├── immutableMetadata.ts │ │ │ │ ├── index.ts │ │ │ │ ├── key.ts │ │ │ │ ├── oracleValidation.ts │ │ │ │ ├── permanentBurnDelegate.ts │ │ │ │ ├── permanentFreezeDelegate.ts │ │ │ │ ├── permanentTransferDelegate.ts │ │ │ │ ├── plugin.ts │ │ │ │ ├── pluginAuthorityPair.ts │ │ │ │ ├── pluginRegistryV1AccountData.ts │ │ │ │ ├── pluginType.ts │ │ │ │ ├── registryRecord.ts │ │ │ │ ├── transferDelegate.ts │ │ │ │ ├── updateDelegate.ts │ │ │ │ ├── updateType.ts │ │ │ │ ├── validationResult.ts │ │ │ │ ├── verifiedCreators.ts │ │ │ │ └── verifiedCreatorsSignature.ts │ │ ├── hash.ts │ │ ├── helpers │ │ │ ├── authority.ts │ │ │ ├── fetch.ts │ │ │ ├── index.ts │ │ │ ├── lifecycle.ts │ │ │ ├── plugin.ts │ │ │ └── state.ts │ │ ├── hooked │ │ │ ├── assetAccountData.ts │ │ │ ├── collectionAccountData.ts │ │ │ ├── index.ts │ │ │ └── pluginRegistryV1Data.ts │ │ ├── index.ts │ │ ├── instructions │ │ │ ├── addPlugin.ts │ │ │ ├── approvePluginAuthority.ts │ │ │ ├── burn.ts │ │ │ ├── collection │ │ │ │ ├── addCollectionPlugin.ts │ │ │ │ ├── approveCollectionPluginAuthority.ts │ │ │ │ ├── burnCollection.ts │ │ │ │ ├── createCollection.ts │ │ │ │ ├── index.ts │ │ │ │ ├── removeCollectionPlugin.ts │ │ │ │ ├── revokeCollectionPluginAuthority.ts │ │ │ │ ├── updateCollection.ts │ │ │ │ └── updateCollectionPlugin.ts │ │ │ ├── create.ts │ │ │ ├── errors.ts │ │ │ ├── execute.ts │ │ │ ├── freeze.ts │ │ │ ├── index.ts │ │ │ ├── legacyDelegate.ts │ │ │ ├── legacyRevoke.ts │ │ │ ├── removePlugin.ts │ │ │ ├── revokePluginAuthority.ts │ │ │ ├── transfer.ts │ │ │ ├── update.ts │ │ │ ├── updatePlugin.ts │ │ │ └── writeData.ts │ │ ├── plugin.ts │ │ ├── plugins │ │ │ ├── appData.ts │ │ │ ├── dataSection.ts │ │ │ ├── externalPluginAdapterKey.ts │ │ │ ├── externalPluginAdapterManifest.ts │ │ │ ├── externalPluginAdapters.ts │ │ │ ├── extraAccount.ts │ │ │ ├── index.ts │ │ │ ├── lib.ts │ │ │ ├── lifecycleChecks.ts │ │ │ ├── lifecycleHook.ts │ │ │ ├── linkedAppData.ts │ │ │ ├── linkedDataKey.ts │ │ │ ├── linkedLifecycleHook.ts │ │ │ ├── masterEdition.ts │ │ │ ├── oracle.ts │ │ │ ├── pluginAuthority.ts │ │ │ ├── royalties.ts │ │ │ ├── seed.ts │ │ │ ├── types.ts │ │ │ ├── updateAuthority.ts │ │ │ └── validationResultsOffset.ts │ │ └── utils.ts │ ├── test │ │ ├── _setupRaw.ts │ │ ├── _setupSdk.ts │ │ ├── addPlugin.test.ts │ │ ├── approveAuthority.test.ts │ │ ├── asset.test.ts │ │ ├── burn.test.ts │ │ ├── burnCollection.test.ts │ │ ├── collect.test.ts │ │ ├── collection.test.ts │ │ ├── collectionSize.test.ts │ │ ├── compress.test.ts │ │ ├── create.test.ts │ │ ├── createCollection.test.ts │ │ ├── decompress.test.ts │ │ ├── execute.test.ts │ │ ├── externalPlugins │ │ │ ├── appData.test.ts │ │ │ ├── dataSection.test.ts │ │ │ ├── lifecycleHook.test.ts │ │ │ ├── linkedAppData.test.ts │ │ │ └── oracle.test.ts │ │ ├── getProgram.test.ts │ │ ├── helps │ │ │ ├── authority.test.ts │ │ │ ├── fetch.test.ts │ │ │ ├── lifecycle.test.ts │ │ │ ├── plugin.test.ts │ │ │ └── state.test.ts │ │ ├── info.test.ts │ │ ├── instructions │ │ │ ├── freeze.test.ts │ │ │ ├── legacyDelegate.test.ts │ │ │ └── legacyRevoke.test.ts │ │ ├── plugins │ │ │ ├── asset │ │ │ │ ├── addBlocker.test.ts │ │ │ │ ├── attributes.test.ts │ │ │ │ ├── autograph.test.ts │ │ │ │ ├── bubblegumV2.test.ts │ │ │ │ ├── burnDelegate.test.ts │ │ │ │ ├── delegate.test.ts │ │ │ │ ├── delegateTransfer.test.ts │ │ │ │ ├── edition.test.ts │ │ │ │ ├── freeze.test.ts │ │ │ │ ├── immutableMetadata.test.ts │ │ │ │ ├── permanentBurn.test.ts │ │ │ │ ├── permanentFreeze.test.ts │ │ │ │ ├── permanentTransfer.test.ts │ │ │ │ ├── royalties.test.ts │ │ │ │ ├── updateDelegate.test.ts │ │ │ │ └── verifiedCreators.test.ts │ │ │ └── collection │ │ │ │ ├── addBlocker.test.ts │ │ │ │ ├── bubblegumV2.test.ts │ │ │ │ ├── immutableMetadata.test.ts │ │ │ │ ├── masterEdition.test.ts │ │ │ │ ├── permanentBurn.test.ts │ │ │ │ ├── permanentFreeze.test.ts │ │ │ │ ├── permanentTransfer.test.ts │ │ │ │ └── updateDelegate.test.ts │ │ ├── removePlugin.test.ts │ │ ├── revokeAuthority.test.ts │ │ ├── sdkv1.test.ts │ │ ├── signers │ │ │ ├── burn.test.ts │ │ │ ├── create.test.ts │ │ │ ├── createCollection.test.ts │ │ │ ├── transfer.test.ts │ │ │ └── update.test.ts │ │ ├── transfer.test.ts │ │ ├── update.test.ts │ │ ├── updatePlugin.test.ts │ │ └── updateV2.test.ts │ ├── tsconfig.json │ └── typedoc.json └── rust │ ├── CONTRIBUTING.md │ ├── Cargo.toml │ ├── README.md │ ├── src │ ├── generated │ │ ├── accounts │ │ │ ├── asset_signer.rs │ │ │ ├── base_asset_v1.rs │ │ │ ├── base_collection_v1.rs │ │ │ ├── hashed_asset_v1.rs │ │ │ ├── mod.rs │ │ │ ├── plugin_header_v1.rs │ │ │ └── plugin_registry_v1.rs │ │ ├── errors │ │ │ ├── mod.rs │ │ │ └── mpl_core.rs │ │ ├── instructions │ │ │ ├── add_collection_external_plugin_adapter_v1.rs │ │ │ ├── add_collection_plugin_v1.rs │ │ │ ├── add_external_plugin_adapter_v1.rs │ │ │ ├── add_plugin_v1.rs │ │ │ ├── approve_collection_plugin_authority_v1.rs │ │ │ ├── approve_plugin_authority_v1.rs │ │ │ ├── burn_collection_v1.rs │ │ │ ├── burn_v1.rs │ │ │ ├── collect.rs │ │ │ ├── compress_v1.rs │ │ │ ├── create_collection_v1.rs │ │ │ ├── create_collection_v2.rs │ │ │ ├── create_v1.rs │ │ │ ├── create_v2.rs │ │ │ ├── decompress_v1.rs │ │ │ ├── execute_v1.rs │ │ │ ├── mod.rs │ │ │ ├── remove_collection_external_plugin_adapter_v1.rs │ │ │ ├── remove_collection_plugin_v1.rs │ │ │ ├── remove_external_plugin_adapter_v1.rs │ │ │ ├── remove_plugin_v1.rs │ │ │ ├── revoke_collection_plugin_authority_v1.rs │ │ │ ├── revoke_plugin_authority_v1.rs │ │ │ ├── transfer_v1.rs │ │ │ ├── update_collection_external_plugin_adapter_v1.rs │ │ │ ├── update_collection_info_v1.rs │ │ │ ├── update_collection_plugin_v1.rs │ │ │ ├── update_collection_v1.rs │ │ │ ├── update_external_plugin_adapter_v1.rs │ │ │ ├── update_plugin_v1.rs │ │ │ ├── update_v1.rs │ │ │ ├── update_v2.rs │ │ │ ├── write_collection_external_plugin_adapter_data_v1.rs │ │ │ └── write_external_plugin_adapter_data_v1.rs │ │ ├── mod.rs │ │ ├── programs.rs │ │ └── types │ │ │ ├── add_blocker.rs │ │ │ ├── app_data.rs │ │ │ ├── app_data_init_info.rs │ │ │ ├── app_data_update_info.rs │ │ │ ├── attribute.rs │ │ │ ├── attributes.rs │ │ │ ├── autograph.rs │ │ │ ├── autograph_signature.rs │ │ │ ├── bubblegum_v2.rs │ │ │ ├── burn_delegate.rs │ │ │ ├── compression_proof.rs │ │ │ ├── creator.rs │ │ │ ├── data_section.rs │ │ │ ├── data_section_init_info.rs │ │ │ ├── data_section_update_info.rs │ │ │ ├── data_state.rs │ │ │ ├── edition.rs │ │ │ ├── external_check_result.rs │ │ │ ├── external_plugin_adapter.rs │ │ │ ├── external_plugin_adapter_init_info.rs │ │ │ ├── external_plugin_adapter_key.rs │ │ │ ├── external_plugin_adapter_schema.rs │ │ │ ├── external_plugin_adapter_type.rs │ │ │ ├── external_plugin_adapter_update_info.rs │ │ │ ├── external_registry_record.rs │ │ │ ├── external_validation_result.rs │ │ │ ├── extra_account.rs │ │ │ ├── freeze_delegate.rs │ │ │ ├── hashable_plugin_schema.rs │ │ │ ├── hashed_asset_schema.rs │ │ │ ├── hookable_lifecycle_event.rs │ │ │ ├── immutable_metadata.rs │ │ │ ├── key.rs │ │ │ ├── lifecycle_hook.rs │ │ │ ├── lifecycle_hook_init_info.rs │ │ │ ├── lifecycle_hook_update_info.rs │ │ │ ├── linked_app_data.rs │ │ │ ├── linked_app_data_init_info.rs │ │ │ ├── linked_app_data_update_info.rs │ │ │ ├── linked_data_key.rs │ │ │ ├── linked_lifecycle_hook.rs │ │ │ ├── linked_lifecycle_hook_init_info.rs │ │ │ ├── linked_lifecycle_hook_update_info.rs │ │ │ ├── master_edition.rs │ │ │ ├── mod.rs │ │ │ ├── oracle.rs │ │ │ ├── oracle_init_info.rs │ │ │ ├── oracle_update_info.rs │ │ │ ├── oracle_validation.rs │ │ │ ├── permanent_burn_delegate.rs │ │ │ ├── permanent_freeze_delegate.rs │ │ │ ├── permanent_transfer_delegate.rs │ │ │ ├── plugin.rs │ │ │ ├── plugin_authority.rs │ │ │ ├── plugin_authority_pair.rs │ │ │ ├── plugin_type.rs │ │ │ ├── registry_record.rs │ │ │ ├── royalties.rs │ │ │ ├── rule_set.rs │ │ │ ├── seed.rs │ │ │ ├── transfer_delegate.rs │ │ │ ├── update_authority.rs │ │ │ ├── update_delegate.rs │ │ │ ├── update_type.rs │ │ │ ├── validation_result.rs │ │ │ ├── validation_results_offset.rs │ │ │ ├── verified_creators.rs │ │ │ └── verified_creators_signature.rs │ ├── hooked │ │ ├── advanced_types.rs │ │ ├── asset.rs │ │ ├── collection.rs │ │ ├── mod.rs │ │ └── plugin.rs │ ├── indexable_asset.rs │ └── lib.rs │ └── tests │ ├── add_external_plugins.rs │ ├── create.rs │ ├── create_collection.rs │ ├── create_collection_with_external_plugins.rs │ ├── create_with_external_plugins.rs │ ├── plugins.rs │ ├── remove_external_plugins.rs │ ├── remove_external_plugins_on_collection.rs │ ├── setup │ └── mod.rs │ ├── transfer.rs │ ├── update_collection_info.rs │ ├── update_external_plugins.rs │ └── update_external_plugins_on_collection.rs ├── configs ├── kinobi.cjs ├── scripts │ ├── client │ │ ├── benchmark-js.sh │ │ ├── format-js.sh │ │ ├── lint-js.sh │ │ ├── test-js.sh │ │ └── test-rust.sh │ └── program │ │ ├── build.sh │ │ ├── clean.sh │ │ ├── dump.sh │ │ ├── dump_oracle_example.sh │ │ ├── format.sh │ │ ├── lint.sh │ │ └── test.sh ├── shank.cjs └── validator.cjs ├── idls └── mpl_core.json ├── package.json ├── pnpm-lock.yaml └── programs └── mpl-core ├── Cargo.toml ├── README.md ├── rustfmt.toml └── src ├── entrypoint.rs ├── error.rs ├── instruction.rs ├── lib.rs ├── plugins ├── external │ ├── app_data.rs │ ├── data_section.rs │ ├── lifecycle_hook.rs │ ├── linked_app_data.rs │ ├── linked_lifecycle_hook.rs │ ├── mod.rs │ └── oracle.rs ├── external_plugin_adapters.rs ├── internal │ ├── authority_managed │ │ ├── add_blocker.rs │ │ ├── attributes.rs │ │ ├── immutable_metadata.rs │ │ ├── master_edition.rs │ │ ├── mod.rs │ │ ├── royalties.rs │ │ ├── update_delegate.rs │ │ └── verified_creators.rs │ ├── mod.rs │ ├── owner_managed │ │ ├── autograph.rs │ │ ├── burn_delegate.rs │ │ ├── freeze_delegate.rs │ │ ├── mod.rs │ │ └── transfer_delegate.rs │ └── permanent │ │ ├── bubblegum_v2.rs │ │ ├── edition.rs │ │ ├── mod.rs │ │ ├── permanent_burn_delegate.rs │ │ ├── permanent_freeze_delegate.rs │ │ └── permanent_transfer_delegate.rs ├── lifecycle.rs ├── mod.rs ├── plugin_header.rs ├── plugin_registry.rs └── utils.rs ├── processor ├── add_external_plugin_adapter.rs ├── add_plugin.rs ├── approve_plugin_authority.rs ├── burn.rs ├── collect.rs ├── compress.rs ├── create.rs ├── create_collection.rs ├── decompress.rs ├── execute.rs ├── mod.rs ├── remove_external_plugin_adapter.rs ├── remove_plugin.rs ├── revoke_plugin_authority.rs ├── transfer.rs ├── update.rs ├── update_collection_info.rs ├── update_external_plugin_adapter.rs ├── update_plugin.rs └── write_external_plugin_adapter_data.rs ├── state ├── asset.rs ├── collect.rs ├── collection.rs ├── compression_proof.rs ├── hashable_plugin_schema.rs ├── hashed_asset.rs ├── hashed_asset_schema.rs ├── mod.rs ├── traits.rs └── update_authority.rs └── utils ├── account.rs ├── compression.rs └── mod.rs /.github/.env: -------------------------------------------------------------------------------- 1 | CARGO_TERM_COLOR=always 2 | NODE_VERSION=20.x 3 | PROGRAMS=["mpl-core"] 4 | RUST_VERSION=1.79.0 5 | SOLANA_VERSION=1.18.19 6 | COMMIT_USER_NAME=github-actions 7 | COMMIT_USER_EMAIL=github-actions@github.com 8 | DEPLOY_SOLANA_VERSION=1.18.19 9 | -------------------------------------------------------------------------------- /.github/file-filters.yml: -------------------------------------------------------------------------------- 1 | # This file is used by the dorny/paths-filter action to figure out if a program or 2 | # client has changed and thus if it should be built or tested. Any changes in the 3 | # files listed below will trigger the appropriate workflow for that program or client. 4 | 5 | # Programs. 6 | 7 | program_common: &program_common 8 | - ".github/workflows/build-programs.yml" 9 | - ".github/workflows/test-programs.yml" 10 | - ".github/workflows/main.yml" 11 | - ".github/file-filters.yml" 12 | - ".github/.env" 13 | 14 | mpl_core_program: &mpl_core_program 15 | - *program_common 16 | - "programs/mpl-core/**" 17 | 18 | programs: &programs 19 | - *mpl_core_program 20 | 21 | # Clients. 22 | 23 | client_common: &client_common 24 | - *programs 25 | - ".github/workflows/test-js.yml" 26 | - ".github/workflows/test-rust-client.yml" 27 | - ".github/workflows/build-rust-client.yml" 28 | - ".github/workflows/main.yml" 29 | - ".github/file-filters.yml" 30 | - ".github/.env" 31 | - "configs/shank.cjs" 32 | - "configs/kinobi.cjs" 33 | 34 | js_client: &js_client 35 | - *client_common 36 | - "clients/js/**" 37 | 38 | rust_client: &rust_client 39 | - *client_common 40 | - "clients/rust/**" 41 | 42 | clients: &clients 43 | - *js_client 44 | - *rust_client 45 | 46 | # Any. 47 | 48 | any: &any 49 | - *programs 50 | - *clients 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .anchor 2 | .DS_Store 3 | **/.DS_Store 4 | **/target 5 | **/*.rs.bk 6 | node_modules 7 | test-ledger 8 | dist 9 | .amman 10 | .crates 11 | .bin 12 | .idea 13 | corebAsZhvD7wa9UiwMiqdbmminpxCp1AxvTrFJbizL.json 14 | CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d.json 15 | clients/js/yarn.lock 16 | clients/js/output.json -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Exit if a merge is in progress 4 | if [ -f .git/MERGE_HEAD ]; then 5 | exit 0 6 | fi 7 | 8 | set +e 9 | 10 | # Stash un-staged changes 11 | git stash -q --keep-index 12 | 13 | # Run pnpm commands 14 | echo "Linting..." 15 | pnpm lint 16 | LINT_EXIT_CODE=$? 17 | 18 | # Restore un-staged changes 19 | git stash pop -q 20 | 21 | # Check if tests or lint failed 22 | if [ $LINT_EXIT_CODE -ne 0 ]; then 23 | echo "Linting failed run 'pnpm lint:fix' to fix linting issues" 24 | exit 1 25 | fi 26 | 27 | set -e 28 | 29 | exit 0 -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = ["clients/rust", "programs/mpl-core"] 4 | 5 | [profile.release] 6 | overflow-checks = true # Enable integer overflow checks. 7 | strip = true # Automatically strip symbols from the binary. 8 | opt-level = 3 # Optimize for speed. 9 | lto = true 10 | codegen-units = 1 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mpl Core 2 | 3 | Digital Assets 4 | 5 | ## Documentation 6 | 7 | Read the full documentation [here](https://developers.metaplex.com) 8 | 9 | ## Programs 10 | 11 | This project contains the following programs: 12 | 13 | - [Mpl Core](./programs/mpl-core/README.md) `CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d` 14 | 15 | You will need a Rust version compatible with BPF to compile the program, currently we recommend using Rust 1.68.0. 16 | 17 | ## Clients 18 | 19 | This project contains the following clients: 20 | 21 | - [JavaScript](./clients/js/README.md) 22 | - [Rust](./clients/rust/README.md) 23 | 24 | ## Contributing 25 | 26 | Check out the [Contributing Guide](./CONTRIBUTING.md) the learn more about how to contribute to this project. 27 | 28 | ## Security 29 | 30 | Audit Completed 2024-05-03 by Mad Shield 31 | -------------------------------------------------------------------------------- /clients/js/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['airbnb-base', 'airbnb-typescript/base', 'prettier'], 3 | plugins: ['prettier'], 4 | overrides: [], 5 | parserOptions: { 6 | ecmaVersion: 'latest', 7 | sourceType: 'module', 8 | project: 'tsconfig.json', 9 | tsconfigRootDir: __dirname, 10 | }, 11 | rules: { 12 | '@typescript-eslint/no-use-before-define': 'off', 13 | '@typescript-eslint/no-unused-vars': 'off', 14 | 'class-methods-use-this': 'off', 15 | 'import/prefer-default-export': 'off', 16 | 'import/no-cycle': 'off', 17 | 'no-underscore-dangle': 'off', 18 | 'max-classes-per-file': 'off', 19 | 'no-param-reassign': 'off', 20 | 'func-names': 'off', 21 | }, 22 | ignorePatterns: ['dist/**', '.eslintrc.js'], 23 | }; 24 | -------------------------------------------------------------------------------- /clients/js/.gitignore: -------------------------------------------------------------------------------- 1 | .vercel 2 | docs 3 | -------------------------------------------------------------------------------- /clients/js/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "trailingComma": "es5", 5 | "useTabs": false, 6 | "tabWidth": 2, 7 | "arrowParens": "always", 8 | "printWidth": 80, 9 | "parser": "typescript" 10 | } 11 | -------------------------------------------------------------------------------- /clients/js/bench/_setup.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | import { createUmi as basecreateUmi } from '@metaplex-foundation/umi-bundle-tests'; 3 | import { 4 | mplCore, 5 | } from '../src'; 6 | 7 | export const createUmi = async () => (await basecreateUmi()).use(mplCore()); 8 | -------------------------------------------------------------------------------- /clients/js/src/authority.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from '@metaplex-foundation/umi'; 2 | import { pluginAuthority } from './plugins'; 3 | 4 | /** 5 | * @deprecated use SDK v1 methods like `create` or `update` instead of `createV1` or `updateV1`. The new methods no longer require this helper 6 | * 7 | * @returns umi plugin authority with type 'None' 8 | */ 9 | export function nonePluginAuthority() { 10 | return pluginAuthority('None'); 11 | } 12 | 13 | /** 14 | * @deprecated use SDK v1 methods like `create` or `update` instead of `createV1` or `updateV1`. The new methods no longer require this helper 15 | * @returns umi plugin authority with type 'None' 16 | */ 17 | export function ownerPluginAuthority() { 18 | return pluginAuthority('Owner'); 19 | } 20 | 21 | /** 22 | * @deprecated use SDK v1 methods like `create` or `update` instead of `createV1` or `updateV1`. The new methods no longer require this helper 23 | * @returns umi plugin authority with type 'UpdateAuthority' 24 | */ 25 | export function updatePluginAuthority() { 26 | return pluginAuthority('UpdateAuthority'); 27 | } 28 | 29 | /** 30 | * @deprecated use SDK v1 methods like `create` or `update` instead of `createV1` or `updateV1`. The new methods no longer require this helper 31 | * @returns umi plugin authority with type 'Address' 32 | */ 33 | export function addressPluginAuthority(address: PublicKey) { 34 | return pluginAuthority('Address', { address }); 35 | } 36 | -------------------------------------------------------------------------------- /clients/js/src/generated/accounts/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | export * from './assetSigner'; 10 | export * from './assetV1'; 11 | export * from './collectionV1'; 12 | export * from './hashedAssetV1'; 13 | export * from './pluginHeaderV1'; 14 | export * from './pluginRegistryV1'; 15 | -------------------------------------------------------------------------------- /clients/js/src/generated/errors/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | export * from './mplCore'; 10 | -------------------------------------------------------------------------------- /clients/js/src/generated/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | export * from './accounts'; 10 | export * from './errors'; 11 | export * from './instructions'; 12 | export * from './programs'; 13 | export * from './shared'; 14 | export * from './types'; 15 | -------------------------------------------------------------------------------- /clients/js/src/generated/instructions/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | export * from './addCollectionExternalPluginAdapterV1'; 10 | export * from './addCollectionPluginV1'; 11 | export * from './addExternalPluginAdapterV1'; 12 | export * from './addPluginV1'; 13 | export * from './approveCollectionPluginAuthorityV1'; 14 | export * from './approvePluginAuthorityV1'; 15 | export * from './burnCollectionV1'; 16 | export * from './burnV1'; 17 | export * from './collect'; 18 | export * from './compressV1'; 19 | export * from './createCollectionV1'; 20 | export * from './createCollectionV2'; 21 | export * from './createV1'; 22 | export * from './createV2'; 23 | export * from './decompressV1'; 24 | export * from './executeV1'; 25 | export * from './removeCollectionExternalPluginAdapterV1'; 26 | export * from './removeCollectionPluginV1'; 27 | export * from './removeExternalPluginAdapterV1'; 28 | export * from './removePluginV1'; 29 | export * from './revokeCollectionPluginAuthorityV1'; 30 | export * from './revokePluginAuthorityV1'; 31 | export * from './transferV1'; 32 | export * from './updateCollectionExternalPluginAdapterV1'; 33 | export * from './updateCollectionInfoV1'; 34 | export * from './updateCollectionPluginV1'; 35 | export * from './updateCollectionV1'; 36 | export * from './updateExternalPluginAdapterV1'; 37 | export * from './updatePluginV1'; 38 | export * from './updateV1'; 39 | export * from './updateV2'; 40 | export * from './writeCollectionExternalPluginAdapterDataV1'; 41 | export * from './writeExternalPluginAdapterDataV1'; 42 | -------------------------------------------------------------------------------- /clients/js/src/generated/programs/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | export * from './mplCore'; 10 | -------------------------------------------------------------------------------- /clients/js/src/generated/programs/mplCore.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { 10 | ClusterFilter, 11 | Context, 12 | Program, 13 | PublicKey, 14 | } from '@metaplex-foundation/umi'; 15 | import { getMplCoreErrorFromCode, getMplCoreErrorFromName } from '../errors'; 16 | 17 | export const MPL_CORE_PROGRAM_ID = 18 | 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' as PublicKey<'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d'>; 19 | 20 | export function createMplCoreProgram(): Program { 21 | return { 22 | name: 'mplCore', 23 | publicKey: MPL_CORE_PROGRAM_ID, 24 | getErrorFromCode(code: number, cause?: Error) { 25 | return getMplCoreErrorFromCode(code, this, cause); 26 | }, 27 | getErrorFromName(name: string, cause?: Error) { 28 | return getMplCoreErrorFromName(name, this, cause); 29 | }, 30 | isOnCluster() { 31 | return true; 32 | }, 33 | }; 34 | } 35 | 36 | export function getMplCoreProgram( 37 | context: Pick, 38 | clusterFilter?: ClusterFilter 39 | ): T { 40 | return context.programs.get('mplCore', clusterFilter); 41 | } 42 | 43 | export function getMplCoreProgramId( 44 | context: Pick, 45 | clusterFilter?: ClusterFilter 46 | ): PublicKey { 47 | return context.programs.getPublicKey( 48 | 'mplCore', 49 | MPL_CORE_PROGRAM_ID, 50 | clusterFilter 51 | ); 52 | } 53 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/addBlocker.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type AddBlocker = {}; 12 | 13 | export type AddBlockerArgs = AddBlocker; 14 | 15 | export function getAddBlockerSerializer(): Serializer< 16 | AddBlockerArgs, 17 | AddBlocker 18 | > { 19 | return struct([], { description: 'AddBlocker' }) as Serializer< 20 | AddBlockerArgs, 21 | AddBlocker 22 | >; 23 | } 24 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/assetV1AccountData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Option, OptionOrNullable, PublicKey } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | option, 13 | publicKey as publicKeySerializer, 14 | string, 15 | struct, 16 | u64, 17 | } from '@metaplex-foundation/umi/serializers'; 18 | import { 19 | BaseUpdateAuthority, 20 | BaseUpdateAuthorityArgs, 21 | Key, 22 | KeyArgs, 23 | getBaseUpdateAuthoritySerializer, 24 | getKeySerializer, 25 | } from '.'; 26 | 27 | export type AssetV1AccountData = { 28 | key: Key; 29 | owner: PublicKey; 30 | updateAuthority: BaseUpdateAuthority; 31 | name: string; 32 | uri: string; 33 | seq: Option; 34 | }; 35 | 36 | export type AssetV1AccountDataArgs = { 37 | key: KeyArgs; 38 | owner: PublicKey; 39 | updateAuthority: BaseUpdateAuthorityArgs; 40 | name: string; 41 | uri: string; 42 | seq: OptionOrNullable; 43 | }; 44 | 45 | export function getAssetV1AccountDataSerializer(): Serializer< 46 | AssetV1AccountDataArgs, 47 | AssetV1AccountData 48 | > { 49 | return struct( 50 | [ 51 | ['key', getKeySerializer()], 52 | ['owner', publicKeySerializer()], 53 | ['updateAuthority', getBaseUpdateAuthoritySerializer()], 54 | ['name', string()], 55 | ['uri', string()], 56 | ['seq', option(u64())], 57 | ], 58 | { description: 'AssetV1AccountData' } 59 | ) as Serializer; 60 | } 61 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/attribute.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { 10 | Serializer, 11 | string, 12 | struct, 13 | } from '@metaplex-foundation/umi/serializers'; 14 | 15 | export type Attribute = { key: string; value: string }; 16 | 17 | export type AttributeArgs = Attribute; 18 | 19 | export function getAttributeSerializer(): Serializer { 20 | return struct( 21 | [ 22 | ['key', string()], 23 | ['value', string()], 24 | ], 25 | { description: 'Attribute' } 26 | ) as Serializer; 27 | } 28 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/attributes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { 10 | Serializer, 11 | array, 12 | struct, 13 | } from '@metaplex-foundation/umi/serializers'; 14 | import { Attribute, AttributeArgs, getAttributeSerializer } from '.'; 15 | 16 | export type Attributes = { attributeList: Array }; 17 | 18 | export type AttributesArgs = { attributeList: Array }; 19 | 20 | export function getAttributesSerializer(): Serializer< 21 | AttributesArgs, 22 | Attributes 23 | > { 24 | return struct( 25 | [['attributeList', array(getAttributeSerializer())]], 26 | { description: 'Attributes' } 27 | ) as Serializer; 28 | } 29 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/autograph.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { 10 | Serializer, 11 | array, 12 | struct, 13 | } from '@metaplex-foundation/umi/serializers'; 14 | import { 15 | AutographSignature, 16 | AutographSignatureArgs, 17 | getAutographSignatureSerializer, 18 | } from '.'; 19 | 20 | export type Autograph = { signatures: Array }; 21 | 22 | export type AutographArgs = { signatures: Array }; 23 | 24 | export function getAutographSerializer(): Serializer { 25 | return struct( 26 | [['signatures', array(getAutographSignatureSerializer())]], 27 | { description: 'Autograph' } 28 | ) as Serializer; 29 | } 30 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/autographSignature.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { PublicKey } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | publicKey as publicKeySerializer, 13 | string, 14 | struct, 15 | } from '@metaplex-foundation/umi/serializers'; 16 | 17 | export type AutographSignature = { address: PublicKey; message: string }; 18 | 19 | export type AutographSignatureArgs = AutographSignature; 20 | 21 | export function getAutographSignatureSerializer(): Serializer< 22 | AutographSignatureArgs, 23 | AutographSignature 24 | > { 25 | return struct( 26 | [ 27 | ['address', publicKeySerializer()], 28 | ['message', string()], 29 | ], 30 | { description: 'AutographSignature' } 31 | ) as Serializer; 32 | } 33 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseAppData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | import { 11 | BasePluginAuthority, 12 | BasePluginAuthorityArgs, 13 | ExternalPluginAdapterSchema, 14 | ExternalPluginAdapterSchemaArgs, 15 | getBasePluginAuthoritySerializer, 16 | getExternalPluginAdapterSchemaSerializer, 17 | } from '.'; 18 | 19 | export type BaseAppData = { 20 | dataAuthority: BasePluginAuthority; 21 | schema: ExternalPluginAdapterSchema; 22 | }; 23 | 24 | export type BaseAppDataArgs = { 25 | dataAuthority: BasePluginAuthorityArgs; 26 | schema: ExternalPluginAdapterSchemaArgs; 27 | }; 28 | 29 | export function getBaseAppDataSerializer(): Serializer< 30 | BaseAppDataArgs, 31 | BaseAppData 32 | > { 33 | return struct( 34 | [ 35 | ['dataAuthority', getBasePluginAuthoritySerializer()], 36 | ['schema', getExternalPluginAdapterSchemaSerializer()], 37 | ], 38 | { description: 'BaseAppData' } 39 | ) as Serializer; 40 | } 41 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseAppDataInitInfo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Option, OptionOrNullable } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | option, 13 | struct, 14 | } from '@metaplex-foundation/umi/serializers'; 15 | import { 16 | BasePluginAuthority, 17 | BasePluginAuthorityArgs, 18 | ExternalPluginAdapterSchema, 19 | ExternalPluginAdapterSchemaArgs, 20 | getBasePluginAuthoritySerializer, 21 | getExternalPluginAdapterSchemaSerializer, 22 | } from '.'; 23 | 24 | export type BaseAppDataInitInfo = { 25 | dataAuthority: BasePluginAuthority; 26 | initPluginAuthority: Option; 27 | schema: Option; 28 | }; 29 | 30 | export type BaseAppDataInitInfoArgs = { 31 | dataAuthority: BasePluginAuthorityArgs; 32 | initPluginAuthority: OptionOrNullable; 33 | schema: OptionOrNullable; 34 | }; 35 | 36 | export function getBaseAppDataInitInfoSerializer(): Serializer< 37 | BaseAppDataInitInfoArgs, 38 | BaseAppDataInitInfo 39 | > { 40 | return struct( 41 | [ 42 | ['dataAuthority', getBasePluginAuthoritySerializer()], 43 | ['initPluginAuthority', option(getBasePluginAuthoritySerializer())], 44 | ['schema', option(getExternalPluginAdapterSchemaSerializer())], 45 | ], 46 | { description: 'BaseAppDataInitInfo' } 47 | ) as Serializer; 48 | } 49 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseAppDataUpdateInfo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Option, OptionOrNullable } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | option, 13 | struct, 14 | } from '@metaplex-foundation/umi/serializers'; 15 | import { 16 | ExternalPluginAdapterSchema, 17 | ExternalPluginAdapterSchemaArgs, 18 | getExternalPluginAdapterSchemaSerializer, 19 | } from '.'; 20 | 21 | export type BaseAppDataUpdateInfo = { 22 | schema: Option; 23 | }; 24 | 25 | export type BaseAppDataUpdateInfoArgs = { 26 | schema: OptionOrNullable; 27 | }; 28 | 29 | export function getBaseAppDataUpdateInfoSerializer(): Serializer< 30 | BaseAppDataUpdateInfoArgs, 31 | BaseAppDataUpdateInfo 32 | > { 33 | return struct( 34 | [['schema', option(getExternalPluginAdapterSchemaSerializer())]], 35 | { description: 'BaseAppDataUpdateInfo' } 36 | ) as Serializer; 37 | } 38 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseDataSection.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | import { 11 | BaseLinkedDataKey, 12 | BaseLinkedDataKeyArgs, 13 | ExternalPluginAdapterSchema, 14 | ExternalPluginAdapterSchemaArgs, 15 | getBaseLinkedDataKeySerializer, 16 | getExternalPluginAdapterSchemaSerializer, 17 | } from '.'; 18 | 19 | export type BaseDataSection = { 20 | parentKey: BaseLinkedDataKey; 21 | schema: ExternalPluginAdapterSchema; 22 | }; 23 | 24 | export type BaseDataSectionArgs = { 25 | parentKey: BaseLinkedDataKeyArgs; 26 | schema: ExternalPluginAdapterSchemaArgs; 27 | }; 28 | 29 | export function getBaseDataSectionSerializer(): Serializer< 30 | BaseDataSectionArgs, 31 | BaseDataSection 32 | > { 33 | return struct( 34 | [ 35 | ['parentKey', getBaseLinkedDataKeySerializer()], 36 | ['schema', getExternalPluginAdapterSchemaSerializer()], 37 | ], 38 | { description: 'BaseDataSection' } 39 | ) as Serializer; 40 | } 41 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseDataSectionInitInfo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | import { 11 | BaseLinkedDataKey, 12 | BaseLinkedDataKeyArgs, 13 | ExternalPluginAdapterSchema, 14 | ExternalPluginAdapterSchemaArgs, 15 | getBaseLinkedDataKeySerializer, 16 | getExternalPluginAdapterSchemaSerializer, 17 | } from '.'; 18 | 19 | export type BaseDataSectionInitInfo = { 20 | parentKey: BaseLinkedDataKey; 21 | schema: ExternalPluginAdapterSchema; 22 | }; 23 | 24 | export type BaseDataSectionInitInfoArgs = { 25 | parentKey: BaseLinkedDataKeyArgs; 26 | schema: ExternalPluginAdapterSchemaArgs; 27 | }; 28 | 29 | export function getBaseDataSectionInitInfoSerializer(): Serializer< 30 | BaseDataSectionInitInfoArgs, 31 | BaseDataSectionInitInfo 32 | > { 33 | return struct( 34 | [ 35 | ['parentKey', getBaseLinkedDataKeySerializer()], 36 | ['schema', getExternalPluginAdapterSchemaSerializer()], 37 | ], 38 | { description: 'BaseDataSectionInitInfo' } 39 | ) as Serializer; 40 | } 41 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseDataSectionUpdateInfo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type BaseDataSectionUpdateInfo = {}; 12 | 13 | export type BaseDataSectionUpdateInfoArgs = BaseDataSectionUpdateInfo; 14 | 15 | export function getBaseDataSectionUpdateInfoSerializer(): Serializer< 16 | BaseDataSectionUpdateInfoArgs, 17 | BaseDataSectionUpdateInfo 18 | > { 19 | return struct([], { 20 | description: 'BaseDataSectionUpdateInfo', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseLinkedAppData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | import { 11 | BasePluginAuthority, 12 | BasePluginAuthorityArgs, 13 | ExternalPluginAdapterSchema, 14 | ExternalPluginAdapterSchemaArgs, 15 | getBasePluginAuthoritySerializer, 16 | getExternalPluginAdapterSchemaSerializer, 17 | } from '.'; 18 | 19 | export type BaseLinkedAppData = { 20 | dataAuthority: BasePluginAuthority; 21 | schema: ExternalPluginAdapterSchema; 22 | }; 23 | 24 | export type BaseLinkedAppDataArgs = { 25 | dataAuthority: BasePluginAuthorityArgs; 26 | schema: ExternalPluginAdapterSchemaArgs; 27 | }; 28 | 29 | export function getBaseLinkedAppDataSerializer(): Serializer< 30 | BaseLinkedAppDataArgs, 31 | BaseLinkedAppData 32 | > { 33 | return struct( 34 | [ 35 | ['dataAuthority', getBasePluginAuthoritySerializer()], 36 | ['schema', getExternalPluginAdapterSchemaSerializer()], 37 | ], 38 | { description: 'BaseLinkedAppData' } 39 | ) as Serializer; 40 | } 41 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseLinkedAppDataUpdateInfo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Option, OptionOrNullable } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | option, 13 | struct, 14 | } from '@metaplex-foundation/umi/serializers'; 15 | import { 16 | ExternalPluginAdapterSchema, 17 | ExternalPluginAdapterSchemaArgs, 18 | getExternalPluginAdapterSchemaSerializer, 19 | } from '.'; 20 | 21 | export type BaseLinkedAppDataUpdateInfo = { 22 | schema: Option; 23 | }; 24 | 25 | export type BaseLinkedAppDataUpdateInfoArgs = { 26 | schema: OptionOrNullable; 27 | }; 28 | 29 | export function getBaseLinkedAppDataUpdateInfoSerializer(): Serializer< 30 | BaseLinkedAppDataUpdateInfoArgs, 31 | BaseLinkedAppDataUpdateInfo 32 | > { 33 | return struct( 34 | [['schema', option(getExternalPluginAdapterSchemaSerializer())]], 35 | { description: 'BaseLinkedAppDataUpdateInfo' } 36 | ) as Serializer; 37 | } 38 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseMasterEdition.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Option, OptionOrNullable } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | option, 13 | string, 14 | struct, 15 | u32, 16 | } from '@metaplex-foundation/umi/serializers'; 17 | 18 | export type BaseMasterEdition = { 19 | maxSupply: Option; 20 | name: Option; 21 | uri: Option; 22 | }; 23 | 24 | export type BaseMasterEditionArgs = { 25 | maxSupply: OptionOrNullable; 26 | name: OptionOrNullable; 27 | uri: OptionOrNullable; 28 | }; 29 | 30 | export function getBaseMasterEditionSerializer(): Serializer< 31 | BaseMasterEditionArgs, 32 | BaseMasterEdition 33 | > { 34 | return struct( 35 | [ 36 | ['maxSupply', option(u32())], 37 | ['name', option(string())], 38 | ['uri', option(string())], 39 | ], 40 | { description: 'BaseMasterEdition' } 41 | ) as Serializer; 42 | } 43 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseOracle.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Option, OptionOrNullable, PublicKey } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | option, 13 | publicKey as publicKeySerializer, 14 | struct, 15 | } from '@metaplex-foundation/umi/serializers'; 16 | import { 17 | BaseExtraAccount, 18 | BaseExtraAccountArgs, 19 | BaseValidationResultsOffset, 20 | BaseValidationResultsOffsetArgs, 21 | getBaseExtraAccountSerializer, 22 | getBaseValidationResultsOffsetSerializer, 23 | } from '.'; 24 | 25 | export type BaseOracle = { 26 | baseAddress: PublicKey; 27 | baseAddressConfig: Option; 28 | resultsOffset: BaseValidationResultsOffset; 29 | }; 30 | 31 | export type BaseOracleArgs = { 32 | baseAddress: PublicKey; 33 | baseAddressConfig: OptionOrNullable; 34 | resultsOffset: BaseValidationResultsOffsetArgs; 35 | }; 36 | 37 | export function getBaseOracleSerializer(): Serializer< 38 | BaseOracleArgs, 39 | BaseOracle 40 | > { 41 | return struct( 42 | [ 43 | ['baseAddress', publicKeySerializer()], 44 | ['baseAddressConfig', option(getBaseExtraAccountSerializer())], 45 | ['resultsOffset', getBaseValidationResultsOffsetSerializer()], 46 | ], 47 | { description: 'BaseOracle' } 48 | ) as Serializer; 49 | } 50 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/baseRoyalties.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { 10 | Serializer, 11 | array, 12 | struct, 13 | u16, 14 | } from '@metaplex-foundation/umi/serializers'; 15 | import { 16 | BaseRuleSet, 17 | BaseRuleSetArgs, 18 | Creator, 19 | CreatorArgs, 20 | getBaseRuleSetSerializer, 21 | getCreatorSerializer, 22 | } from '.'; 23 | 24 | export type BaseRoyalties = { 25 | basisPoints: number; 26 | creators: Array; 27 | ruleSet: BaseRuleSet; 28 | }; 29 | 30 | export type BaseRoyaltiesArgs = { 31 | basisPoints: number; 32 | creators: Array; 33 | ruleSet: BaseRuleSetArgs; 34 | }; 35 | 36 | export function getBaseRoyaltiesSerializer(): Serializer< 37 | BaseRoyaltiesArgs, 38 | BaseRoyalties 39 | > { 40 | return struct( 41 | [ 42 | ['basisPoints', u16()], 43 | ['creators', array(getCreatorSerializer())], 44 | ['ruleSet', getBaseRuleSetSerializer()], 45 | ], 46 | { description: 'BaseRoyalties' } 47 | ) as Serializer; 48 | } 49 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/bubblegumV2.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type BubblegumV2 = {}; 12 | 13 | export type BubblegumV2Args = BubblegumV2; 14 | 15 | export function getBubblegumV2Serializer(): Serializer< 16 | BubblegumV2Args, 17 | BubblegumV2 18 | > { 19 | return struct([], { description: 'BubblegumV2' }) as Serializer< 20 | BubblegumV2Args, 21 | BubblegumV2 22 | >; 23 | } 24 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/burnDelegate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type BurnDelegate = {}; 12 | 13 | export type BurnDelegateArgs = BurnDelegate; 14 | 15 | export function getBurnDelegateSerializer(): Serializer< 16 | BurnDelegateArgs, 17 | BurnDelegate 18 | > { 19 | return struct([], { 20 | description: 'BurnDelegate', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/collectionV1AccountData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { PublicKey } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | publicKey as publicKeySerializer, 13 | string, 14 | struct, 15 | u32, 16 | } from '@metaplex-foundation/umi/serializers'; 17 | import { Key, KeyArgs, getKeySerializer } from '.'; 18 | 19 | export type CollectionV1AccountData = { 20 | key: Key; 21 | updateAuthority: PublicKey; 22 | name: string; 23 | uri: string; 24 | numMinted: number; 25 | currentSize: number; 26 | }; 27 | 28 | export type CollectionV1AccountDataArgs = { 29 | key: KeyArgs; 30 | updateAuthority: PublicKey; 31 | name: string; 32 | uri: string; 33 | numMinted: number; 34 | currentSize: number; 35 | }; 36 | 37 | export function getCollectionV1AccountDataSerializer(): Serializer< 38 | CollectionV1AccountDataArgs, 39 | CollectionV1AccountData 40 | > { 41 | return struct( 42 | [ 43 | ['key', getKeySerializer()], 44 | ['updateAuthority', publicKeySerializer()], 45 | ['name', string()], 46 | ['uri', string()], 47 | ['numMinted', u32()], 48 | ['currentSize', u32()], 49 | ], 50 | { description: 'CollectionV1AccountData' } 51 | ) as Serializer; 52 | } 53 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/creator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { PublicKey } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | publicKey as publicKeySerializer, 13 | struct, 14 | u8, 15 | } from '@metaplex-foundation/umi/serializers'; 16 | 17 | export type Creator = { address: PublicKey; percentage: number }; 18 | 19 | export type CreatorArgs = Creator; 20 | 21 | export function getCreatorSerializer(): Serializer { 22 | return struct( 23 | [ 24 | ['address', publicKeySerializer()], 25 | ['percentage', u8()], 26 | ], 27 | { description: 'Creator' } 28 | ) as Serializer; 29 | } 30 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/dataState.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export enum DataState { 12 | AccountState, 13 | LedgerState, 14 | } 15 | 16 | export type DataStateArgs = DataState; 17 | 18 | export function getDataStateSerializer(): Serializer { 19 | return scalarEnum(DataState, { 20 | description: 'DataState', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/edition.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct, u32 } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type Edition = { number: number }; 12 | 13 | export type EditionArgs = Edition; 14 | 15 | export function getEditionSerializer(): Serializer { 16 | return struct([['number', u32()]], { 17 | description: 'Edition', 18 | }) as Serializer; 19 | } 20 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/externalCheckResult.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct, u32 } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type ExternalCheckResult = { flags: number }; 12 | 13 | export type ExternalCheckResultArgs = ExternalCheckResult; 14 | 15 | export function getExternalCheckResultSerializer(): Serializer< 16 | ExternalCheckResultArgs, 17 | ExternalCheckResult 18 | > { 19 | return struct([['flags', u32()]], { 20 | description: 'ExternalCheckResult', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/externalPluginAdapterSchema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export enum ExternalPluginAdapterSchema { 12 | Binary, 13 | Json, 14 | MsgPack, 15 | } 16 | 17 | export type ExternalPluginAdapterSchemaArgs = ExternalPluginAdapterSchema; 18 | 19 | export function getExternalPluginAdapterSchemaSerializer(): Serializer< 20 | ExternalPluginAdapterSchemaArgs, 21 | ExternalPluginAdapterSchema 22 | > { 23 | return scalarEnum(ExternalPluginAdapterSchema, { 24 | description: 'ExternalPluginAdapterSchema', 25 | }) as Serializer< 26 | ExternalPluginAdapterSchemaArgs, 27 | ExternalPluginAdapterSchema 28 | >; 29 | } 30 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/externalPluginAdapterType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export enum ExternalPluginAdapterType { 12 | LifecycleHook, 13 | Oracle, 14 | AppData, 15 | LinkedLifecycleHook, 16 | LinkedAppData, 17 | DataSection, 18 | } 19 | 20 | export type ExternalPluginAdapterTypeArgs = ExternalPluginAdapterType; 21 | 22 | export function getExternalPluginAdapterTypeSerializer(): Serializer< 23 | ExternalPluginAdapterTypeArgs, 24 | ExternalPluginAdapterType 25 | > { 26 | return scalarEnum(ExternalPluginAdapterType, { 27 | description: 'ExternalPluginAdapterType', 28 | }) as Serializer; 29 | } 30 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/externalValidationResult.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export enum ExternalValidationResult { 12 | Approved, 13 | Rejected, 14 | Pass, 15 | } 16 | 17 | export type ExternalValidationResultArgs = ExternalValidationResult; 18 | 19 | export function getExternalValidationResultSerializer(): Serializer< 20 | ExternalValidationResultArgs, 21 | ExternalValidationResult 22 | > { 23 | return scalarEnum(ExternalValidationResult, { 24 | description: 'ExternalValidationResult', 25 | }) as Serializer; 26 | } 27 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/freezeDelegate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, bool, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type FreezeDelegate = { frozen: boolean }; 12 | 13 | export type FreezeDelegateArgs = FreezeDelegate; 14 | 15 | export function getFreezeDelegateSerializer(): Serializer< 16 | FreezeDelegateArgs, 17 | FreezeDelegate 18 | > { 19 | return struct([['frozen', bool()]], { 20 | description: 'FreezeDelegate', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/hashablePluginSchema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct, u64 } from '@metaplex-foundation/umi/serializers'; 10 | import { 11 | BasePluginAuthority, 12 | BasePluginAuthorityArgs, 13 | Plugin, 14 | PluginArgs, 15 | getBasePluginAuthoritySerializer, 16 | getPluginSerializer, 17 | } from '.'; 18 | 19 | export type HashablePluginSchema = { 20 | index: bigint; 21 | authority: BasePluginAuthority; 22 | plugin: Plugin; 23 | }; 24 | 25 | export type HashablePluginSchemaArgs = { 26 | index: number | bigint; 27 | authority: BasePluginAuthorityArgs; 28 | plugin: PluginArgs; 29 | }; 30 | 31 | export function getHashablePluginSchemaSerializer(): Serializer< 32 | HashablePluginSchemaArgs, 33 | HashablePluginSchema 34 | > { 35 | return struct( 36 | [ 37 | ['index', u64()], 38 | ['authority', getBasePluginAuthoritySerializer()], 39 | ['plugin', getPluginSerializer()], 40 | ], 41 | { description: 'HashablePluginSchema' } 42 | ) as Serializer; 43 | } 44 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/hashedAssetSchema.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { 10 | Serializer, 11 | array, 12 | bytes, 13 | struct, 14 | } from '@metaplex-foundation/umi/serializers'; 15 | 16 | export type HashedAssetSchema = { 17 | assetHash: Uint8Array; 18 | pluginHashes: Array; 19 | }; 20 | 21 | export type HashedAssetSchemaArgs = HashedAssetSchema; 22 | 23 | export function getHashedAssetSchemaSerializer(): Serializer< 24 | HashedAssetSchemaArgs, 25 | HashedAssetSchema 26 | > { 27 | return struct( 28 | [ 29 | ['assetHash', bytes({ size: 32 })], 30 | ['pluginHashes', array(bytes({ size: 32 }))], 31 | ], 32 | { description: 'HashedAssetSchema' } 33 | ) as Serializer; 34 | } 35 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/hookableLifecycleEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export enum HookableLifecycleEvent { 12 | Create, 13 | Transfer, 14 | Burn, 15 | Update, 16 | } 17 | 18 | export type HookableLifecycleEventArgs = HookableLifecycleEvent; 19 | 20 | export function getHookableLifecycleEventSerializer(): Serializer< 21 | HookableLifecycleEventArgs, 22 | HookableLifecycleEvent 23 | > { 24 | return scalarEnum(HookableLifecycleEvent, { 25 | description: 'HookableLifecycleEvent', 26 | }) as Serializer; 27 | } 28 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/immutableMetadata.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type ImmutableMetadata = {}; 12 | 13 | export type ImmutableMetadataArgs = ImmutableMetadata; 14 | 15 | export function getImmutableMetadataSerializer(): Serializer< 16 | ImmutableMetadataArgs, 17 | ImmutableMetadata 18 | > { 19 | return struct([], { 20 | description: 'ImmutableMetadata', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/key.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export enum Key { 12 | Uninitialized, 13 | AssetV1, 14 | HashedAssetV1, 15 | PluginHeaderV1, 16 | PluginRegistryV1, 17 | CollectionV1, 18 | } 19 | 20 | export type KeyArgs = Key; 21 | 22 | export function getKeySerializer(): Serializer { 23 | return scalarEnum(Key, { description: 'Key' }) as Serializer< 24 | KeyArgs, 25 | Key 26 | >; 27 | } 28 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/permanentBurnDelegate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type PermanentBurnDelegate = {}; 12 | 13 | export type PermanentBurnDelegateArgs = PermanentBurnDelegate; 14 | 15 | export function getPermanentBurnDelegateSerializer(): Serializer< 16 | PermanentBurnDelegateArgs, 17 | PermanentBurnDelegate 18 | > { 19 | return struct([], { 20 | description: 'PermanentBurnDelegate', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/permanentFreezeDelegate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, bool, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type PermanentFreezeDelegate = { frozen: boolean }; 12 | 13 | export type PermanentFreezeDelegateArgs = PermanentFreezeDelegate; 14 | 15 | export function getPermanentFreezeDelegateSerializer(): Serializer< 16 | PermanentFreezeDelegateArgs, 17 | PermanentFreezeDelegate 18 | > { 19 | return struct([['frozen', bool()]], { 20 | description: 'PermanentFreezeDelegate', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/permanentTransferDelegate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type PermanentTransferDelegate = {}; 12 | 13 | export type PermanentTransferDelegateArgs = PermanentTransferDelegate; 14 | 15 | export function getPermanentTransferDelegateSerializer(): Serializer< 16 | PermanentTransferDelegateArgs, 17 | PermanentTransferDelegate 18 | > { 19 | return struct([], { 20 | description: 'PermanentTransferDelegate', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/pluginAuthorityPair.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Option, OptionOrNullable } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | option, 13 | struct, 14 | } from '@metaplex-foundation/umi/serializers'; 15 | import { 16 | BasePluginAuthority, 17 | BasePluginAuthorityArgs, 18 | Plugin, 19 | PluginArgs, 20 | getBasePluginAuthoritySerializer, 21 | getPluginSerializer, 22 | } from '.'; 23 | 24 | export type PluginAuthorityPair = { 25 | plugin: Plugin; 26 | authority: Option; 27 | }; 28 | 29 | export type PluginAuthorityPairArgs = { 30 | plugin: PluginArgs; 31 | authority: OptionOrNullable; 32 | }; 33 | 34 | export function getPluginAuthorityPairSerializer(): Serializer< 35 | PluginAuthorityPairArgs, 36 | PluginAuthorityPair 37 | > { 38 | return struct( 39 | [ 40 | ['plugin', getPluginSerializer()], 41 | ['authority', option(getBasePluginAuthoritySerializer())], 42 | ], 43 | { description: 'PluginAuthorityPair' } 44 | ) as Serializer; 45 | } 46 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/pluginRegistryV1AccountData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { 10 | Serializer, 11 | array, 12 | struct, 13 | } from '@metaplex-foundation/umi/serializers'; 14 | import { 15 | ExternalRegistryRecord, 16 | ExternalRegistryRecordArgs, 17 | Key, 18 | KeyArgs, 19 | RegistryRecord, 20 | RegistryRecordArgs, 21 | getExternalRegistryRecordSerializer, 22 | getKeySerializer, 23 | getRegistryRecordSerializer, 24 | } from '.'; 25 | 26 | export type PluginRegistryV1AccountData = { 27 | key: Key; 28 | registry: Array; 29 | externalRegistry: Array; 30 | }; 31 | 32 | export type PluginRegistryV1AccountDataArgs = { 33 | key: KeyArgs; 34 | registry: Array; 35 | externalRegistry: Array; 36 | }; 37 | 38 | export function getPluginRegistryV1AccountDataSerializer(): Serializer< 39 | PluginRegistryV1AccountDataArgs, 40 | PluginRegistryV1AccountData 41 | > { 42 | return struct( 43 | [ 44 | ['key', getKeySerializer()], 45 | ['registry', array(getRegistryRecordSerializer())], 46 | ['externalRegistry', array(getExternalRegistryRecordSerializer())], 47 | ], 48 | { description: 'PluginRegistryV1AccountData' } 49 | ) as Serializer; 50 | } 51 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/pluginType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export enum PluginType { 12 | Royalties, 13 | FreezeDelegate, 14 | BurnDelegate, 15 | TransferDelegate, 16 | UpdateDelegate, 17 | PermanentFreezeDelegate, 18 | Attributes, 19 | PermanentTransferDelegate, 20 | PermanentBurnDelegate, 21 | Edition, 22 | MasterEdition, 23 | AddBlocker, 24 | ImmutableMetadata, 25 | VerifiedCreators, 26 | Autograph, 27 | BubblegumV2, 28 | } 29 | 30 | export type PluginTypeArgs = PluginType; 31 | 32 | export function getPluginTypeSerializer(): Serializer< 33 | PluginTypeArgs, 34 | PluginType 35 | > { 36 | return scalarEnum(PluginType, { 37 | description: 'PluginType', 38 | }) as Serializer; 39 | } 40 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/registryRecord.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct, u64 } from '@metaplex-foundation/umi/serializers'; 10 | import { 11 | BasePluginAuthority, 12 | BasePluginAuthorityArgs, 13 | PluginType, 14 | PluginTypeArgs, 15 | getBasePluginAuthoritySerializer, 16 | getPluginTypeSerializer, 17 | } from '.'; 18 | 19 | export type RegistryRecord = { 20 | pluginType: PluginType; 21 | authority: BasePluginAuthority; 22 | offset: bigint; 23 | }; 24 | 25 | export type RegistryRecordArgs = { 26 | pluginType: PluginTypeArgs; 27 | authority: BasePluginAuthorityArgs; 28 | offset: number | bigint; 29 | }; 30 | 31 | export function getRegistryRecordSerializer(): Serializer< 32 | RegistryRecordArgs, 33 | RegistryRecord 34 | > { 35 | return struct( 36 | [ 37 | ['pluginType', getPluginTypeSerializer()], 38 | ['authority', getBasePluginAuthoritySerializer()], 39 | ['offset', u64()], 40 | ], 41 | { description: 'RegistryRecord' } 42 | ) as Serializer; 43 | } 44 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/transferDelegate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, struct } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export type TransferDelegate = {}; 12 | 13 | export type TransferDelegateArgs = TransferDelegate; 14 | 15 | export function getTransferDelegateSerializer(): Serializer< 16 | TransferDelegateArgs, 17 | TransferDelegate 18 | > { 19 | return struct([], { 20 | description: 'TransferDelegate', 21 | }) as Serializer; 22 | } 23 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/updateDelegate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { PublicKey } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | array, 13 | publicKey as publicKeySerializer, 14 | struct, 15 | } from '@metaplex-foundation/umi/serializers'; 16 | 17 | export type UpdateDelegate = { additionalDelegates: Array }; 18 | 19 | export type UpdateDelegateArgs = UpdateDelegate; 20 | 21 | export function getUpdateDelegateSerializer(): Serializer< 22 | UpdateDelegateArgs, 23 | UpdateDelegate 24 | > { 25 | return struct( 26 | [['additionalDelegates', array(publicKeySerializer())]], 27 | { description: 'UpdateDelegate' } 28 | ) as Serializer; 29 | } 30 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/updateType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export enum UpdateType { 12 | Mint, 13 | Add, 14 | Remove, 15 | } 16 | 17 | export type UpdateTypeArgs = UpdateType; 18 | 19 | export function getUpdateTypeSerializer(): Serializer< 20 | UpdateTypeArgs, 21 | UpdateType 22 | > { 23 | return scalarEnum(UpdateType, { 24 | description: 'UpdateType', 25 | }) as Serializer; 26 | } 27 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/validationResult.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers'; 10 | 11 | export enum ValidationResult { 12 | Approved, 13 | Rejected, 14 | Pass, 15 | ForceApproved, 16 | } 17 | 18 | export type ValidationResultArgs = ValidationResult; 19 | 20 | export function getValidationResultSerializer(): Serializer< 21 | ValidationResultArgs, 22 | ValidationResult 23 | > { 24 | return scalarEnum(ValidationResult, { 25 | description: 'ValidationResult', 26 | }) as Serializer; 27 | } 28 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/verifiedCreators.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { 10 | Serializer, 11 | array, 12 | struct, 13 | } from '@metaplex-foundation/umi/serializers'; 14 | import { 15 | VerifiedCreatorsSignature, 16 | VerifiedCreatorsSignatureArgs, 17 | getVerifiedCreatorsSignatureSerializer, 18 | } from '.'; 19 | 20 | export type VerifiedCreators = { signatures: Array }; 21 | 22 | export type VerifiedCreatorsArgs = { 23 | signatures: Array; 24 | }; 25 | 26 | export function getVerifiedCreatorsSerializer(): Serializer< 27 | VerifiedCreatorsArgs, 28 | VerifiedCreators 29 | > { 30 | return struct( 31 | [['signatures', array(getVerifiedCreatorsSignatureSerializer())]], 32 | { description: 'VerifiedCreators' } 33 | ) as Serializer; 34 | } 35 | -------------------------------------------------------------------------------- /clients/js/src/generated/types/verifiedCreatorsSignature.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This code was AUTOGENERATED using the kinobi library. 3 | * Please DO NOT EDIT THIS FILE, instead use visitors 4 | * to add features, then rerun kinobi to update it. 5 | * 6 | * @see https://github.com/metaplex-foundation/kinobi 7 | */ 8 | 9 | import { PublicKey } from '@metaplex-foundation/umi'; 10 | import { 11 | Serializer, 12 | bool, 13 | publicKey as publicKeySerializer, 14 | struct, 15 | } from '@metaplex-foundation/umi/serializers'; 16 | 17 | export type VerifiedCreatorsSignature = { 18 | address: PublicKey; 19 | verified: boolean; 20 | }; 21 | 22 | export type VerifiedCreatorsSignatureArgs = VerifiedCreatorsSignature; 23 | 24 | export function getVerifiedCreatorsSignatureSerializer(): Serializer< 25 | VerifiedCreatorsSignatureArgs, 26 | VerifiedCreatorsSignature 27 | > { 28 | return struct( 29 | [ 30 | ['address', publicKeySerializer()], 31 | ['verified', bool()], 32 | ], 33 | { description: 'VerifiedCreatorsSignature' } 34 | ) as Serializer; 35 | } 36 | -------------------------------------------------------------------------------- /clients/js/src/hash.ts: -------------------------------------------------------------------------------- 1 | import { mergeBytes } from '@metaplex-foundation/umi/serializers'; 2 | import { keccak_256 } from '@noble/hashes/sha3'; 3 | 4 | export function hash(input: Uint8Array | Uint8Array[]): Uint8Array { 5 | return keccak_256(Array.isArray(input) ? mergeBytes(input) : input); 6 | } 7 | -------------------------------------------------------------------------------- /clients/js/src/helpers/index.ts: -------------------------------------------------------------------------------- 1 | export * from './state'; 2 | export * from './lifecycle'; 3 | export * from './plugin'; 4 | export * from './authority'; 5 | export * from './fetch'; 6 | -------------------------------------------------------------------------------- /clients/js/src/hooked/index.ts: -------------------------------------------------------------------------------- 1 | export * from './assetAccountData'; 2 | export * from './collectionAccountData'; 3 | export * from './pluginRegistryV1Data'; 4 | -------------------------------------------------------------------------------- /clients/js/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './generated'; 2 | export * from './plugin'; 3 | export * from './hash'; 4 | export * from './authority'; 5 | export * from './plugins'; 6 | export * from './helpers'; 7 | export * from './instructions'; 8 | -------------------------------------------------------------------------------- /clients/js/src/instructions/addPlugin.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { addPluginV1, addExternalPluginAdapterV1 } from '../generated'; 3 | import { 4 | AssetAddablePluginAuthorityPairArgsV2, 5 | ExternalPluginAdapterInitInfoArgs, 6 | createExternalPluginAdapterInitInfo, 7 | isExternalPluginAdapterType, 8 | pluginAuthorityPairV2, 9 | } from '../plugins'; 10 | 11 | export type AddPluginArgsPlugin = 12 | | AssetAddablePluginAuthorityPairArgsV2 13 | | ExternalPluginAdapterInitInfoArgs; 14 | 15 | export type AddPluginArgs = Omit< 16 | Parameters[1], 17 | 'plugin' | 'initAuthority' 18 | > & { 19 | plugin: AddPluginArgsPlugin; 20 | }; 21 | 22 | export const addPlugin = ( 23 | context: Pick, 24 | { plugin, ...args }: AddPluginArgs 25 | ) => { 26 | if (isExternalPluginAdapterType(plugin)) { 27 | return addExternalPluginAdapterV1(context, { 28 | ...args, 29 | initInfo: createExternalPluginAdapterInitInfo( 30 | plugin as ExternalPluginAdapterInitInfoArgs 31 | ), 32 | }); 33 | } 34 | 35 | const pair = pluginAuthorityPairV2( 36 | plugin as AssetAddablePluginAuthorityPairArgsV2 37 | ); 38 | return addPluginV1(context, { 39 | ...args, 40 | plugin: pair.plugin, 41 | initAuthority: pair.authority, 42 | }); 43 | }; 44 | -------------------------------------------------------------------------------- /clients/js/src/instructions/approvePluginAuthority.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { approvePluginAuthorityV1, PluginType } from '../generated'; 3 | import { PluginAuthority, pluginAuthorityToBase } from '../plugins'; 4 | 5 | export type ApprovePluginAuthorityArgsPlugin = { 6 | type: keyof typeof PluginType; 7 | }; 8 | 9 | export type ApprovePluginAuthorityArgs = Omit< 10 | Parameters[1], 11 | 'pluginType' | 'newAuthority' 12 | > & { 13 | plugin: ApprovePluginAuthorityArgsPlugin; 14 | newAuthority: PluginAuthority; 15 | }; 16 | 17 | export const approvePluginAuthority = ( 18 | context: Pick, 19 | { plugin, newAuthority, ...args }: ApprovePluginAuthorityArgs 20 | ) => 21 | approvePluginAuthorityV1(context, { 22 | ...args, 23 | pluginType: PluginType[plugin.type as keyof typeof PluginType], 24 | newAuthority: pluginAuthorityToBase(newAuthority), 25 | }); 26 | -------------------------------------------------------------------------------- /clients/js/src/instructions/burn.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { CollectionV1, burnV1, AssetV1 } from '../generated'; 3 | import { findExtraAccounts } from '../plugins'; 4 | import { deriveExternalPluginAdapters } from '../helpers'; 5 | 6 | export type BurnArgs = Omit< 7 | Parameters[1], 8 | 'asset' | 'collection' 9 | > & { 10 | asset: Pick; 11 | collection?: Pick; 12 | }; 13 | 14 | export const burn = ( 15 | context: Pick, 16 | { asset, collection, ...args }: BurnArgs 17 | ) => { 18 | const derivedExternalPluginAdapters = deriveExternalPluginAdapters( 19 | asset, 20 | collection 21 | ); 22 | 23 | const extraAccounts = findExtraAccounts( 24 | context, 25 | 'burn', 26 | derivedExternalPluginAdapters, 27 | { 28 | asset: asset.publicKey, 29 | collection: collection?.publicKey, 30 | owner: asset.owner, 31 | } 32 | ); 33 | 34 | return burnV1(context, { 35 | ...args, 36 | asset: asset.publicKey, 37 | collection: collection?.publicKey, 38 | }).addRemainingAccounts(extraAccounts); 39 | }; 40 | -------------------------------------------------------------------------------- /clients/js/src/instructions/collection/addCollectionPlugin.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { 3 | addCollectionExternalPluginAdapterV1, 4 | addCollectionPluginV1, 5 | } from '../../generated'; 6 | import { 7 | CollectionAddablePluginAuthorityPairArgsV2, 8 | pluginAuthorityPairV2, 9 | } from '../../plugins'; 10 | 11 | import { 12 | createExternalPluginAdapterInitInfo, 13 | ExternalPluginAdapterInitInfoArgs, 14 | isExternalPluginAdapterType, 15 | } from '../../plugins/externalPluginAdapters'; 16 | 17 | export type AddCollectionPluginArgsPlugin = 18 | | Exclude 19 | | ExternalPluginAdapterInitInfoArgs; 20 | 21 | export type AddCollectionPluginArgs = Omit< 22 | Parameters[1], 23 | 'plugin' | 'initAuthority' 24 | > & { 25 | plugin: AddCollectionPluginArgsPlugin; 26 | }; 27 | 28 | export const addCollectionPlugin = ( 29 | context: Pick, 30 | { plugin, ...args }: AddCollectionPluginArgs 31 | ) => { 32 | if (isExternalPluginAdapterType(plugin)) { 33 | return addCollectionExternalPluginAdapterV1(context, { 34 | ...args, 35 | initInfo: createExternalPluginAdapterInitInfo( 36 | plugin as ExternalPluginAdapterInitInfoArgs 37 | ), 38 | }); 39 | } 40 | 41 | const pair = pluginAuthorityPairV2( 42 | plugin as CollectionAddablePluginAuthorityPairArgsV2 43 | ); 44 | return addCollectionPluginV1(context, { 45 | ...args, 46 | plugin: pair.plugin, 47 | initAuthority: pair.authority, 48 | }); 49 | }; 50 | -------------------------------------------------------------------------------- /clients/js/src/instructions/collection/approveCollectionPluginAuthority.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { 3 | approveCollectionPluginAuthorityV1, 4 | PluginType, 5 | } from '../../generated'; 6 | import { PluginAuthority, pluginAuthorityToBase } from '../../plugins'; 7 | 8 | export type ApproveCollectionPluginAuthorityArgs = Omit< 9 | Parameters[1], 10 | 'pluginType' | 'newAuthority' 11 | > & { 12 | plugin: { 13 | type: keyof typeof PluginType; 14 | }; 15 | newAuthority: PluginAuthority; 16 | }; 17 | 18 | export const approveCollectionPluginAuthority = ( 19 | context: Pick, 20 | { plugin, newAuthority, ...args }: ApproveCollectionPluginAuthorityArgs 21 | ) => 22 | approveCollectionPluginAuthorityV1(context, { 23 | ...args, 24 | pluginType: PluginType[plugin.type as keyof typeof PluginType], 25 | newAuthority: pluginAuthorityToBase(newAuthority), 26 | }); 27 | -------------------------------------------------------------------------------- /clients/js/src/instructions/collection/burnCollection.ts: -------------------------------------------------------------------------------- 1 | import { burnCollectionV1 as burnCollection } from '../../generated'; 2 | 3 | export { burnCollection }; 4 | -------------------------------------------------------------------------------- /clients/js/src/instructions/collection/createCollection.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { createCollectionV2 } from '../../generated'; 3 | import { 4 | CollectionPluginAuthorityPairArgsV2, 5 | createExternalPluginAdapterInitInfo, 6 | pluginAuthorityPairV2, 7 | } from '../../plugins'; 8 | 9 | import { 10 | ExternalPluginAdapterInitInfoArgs, 11 | isExternalPluginAdapterType, 12 | } from '../../plugins/externalPluginAdapters'; 13 | 14 | export type CreateCollectionArgsPlugin = 15 | | CollectionPluginAuthorityPairArgsV2 16 | | ExternalPluginAdapterInitInfoArgs; 17 | 18 | export type CreateCollectionArgs = Omit< 19 | Parameters[1], 20 | 'plugins' | 'externalPluginAdapters' 21 | > & { 22 | plugins?: CreateCollectionArgsPlugin[]; 23 | }; 24 | 25 | export const createCollection = ( 26 | context: Pick, 27 | { plugins, ...args }: CreateCollectionArgs 28 | ) => { 29 | const firstPartyPlugins: CollectionPluginAuthorityPairArgsV2[] = []; 30 | const externalPluginAdapters: ExternalPluginAdapterInitInfoArgs[] = []; 31 | 32 | plugins?.forEach((plugin) => { 33 | if (isExternalPluginAdapterType(plugin)) { 34 | externalPluginAdapters.push(plugin as ExternalPluginAdapterInitInfoArgs); 35 | } else { 36 | firstPartyPlugins.push(plugin as CollectionPluginAuthorityPairArgsV2); 37 | } 38 | }); 39 | 40 | return createCollectionV2(context, { 41 | ...args, 42 | plugins: firstPartyPlugins.map(pluginAuthorityPairV2), 43 | externalPluginAdapters: externalPluginAdapters.map( 44 | createExternalPluginAdapterInitInfo 45 | ), 46 | }); 47 | }; 48 | -------------------------------------------------------------------------------- /clients/js/src/instructions/collection/index.ts: -------------------------------------------------------------------------------- 1 | export * from './addCollectionPlugin'; 2 | export * from './approveCollectionPluginAuthority'; 3 | export * from './burnCollection'; 4 | export * from './createCollection'; 5 | export * from './removeCollectionPlugin'; 6 | export * from './revokeCollectionPluginAuthority'; 7 | export * from './updateCollection'; 8 | export * from './updateCollectionPlugin'; 9 | -------------------------------------------------------------------------------- /clients/js/src/instructions/collection/removeCollectionPlugin.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { 3 | PluginType, 4 | removeCollectionExternalPluginAdapterV1, 5 | removeCollectionPluginV1, 6 | } from '../../generated'; 7 | import { 8 | ExternalPluginAdapterKey, 9 | externalPluginAdapterKeyToBase, 10 | } from '../../plugins'; 11 | 12 | import { isExternalPluginAdapterType } from '../../plugins/externalPluginAdapters'; 13 | 14 | export type RemoveCollectionPluginArgsPlugin = 15 | | { 16 | type: Exclude; 17 | } 18 | | ExternalPluginAdapterKey; 19 | 20 | export type RemoveCollectionPluginArgs = Omit< 21 | Parameters[1], 22 | 'plugin' | 'pluginType' 23 | > & { 24 | plugin: RemoveCollectionPluginArgsPlugin; 25 | }; 26 | 27 | export const removeCollectionPlugin = ( 28 | context: Pick, 29 | { plugin, ...args }: RemoveCollectionPluginArgs 30 | ) => { 31 | if (isExternalPluginAdapterType(plugin)) { 32 | return removeCollectionExternalPluginAdapterV1(context, { 33 | ...args, 34 | key: externalPluginAdapterKeyToBase(plugin as ExternalPluginAdapterKey), 35 | }); 36 | } 37 | 38 | return removeCollectionPluginV1(context, { 39 | ...args, 40 | pluginType: PluginType[plugin.type as keyof typeof PluginType], 41 | }); 42 | }; 43 | -------------------------------------------------------------------------------- /clients/js/src/instructions/collection/revokeCollectionPluginAuthority.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { revokeCollectionPluginAuthorityV1, PluginType } from '../../generated'; 3 | 4 | export type RevokeCollectionPluginAuthorityArgs = Omit< 5 | Parameters[1], 6 | 'pluginType' 7 | > & { 8 | plugin: { 9 | type: keyof typeof PluginType; 10 | }; 11 | }; 12 | 13 | export const revokeCollectionPluginAuthority = ( 14 | context: Pick, 15 | { plugin, ...args }: RevokeCollectionPluginAuthorityArgs 16 | ) => 17 | revokeCollectionPluginAuthorityV1(context, { 18 | ...args, 19 | pluginType: PluginType[plugin.type as keyof typeof PluginType], 20 | }); 21 | -------------------------------------------------------------------------------- /clients/js/src/instructions/collection/updateCollection.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { 3 | updateCollectionV1, 4 | UpdateCollectionV1InstructionDataArgs, 5 | } from '../../generated'; 6 | 7 | export type UpdateCollectionArgs = Omit< 8 | Parameters[1], 9 | 'newName' | 'newUri' 10 | > & { 11 | name?: UpdateCollectionV1InstructionDataArgs['newName']; 12 | uri?: UpdateCollectionV1InstructionDataArgs['newUri']; 13 | }; 14 | 15 | export const updateCollection = ( 16 | context: Pick, 17 | { name, uri, ...args }: UpdateCollectionArgs 18 | ) => 19 | updateCollectionV1(context, { 20 | ...args, 21 | newName: name, 22 | newUri: uri, 23 | }); 24 | -------------------------------------------------------------------------------- /clients/js/src/instructions/collection/updateCollectionPlugin.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { 3 | updateCollectionPluginV1, 4 | updateCollectionExternalPluginAdapterV1, 5 | } from '../../generated'; 6 | import { 7 | createExternalPluginAdapterUpdateInfo, 8 | createPluginV2, 9 | externalPluginAdapterKeyToBase, 10 | isExternalPluginAdapterType, 11 | CollectionAllPluginArgsV2, 12 | } from '../../plugins'; 13 | import { ExternalPluginAdapterUpdateInfoArgs } from '../../plugins/externalPluginAdapters'; 14 | 15 | export type UpdateCollectionPluginArgsPlugin = 16 | | CollectionAllPluginArgsV2 17 | | ExternalPluginAdapterUpdateInfoArgs; 18 | 19 | export type UpdateCollectionPluginArgs = Omit< 20 | Parameters[1], 21 | 'plugin' 22 | > & { 23 | plugin: UpdateCollectionPluginArgsPlugin; 24 | }; 25 | 26 | export const updateCollectionPlugin = ( 27 | context: Pick, 28 | { plugin, ...args }: UpdateCollectionPluginArgs 29 | ) => { 30 | if (isExternalPluginAdapterType(plugin)) { 31 | const plug = plugin as ExternalPluginAdapterUpdateInfoArgs; 32 | return updateCollectionExternalPluginAdapterV1(context, { 33 | ...args, 34 | updateInfo: createExternalPluginAdapterUpdateInfo(plug), 35 | key: externalPluginAdapterKeyToBase(plug.key), 36 | }); 37 | } 38 | 39 | return updateCollectionPluginV1(context, { 40 | ...args, 41 | plugin: createPluginV2(plugin as CollectionAllPluginArgsV2), 42 | }); 43 | }; 44 | -------------------------------------------------------------------------------- /clients/js/src/instructions/errors.ts: -------------------------------------------------------------------------------- 1 | export const ERR_CANNOT_DELEGATE = 2 | 'Cannot delegate. The target delegate is already either a plugin authority or the asset owner'; 3 | export const ERR_CANNOT_REVOKE = 4 | 'Cannot revoke. Either no plugins defined or the plugin authority is already the asset owner'; 5 | -------------------------------------------------------------------------------- /clients/js/src/instructions/index.ts: -------------------------------------------------------------------------------- 1 | export * from './legacyDelegate'; 2 | export * from './legacyRevoke'; 3 | export * from './freeze'; 4 | export * from './create'; 5 | export * from './update'; 6 | export * from './transfer'; 7 | export * from './burn'; 8 | export * from './addPlugin'; 9 | export * from './removePlugin'; 10 | export * from './updatePlugin'; 11 | export * from './approvePluginAuthority'; 12 | export * from './revokePluginAuthority'; 13 | export * from './collection'; 14 | export * from './writeData'; 15 | export * from './execute'; 16 | -------------------------------------------------------------------------------- /clients/js/src/instructions/removePlugin.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { 3 | removePluginV1, 4 | removeExternalPluginAdapterV1, 5 | PluginType, 6 | } from '../generated'; 7 | import { isExternalPluginAdapterType } from '../plugins'; 8 | import { 9 | ExternalPluginAdapterKey, 10 | externalPluginAdapterKeyToBase, 11 | } from '../plugins/externalPluginAdapterKey'; 12 | 13 | export type RemovePluginArgsPlugin = 14 | | { 15 | type: Exclude; 16 | } 17 | | ExternalPluginAdapterKey; 18 | 19 | export type RemovePluginArgs = Omit< 20 | Parameters[1], 21 | 'pluginType' 22 | > & { 23 | plugin: RemovePluginArgsPlugin; 24 | }; 25 | 26 | export const removePlugin = ( 27 | context: Pick, 28 | { plugin, ...args }: RemovePluginArgs 29 | ) => { 30 | if (isExternalPluginAdapterType(plugin)) { 31 | return removeExternalPluginAdapterV1(context, { 32 | ...args, 33 | key: externalPluginAdapterKeyToBase(plugin as ExternalPluginAdapterKey), 34 | }); 35 | } 36 | 37 | return removePluginV1(context, { 38 | ...args, 39 | pluginType: PluginType[plugin.type as keyof typeof PluginType], 40 | }); 41 | }; 42 | -------------------------------------------------------------------------------- /clients/js/src/instructions/revokePluginAuthority.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { revokePluginAuthorityV1, PluginType } from '../generated'; 3 | 4 | export type RevokePluginAuthorityArgsPlugin = { 5 | type: keyof typeof PluginType; 6 | }; 7 | 8 | export type RevokePluginAuthorityArgs = Omit< 9 | Parameters[1], 10 | 'pluginType' 11 | > & { 12 | plugin: RevokePluginAuthorityArgsPlugin; 13 | }; 14 | 15 | export const revokePluginAuthority = ( 16 | context: Pick, 17 | { plugin, ...args }: RevokePluginAuthorityArgs 18 | ) => 19 | revokePluginAuthorityV1(context, { 20 | ...args, 21 | pluginType: PluginType[plugin.type as keyof typeof PluginType], 22 | }); 23 | -------------------------------------------------------------------------------- /clients/js/src/instructions/transfer.ts: -------------------------------------------------------------------------------- 1 | import { Context, publicKey } from '@metaplex-foundation/umi'; 2 | import { CollectionV1, transferV1, AssetV1 } from '../generated'; 3 | import { findExtraAccounts } from '../plugins'; 4 | import { deriveExternalPluginAdapters } from '../helpers'; 5 | 6 | export type TransferArgs = Omit< 7 | Parameters[1], 8 | 'asset' | 'collection' 9 | > & { 10 | asset: Pick; 11 | collection?: Pick; 12 | }; 13 | 14 | export const transfer = ( 15 | context: Pick, 16 | { asset, collection, ...args }: TransferArgs 17 | ) => { 18 | const derivedExternalPluginAdapters = deriveExternalPluginAdapters( 19 | asset, 20 | collection 21 | ); 22 | 23 | const extraAccounts = findExtraAccounts( 24 | context, 25 | 'transfer', 26 | derivedExternalPluginAdapters, 27 | { 28 | asset: asset.publicKey, 29 | collection: collection?.publicKey, 30 | owner: asset.owner, 31 | recipient: publicKey(args.newOwner), 32 | } 33 | ); 34 | 35 | return transferV1(context, { 36 | ...args, 37 | asset: asset.publicKey, 38 | collection: collection?.publicKey, 39 | }).addRemainingAccounts(extraAccounts); 40 | }; 41 | -------------------------------------------------------------------------------- /clients/js/src/instructions/update.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { 3 | CollectionV1, 4 | AssetV1, 5 | UpdateV2InstructionDataArgs, 6 | updateV2, 7 | } from '../generated'; 8 | import { findExtraAccounts } from '../plugins'; 9 | import { deriveExternalPluginAdapters } from '../helpers'; 10 | 11 | export type UpdateArgs = Omit< 12 | Parameters[1], 13 | 'asset' | 'collection' | 'newName' | 'newUri' 14 | > & { 15 | asset: Pick; 16 | collection?: Pick; 17 | name?: UpdateV2InstructionDataArgs['newName']; 18 | uri?: UpdateV2InstructionDataArgs['newUri']; 19 | }; 20 | 21 | export const update = ( 22 | context: Pick, 23 | { asset, collection, name, uri, ...args }: UpdateArgs 24 | ) => { 25 | const derivedExternalPluginAdapters = deriveExternalPluginAdapters( 26 | asset, 27 | collection 28 | ); 29 | 30 | const extraAccounts = findExtraAccounts( 31 | context, 32 | 'update', 33 | derivedExternalPluginAdapters, 34 | { 35 | asset: asset.publicKey, 36 | collection: collection?.publicKey, 37 | owner: asset.owner, 38 | } 39 | ); 40 | 41 | return updateV2(context, { 42 | ...args, 43 | asset: asset.publicKey, 44 | collection: collection?.publicKey, 45 | newName: name, 46 | newUri: uri, 47 | }).addRemainingAccounts(extraAccounts); 48 | }; 49 | -------------------------------------------------------------------------------- /clients/js/src/instructions/updatePlugin.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { updatePluginV1, updateExternalPluginAdapterV1 } from '../generated'; 3 | import { 4 | createExternalPluginAdapterUpdateInfo, 5 | createPluginV2, 6 | externalPluginAdapterKeyToBase, 7 | isExternalPluginAdapterType, 8 | AssetAllPluginArgsV2, 9 | } from '../plugins'; 10 | import { ExternalPluginAdapterUpdateInfoArgs } from '../plugins/externalPluginAdapters'; 11 | 12 | export type UpdatePluginArgsPlugin = 13 | | AssetAllPluginArgsV2 14 | | ExternalPluginAdapterUpdateInfoArgs; 15 | 16 | export type UpdatePluginArgs = Omit< 17 | Parameters[1], 18 | 'plugin' 19 | > & { 20 | plugin: UpdatePluginArgsPlugin; 21 | }; 22 | 23 | export const updatePlugin = ( 24 | context: Pick, 25 | { plugin, ...args }: UpdatePluginArgs 26 | ) => { 27 | if (isExternalPluginAdapterType(plugin)) { 28 | const plug = plugin as ExternalPluginAdapterUpdateInfoArgs; 29 | return updateExternalPluginAdapterV1(context, { 30 | ...args, 31 | updateInfo: createExternalPluginAdapterUpdateInfo(plug), 32 | key: externalPluginAdapterKeyToBase(plug.key), 33 | }); 34 | } 35 | 36 | return updatePluginV1(context, { 37 | ...args, 38 | plugin: createPluginV2(plugin as AssetAllPluginArgsV2), 39 | }); 40 | }; 41 | -------------------------------------------------------------------------------- /clients/js/src/instructions/writeData.ts: -------------------------------------------------------------------------------- 1 | import { Context } from '@metaplex-foundation/umi'; 2 | import { 3 | writeExternalPluginAdapterDataV1, 4 | WriteExternalPluginAdapterDataV1InstructionArgs, 5 | WriteExternalPluginAdapterDataV1InstructionAccounts, 6 | } from '../generated'; 7 | import { 8 | ExternalPluginAdapterKey, 9 | externalPluginAdapterKeyToBase, 10 | } from '../plugins'; 11 | 12 | export type WriteDataArgs = Omit< 13 | WriteExternalPluginAdapterDataV1InstructionArgs, 14 | 'key' 15 | > & { 16 | key: ExternalPluginAdapterKey; 17 | }; 18 | 19 | export const writeData = ( 20 | context: Pick, 21 | args: WriteDataArgs & WriteExternalPluginAdapterDataV1InstructionAccounts 22 | ) => { 23 | const { key, ...rest } = args; 24 | return writeExternalPluginAdapterDataV1(context, { 25 | ...rest, 26 | key: externalPluginAdapterKeyToBase(key), 27 | }); 28 | }; 29 | -------------------------------------------------------------------------------- /clients/js/src/plugin.ts: -------------------------------------------------------------------------------- 1 | import { UmiPlugin } from '@metaplex-foundation/umi'; 2 | import { createMplCoreProgram } from './generated'; 3 | 4 | export const mplCore = (): UmiPlugin => ({ 5 | install(umi) { 6 | umi.programs.add(createMplCoreProgram(), false); 7 | }, 8 | }); 9 | -------------------------------------------------------------------------------- /clients/js/src/plugins/externalPluginAdapterKey.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from '@metaplex-foundation/umi'; 2 | import { BaseExternalPluginAdapterKey } from '../generated'; 3 | import { PluginAuthority, pluginAuthorityToBase } from './pluginAuthority'; 4 | import { LinkedDataKey, linkedDataKeyToBase } from './linkedDataKey'; 5 | 6 | export type ExternalPluginAdapterKey = 7 | | { 8 | type: 'LifecycleHook'; 9 | hookedProgram: PublicKey; 10 | } 11 | | { 12 | type: 'Oracle'; 13 | baseAddress: PublicKey; 14 | } 15 | | { 16 | type: 'AppData'; 17 | dataAuthority: PluginAuthority; 18 | } 19 | | { 20 | type: 'LinkedLifecycleHook'; 21 | dataAuthority: PublicKey; 22 | } 23 | | { 24 | type: 'LinkedAppData'; 25 | dataAuthority: PluginAuthority; 26 | } 27 | | { type: 'DataSection'; parentKey: LinkedDataKey }; 28 | 29 | export function externalPluginAdapterKeyToBase( 30 | e: ExternalPluginAdapterKey 31 | ): BaseExternalPluginAdapterKey { 32 | switch (e.type) { 33 | case 'Oracle': 34 | return { 35 | __kind: e.type, 36 | fields: [e.baseAddress], 37 | }; 38 | case 'AppData': 39 | case 'LinkedAppData': 40 | return { 41 | __kind: e.type, 42 | fields: [pluginAuthorityToBase(e.dataAuthority)], 43 | }; 44 | case 'LifecycleHook': 45 | return { 46 | __kind: e.type, 47 | fields: [e.hookedProgram], 48 | }; 49 | case 'DataSection': 50 | return { 51 | __kind: e.type, 52 | fields: [linkedDataKeyToBase(e.parentKey)], 53 | }; 54 | default: 55 | throw new Error('Unknown ExternalPluginAdapterKey type'); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /clients/js/src/plugins/externalPluginAdapterManifest.ts: -------------------------------------------------------------------------------- 1 | import { ExternalRegistryRecord } from '../generated'; 2 | import { ExternalPluginAdapterTypeString } from './externalPluginAdapters'; 3 | 4 | export type ExternalPluginAdapterManifest< 5 | T extends Object, 6 | Base extends Object, 7 | Init extends Object, 8 | InitBase extends Object, 9 | Update extends Object, 10 | UpdateBase extends Object, 11 | > = { 12 | type: ExternalPluginAdapterTypeString; 13 | fromBase: ( 14 | input: Base, 15 | record: ExternalRegistryRecord, 16 | account: Uint8Array 17 | ) => T; 18 | initToBase: (input: Init) => InitBase; 19 | updateToBase: (input: Update) => UpdateBase; 20 | }; 21 | -------------------------------------------------------------------------------- /clients/js/src/plugins/index.ts: -------------------------------------------------------------------------------- 1 | export * from './royalties'; 2 | export * from './lib'; 3 | export * from './appData'; 4 | export * from './lifecycleChecks'; 5 | export * from './lifecycleHook'; 6 | export * from './oracle'; 7 | export * from './externalPluginAdapterKey'; 8 | export * from './externalPluginAdapterManifest'; 9 | export * from './pluginAuthority'; 10 | export * from './types'; 11 | export * from './externalPluginAdapters'; 12 | export * from './updateAuthority'; 13 | export * from './seed'; 14 | export * from './extraAccount'; 15 | export * from './validationResultsOffset'; 16 | export * from './linkedLifecycleHook'; 17 | export * from './linkedAppData'; 18 | export * from './dataSection'; 19 | export * from './linkedDataKey'; 20 | export * from './masterEdition'; 21 | -------------------------------------------------------------------------------- /clients/js/src/plugins/linkedDataKey.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from '@metaplex-foundation/umi'; 2 | 3 | import { 4 | PluginAuthority, 5 | pluginAuthorityFromBase, 6 | pluginAuthorityToBase, 7 | } from './pluginAuthority'; 8 | import { BaseLinkedDataKey } from '../generated'; 9 | 10 | export type LinkedDataKey = 11 | | { 12 | type: 'LinkedLifecycleHook'; 13 | hookedProgram: PublicKey; 14 | } 15 | | { 16 | type: 'LinkedAppData'; 17 | dataAuthority: PluginAuthority; 18 | }; 19 | 20 | export function linkedDataKeyToBase(e: LinkedDataKey): BaseLinkedDataKey { 21 | switch (e.type) { 22 | case 'LinkedLifecycleHook': 23 | return { 24 | __kind: e.type, 25 | fields: [e.hookedProgram], 26 | }; 27 | case 'LinkedAppData': 28 | return { 29 | __kind: e.type, 30 | fields: [pluginAuthorityToBase(e.dataAuthority)], 31 | }; 32 | default: 33 | throw new Error('Unknown LinkedDataKey type'); 34 | } 35 | } 36 | 37 | export function linkedDataKeyFromBase(e: BaseLinkedDataKey): LinkedDataKey { 38 | switch (e.__kind) { 39 | case 'LinkedLifecycleHook': 40 | return { 41 | type: e.__kind, 42 | hookedProgram: e.fields[0], 43 | }; 44 | case 'LinkedAppData': 45 | return { 46 | type: e.__kind, 47 | dataAuthority: pluginAuthorityFromBase(e.fields[0]), 48 | }; 49 | default: 50 | throw new Error('Unknown LinkedDataKey type'); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /clients/js/src/plugins/masterEdition.ts: -------------------------------------------------------------------------------- 1 | import { BaseMasterEdition } from '../generated'; 2 | import { someOrNone, unwrapOption } from '../utils'; 3 | 4 | export type MasterEdition = { 5 | maxSupply?: number; 6 | name?: string; 7 | uri?: string; 8 | }; 9 | 10 | export type MasterEditionArgs = MasterEdition; 11 | 12 | export function masterEditionToBase(s: MasterEdition): BaseMasterEdition { 13 | return { 14 | maxSupply: someOrNone(s.maxSupply), 15 | name: someOrNone(s.name), 16 | uri: someOrNone(s.uri), 17 | }; 18 | } 19 | 20 | export function masterEditionFromBase(s: BaseMasterEdition): MasterEdition { 21 | return { 22 | maxSupply: unwrapOption(s.maxSupply), 23 | name: unwrapOption(s.name), 24 | uri: unwrapOption(s.uri), 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /clients/js/src/plugins/pluginAuthority.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from '@metaplex-foundation/umi'; 2 | import { BasePluginAuthority } from '../generated'; 3 | 4 | export type PluginAuthority = { 5 | type: PluginAuthorityType; 6 | address?: PublicKey; 7 | }; 8 | 9 | export type PluginAuthorityType = BasePluginAuthority['__kind']; 10 | 11 | export function pluginAuthorityToBase(u: PluginAuthority): BasePluginAuthority { 12 | if (u.type === 'Address') { 13 | return { 14 | __kind: 'Address', 15 | address: u.address as PublicKey, 16 | }; 17 | } 18 | return { 19 | __kind: u.type, 20 | }; 21 | } 22 | 23 | export function pluginAuthorityFromBase( 24 | authority: BasePluginAuthority 25 | ): PluginAuthority { 26 | return { 27 | type: authority.__kind, 28 | address: (authority as any).address, 29 | }; 30 | } 31 | export function comparePluginAuthorities( 32 | a: PluginAuthority, 33 | b: PluginAuthority 34 | ): boolean { 35 | if (a.type !== b.type) { 36 | return false; 37 | } 38 | 39 | return a.address === b.address; 40 | } 41 | -------------------------------------------------------------------------------- /clients/js/src/plugins/seed.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from '@metaplex-foundation/umi'; 2 | import { BaseSeed } from '../generated'; 3 | import { RenameToType } from '../utils'; 4 | 5 | export type Seed = 6 | | Exclude, { type: 'Address' } | { type: 'Bytes' }> 7 | | { 8 | type: 'Address'; 9 | pubkey: PublicKey; 10 | } 11 | | { 12 | type: 'Bytes'; 13 | bytes: Uint8Array; 14 | }; 15 | 16 | export function seedToBase(s: Seed): BaseSeed { 17 | if (s.type === 'Address') { 18 | return { 19 | __kind: 'Address', 20 | fields: [s.pubkey], 21 | }; 22 | } 23 | 24 | if (s.type === 'Bytes') { 25 | return { 26 | __kind: 'Bytes', 27 | fields: [s.bytes], 28 | }; 29 | } 30 | return { 31 | __kind: s.type, 32 | }; 33 | } 34 | 35 | export function seedFromBase(s: BaseSeed): Seed { 36 | if (s.__kind === 'Address') { 37 | return { 38 | type: 'Address', 39 | pubkey: s.fields[0], 40 | }; 41 | } 42 | if (s.__kind === 'Bytes') { 43 | return { 44 | type: 'Bytes', 45 | bytes: s.fields[0], 46 | }; 47 | } 48 | return { 49 | type: s.__kind, 50 | }; 51 | } 52 | -------------------------------------------------------------------------------- /clients/js/src/plugins/updateAuthority.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from '@metaplex-foundation/umi'; 2 | import { BaseUpdateAuthority } from '../generated'; 3 | 4 | export type UpdateAuthorityType = BaseUpdateAuthority['__kind']; 5 | 6 | export type UpdateAuthority = { 7 | type: UpdateAuthorityType; 8 | address?: PublicKey; 9 | }; 10 | 11 | export function updateAuthorityToBase(u: UpdateAuthority): BaseUpdateAuthority { 12 | if (u.type === 'None') { 13 | return { 14 | __kind: 'None', 15 | }; 16 | } 17 | return { 18 | __kind: u.type, 19 | fields: [u.address as PublicKey], 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /clients/js/src/plugins/validationResultsOffset.ts: -------------------------------------------------------------------------------- 1 | import { BaseValidationResultsOffset } from '../generated'; 2 | 3 | export type ValidationResultsOffset = 4 | | { type: 'NoOffset' } 5 | | { type: 'Anchor' } 6 | | { type: 'Custom'; offset: bigint }; 7 | 8 | export function validationResultsOffsetToBase( 9 | e: ValidationResultsOffset 10 | ): BaseValidationResultsOffset { 11 | if (e.type === 'Custom') { 12 | return { 13 | __kind: 'Custom', 14 | fields: [e.offset], 15 | }; 16 | } 17 | 18 | return { 19 | __kind: e.type, 20 | }; 21 | } 22 | 23 | export function validationResultsOffsetFromBase( 24 | e: BaseValidationResultsOffset 25 | ): ValidationResultsOffset { 26 | if (e.__kind === 'Custom') { 27 | return { 28 | type: 'Custom', 29 | offset: e.fields[0], 30 | }; 31 | } 32 | 33 | return { 34 | type: e.__kind, 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /clients/js/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { none, Option, some } from '@metaplex-foundation/umi'; 2 | 3 | export type RenameField = Omit< 4 | T, 5 | K 6 | > & 7 | (undefined extends T[K] ? { [P in R]?: T[K] } : { [P in R]: T[K] }); 8 | 9 | export type RenameToType = T extends T 10 | ? RenameField 11 | : never; 12 | 13 | export function toWords(str: string) { 14 | const camelCaseRegex = /([a-z0-9])([A-Z])/g; 15 | return str.replace(camelCaseRegex, '$1 $2'); 16 | } 17 | 18 | export function capitalizeFirstLetter(str: string) { 19 | return str.charAt(0).toUpperCase() + str.slice(1); 20 | } 21 | 22 | export function lowercaseFirstLetter(str: string) { 23 | return str.charAt(0).toLowerCase() + str.slice(1); 24 | } 25 | 26 | export function someOrNone(value: T | undefined): Option { 27 | return value !== undefined ? some(value) : none(); 28 | } 29 | 30 | export function unwrapOption(value: Option): T | undefined { 31 | return value.__option === 'Some' ? value.value : undefined; 32 | } 33 | -------------------------------------------------------------------------------- /clients/js/test/collection.test.ts: -------------------------------------------------------------------------------- 1 | import { generateSigner } from '@metaplex-foundation/umi'; 2 | import test from 'ava'; 3 | import { Key, getCollectionV1GpaBuilder } from '../src'; 4 | import { createUmi, createCollection } from './_setupRaw'; 5 | 6 | test('it can gpa fetch collections by updateAuthority', async (t) => { 7 | // Given a Umi instance and a new signer. 8 | const umi = await createUmi(); 9 | const updateAuthority = generateSigner(umi); 10 | await createCollection(umi, { 11 | name: 'collection1', 12 | updateAuthority: updateAuthority.publicKey, 13 | }); 14 | await createCollection(umi, { 15 | name: 'collection2', 16 | updateAuthority: updateAuthority.publicKey, 17 | }); 18 | await createCollection(umi, {}); 19 | 20 | const collections = await getCollectionV1GpaBuilder(umi) 21 | .whereField('updateAuthority', updateAuthority.publicKey) 22 | .whereField('key', Key.CollectionV1) 23 | .getDeserialized(); 24 | const names = ['collection1', 'collection2']; 25 | 26 | t.is(collections.length, 2); 27 | t.assert( 28 | collections.every((collectionV1) => names.includes(collectionV1.name)) 29 | ); 30 | t.assert( 31 | collections.every( 32 | (collectionV1) => 33 | collectionV1.updateAuthority === updateAuthority.publicKey 34 | ) 35 | ); 36 | }); 37 | -------------------------------------------------------------------------------- /clients/js/test/collectionSize.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { burnV1, fetchCollectionV1 } from '../src'; 3 | import { createUmi, createCollection, createAsset } from './_setupRaw'; 4 | 5 | test('it can burn an asset which is the part of a collection', async (t) => { 6 | // Given a Umi instance and a new signer. 7 | const umi = await createUmi(); 8 | 9 | const collection = await createCollection(umi, {}); 10 | 11 | const asset1 = await createAsset(umi, { 12 | collection: collection.publicKey, 13 | }); 14 | 15 | const asset2 = await createAsset(umi, { 16 | collection: collection.publicKey, 17 | }); 18 | 19 | const collectionAfterMinting = await fetchCollectionV1( 20 | umi, 21 | collection.publicKey 22 | ); 23 | t.is(collectionAfterMinting.currentSize, 2); 24 | t.is(collectionAfterMinting.numMinted, 2); 25 | 26 | await burnV1(umi, { 27 | asset: asset1.publicKey, 28 | collection: collection.publicKey, 29 | }).sendAndConfirm(umi); 30 | 31 | await burnV1(umi, { 32 | asset: asset2.publicKey, 33 | collection: collection.publicKey, 34 | }).sendAndConfirm(umi); 35 | 36 | const collectionAfterBurning = await fetchCollectionV1( 37 | umi, 38 | collection.publicKey 39 | ); 40 | t.is(collectionAfterBurning.currentSize, 0); 41 | t.is(collectionAfterMinting.numMinted, 2); 42 | }); 43 | -------------------------------------------------------------------------------- /clients/js/test/getProgram.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { MPL_CORE_PROGRAM_ID } from '../src'; 3 | import { createUmi } from './_setupRaw'; 4 | 5 | test('it registers the program', async (t) => { 6 | // Given a Umi instance using the project's plugin. 7 | const umi = await createUmi(); 8 | 9 | // When we fetch the registered program. 10 | const program = umi.programs.get('mplCore'); 11 | 12 | // Then we expect it to be the same as the program ID constant. 13 | t.true(program.publicKey === MPL_CORE_PROGRAM_ID); 14 | }); 15 | -------------------------------------------------------------------------------- /clients/js/test/plugins/asset/bubblegumV2.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { createPlugin, addPluginV1 } from '../../../src'; 3 | import { createUmi } from '../../_setupRaw'; 4 | import { createAsset } from '../../_setupSdk'; 5 | 6 | test('it cannot create asset with BubblegumV2 plugin', async (t) => { 7 | const umi = await createUmi(); 8 | const result = createAsset(umi, { 9 | plugins: [ 10 | { 11 | type: 'BubblegumV2', 12 | }, 13 | ], 14 | }); 15 | 16 | await t.throwsAsync(result, { 17 | name: 'InvalidPlugin', 18 | }); 19 | }); 20 | 21 | test('it cannot add BubblegumV2 to asset', async (t) => { 22 | const umi = await createUmi(); 23 | const asset = await createAsset(umi); 24 | 25 | const result = addPluginV1(umi, { 26 | asset: asset.publicKey, 27 | plugin: createPlugin({ 28 | type: 'BubblegumV2', 29 | }), 30 | }).sendAndConfirm(umi); 31 | 32 | await t.throwsAsync(result, { 33 | name: 'InvalidAuthority', 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /clients/js/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist", 4 | "baseUrl": ".", 5 | "rootDir": ".", 6 | "target": "ES2020", 7 | "module": "commonjs", 8 | "sourceMap": true, 9 | "declaration": true, 10 | "declarationMap": false, 11 | "removeComments": false, 12 | "moduleResolution": "node", 13 | "noEmit": false, 14 | "preserveWatchOutput": true, 15 | "emitDeclarationOnly": false, 16 | "importHelpers": false, 17 | "strict": true, 18 | "noUnusedLocals": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "downlevelIteration": true, 21 | "esModuleInterop": true, 22 | "allowSyntheticDefaultImports": true, 23 | "incremental": false, 24 | "resolveJsonModule": true, 25 | "skipLibCheck": true, 26 | "useUnknownInCatchVariables": false 27 | }, 28 | "include": ["src", "test", "bench"], 29 | "exclude": ["node_modules", "dist", "build", "lib"] 30 | } 31 | -------------------------------------------------------------------------------- /clients/js/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"], 3 | "includeVersion": true, 4 | "readme": "none", 5 | "out": "docs" 6 | } 7 | -------------------------------------------------------------------------------- /clients/rust/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to the Rust client 2 | 3 | This is a quick guide to help you contribute to the Rust client of Mpl Core. 4 | 5 | ## Getting started 6 | 7 | To build and test the Rust client, you can use `cargo`. 8 | 9 | ```sh 10 | # Build the client 11 | cargo build 12 | 13 | # Test the client (requires building the program first) 14 | cargo test-sbf --sbf-out-dir ../../programs/.bin 15 | ``` 16 | 17 | When something changes in the program(s), make sure to run `pnpm generate` in the root directory, to re-generate the clients accordingly. 18 | 19 | ## Publishing the Rust client 20 | 21 | You can publish a new version of the Rust client crate by manually dispatching the "Publish Rust Client" workflow in the GitHub Actions tab of the repository. 22 | 23 | ![Click on the "Actions" tab, then on the "Publish Rust Client" workflow, then on the "Run workflow" dropdown. Select your options before clicking on the final "Run workflow" button inside the dropdown body.](https://user-images.githubusercontent.com/3642397/235444901-6ee95f30-ed84-4eef-b1c4-8b8474ab82a4.png) 24 | 25 | For this to work, some initial setup is required on the repository as explained below. 26 | 27 | ## Setting up GitHub actions 28 | 29 | To publish Rust clients using GitHub actions, we first need the following secret variable to be set up on the repository. 30 | 31 | - `CRATES_TOKEN` — An access token that can publish your packages to [crates.io](https://crates.io). 32 | -------------------------------------------------------------------------------- /clients/rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | description = "A flexible digital asset standard for Solana" 3 | edition = "2021" 4 | license-file = "../../LICENSE" 5 | name = "mpl-core" 6 | readme = "README.md" 7 | repository = "https://github.com/metaplex-foundation/mpl-core" 8 | version = "0.10.0" 9 | 10 | [lib] 11 | crate-type = ["cdylib", "lib"] 12 | 13 | [features] 14 | anchor = ["dep:anchor-lang", "kaigan/anchor"] 15 | serde = ["dep:serde", "dep:serde_with"] 16 | test-sbf = [] 17 | 18 | [dependencies] 19 | anchor-lang = { version = "0.30.0", optional = true } 20 | base64 = "0.22.0" 21 | borsh = "^0.10" 22 | modular-bitfield = "0.11.2" 23 | num-derive = "^0.3" 24 | num-traits = "^0.2" 25 | rmp-serde = "1.0" 26 | serde = { version = "^1.0", features = ["derive"], optional = true } 27 | serde_json = "1.0" 28 | serde_with = { version = "^3.0", optional = true } 29 | solana-program = "> 1.14" 30 | thiserror = "^1.0" 31 | 32 | kaigan = { version = "0.2.6", features = ["serde"], optional = false } 33 | 34 | [dev-dependencies] 35 | assert_matches = "1.5.0" 36 | solana-program-test = "> 1.14" 37 | solana-sdk = "> 1.14" 38 | -------------------------------------------------------------------------------- /clients/rust/README.md: -------------------------------------------------------------------------------- 1 | # Rust client SDK for Mpl Core 2 | 3 | An autogenerated Rust client SDK for the project. 4 | 5 | ## Getting started 6 | 7 | From your project folder: 8 | 9 | ```bash 10 | cargo add mpl-core 11 | ``` 12 | 13 | ## Structure 14 | 15 | The client SDK is divided into several modules: 16 | 17 | - `accounts`: structs representing the accounts of the program 18 | - `errors`: enums representing the program errors 19 | - `instructions`: structs to facilitate the creation of instructions, instruction arguments and CPI instructions 20 | - `types`: structs representing types used by the program 21 | 22 | ## Contributing 23 | 24 | Check out the [Contributing Guide](./CONTRIBUTING.md) the learn more about how to contribute to this library. 25 | -------------------------------------------------------------------------------- /clients/rust/src/generated/accounts/hashed_asset_v1.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::Key; 9 | #[cfg(feature = "anchor")] 10 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 11 | #[cfg(not(feature = "anchor"))] 12 | use borsh::{BorshDeserialize, BorshSerialize}; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct HashedAssetV1 { 19 | pub key: Key, 20 | pub hash: [u8; 32], 21 | } 22 | 23 | impl HashedAssetV1 { 24 | pub const LEN: usize = 33; 25 | 26 | #[inline(always)] 27 | pub fn from_bytes(data: &[u8]) -> Result { 28 | let mut data = data; 29 | Self::deserialize(&mut data) 30 | } 31 | } 32 | 33 | impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for HashedAssetV1 { 34 | type Error = std::io::Error; 35 | 36 | fn try_from( 37 | account_info: &solana_program::account_info::AccountInfo<'a>, 38 | ) -> Result { 39 | let mut data: &[u8] = &(*account_info.data).borrow(); 40 | Self::deserialize(&mut data) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /clients/rust/src/generated/accounts/mod.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | pub(crate) mod r#asset_signer; 9 | pub(crate) mod r#base_asset_v1; 10 | pub(crate) mod r#base_collection_v1; 11 | pub(crate) mod r#hashed_asset_v1; 12 | pub(crate) mod r#plugin_header_v1; 13 | pub(crate) mod r#plugin_registry_v1; 14 | 15 | pub use self::r#asset_signer::*; 16 | pub use self::r#base_asset_v1::*; 17 | pub use self::r#base_collection_v1::*; 18 | pub use self::r#hashed_asset_v1::*; 19 | pub use self::r#plugin_header_v1::*; 20 | pub use self::r#plugin_registry_v1::*; 21 | -------------------------------------------------------------------------------- /clients/rust/src/generated/accounts/plugin_header_v1.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::Key; 9 | #[cfg(feature = "anchor")] 10 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 11 | #[cfg(not(feature = "anchor"))] 12 | use borsh::{BorshDeserialize, BorshSerialize}; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct PluginHeaderV1 { 19 | pub key: Key, 20 | pub plugin_registry_offset: u64, 21 | } 22 | 23 | impl PluginHeaderV1 { 24 | pub const LEN: usize = 9; 25 | 26 | #[inline(always)] 27 | pub fn from_bytes(data: &[u8]) -> Result { 28 | let mut data = data; 29 | Self::deserialize(&mut data) 30 | } 31 | } 32 | 33 | impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for PluginHeaderV1 { 34 | type Error = std::io::Error; 35 | 36 | fn try_from( 37 | account_info: &solana_program::account_info::AccountInfo<'a>, 38 | ) -> Result { 39 | let mut data: &[u8] = &(*account_info.data).borrow(); 40 | Self::deserialize(&mut data) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /clients/rust/src/generated/accounts/plugin_registry_v1.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalRegistryRecord; 9 | use crate::generated::types::Key; 10 | use crate::generated::types::RegistryRecord; 11 | #[cfg(feature = "anchor")] 12 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 13 | #[cfg(not(feature = "anchor"))] 14 | use borsh::{BorshDeserialize, BorshSerialize}; 15 | 16 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 17 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 18 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 19 | #[derive(Clone, Debug, Eq, PartialEq)] 20 | pub struct PluginRegistryV1 { 21 | pub key: Key, 22 | pub registry: Vec, 23 | pub external_registry: Vec, 24 | } 25 | 26 | impl PluginRegistryV1 { 27 | #[inline(always)] 28 | pub fn from_bytes(data: &[u8]) -> Result { 29 | let mut data = data; 30 | Self::deserialize(&mut data) 31 | } 32 | } 33 | 34 | impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for PluginRegistryV1 { 35 | type Error = std::io::Error; 36 | 37 | fn try_from( 38 | account_info: &solana_program::account_info::AccountInfo<'a>, 39 | ) -> Result { 40 | let mut data: &[u8] = &(*account_info.data).borrow(); 41 | Self::deserialize(&mut data) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /clients/rust/src/generated/errors/mod.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | pub(crate) mod mpl_core; 9 | 10 | pub use self::mpl_core::MplCoreError; 11 | -------------------------------------------------------------------------------- /clients/rust/src/generated/mod.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | pub mod accounts; 9 | pub mod errors; 10 | pub mod instructions; 11 | pub mod programs; 12 | pub mod types; 13 | 14 | pub(crate) use programs::*; 15 | -------------------------------------------------------------------------------- /clients/rust/src/generated/programs.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use solana_program::{pubkey, pubkey::Pubkey}; 9 | 10 | /// `mpl_core` program ID. 11 | pub const MPL_CORE_ID: Pubkey = pubkey!("CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"); 12 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/add_blocker.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct AddBlocker {} 18 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/app_data.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | use crate::generated::types::PluginAuthority; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct AppData { 20 | pub data_authority: PluginAuthority, 21 | pub schema: ExternalPluginAdapterSchema, 22 | } 23 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/app_data_init_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | use crate::generated::types::PluginAuthority; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct AppDataInitInfo { 20 | pub data_authority: PluginAuthority, 21 | pub init_plugin_authority: Option, 22 | pub schema: Option, 23 | } 24 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/app_data_update_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | #[cfg(feature = "anchor")] 10 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 11 | #[cfg(not(feature = "anchor"))] 12 | use borsh::{BorshDeserialize, BorshSerialize}; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct AppDataUpdateInfo { 19 | pub schema: Option, 20 | } 21 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/attribute.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct Attribute { 18 | pub key: String, 19 | pub value: String, 20 | } 21 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/attributes.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::Attribute; 9 | #[cfg(feature = "anchor")] 10 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 11 | #[cfg(not(feature = "anchor"))] 12 | use borsh::{BorshDeserialize, BorshSerialize}; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct Attributes { 19 | pub attribute_list: Vec, 20 | } 21 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/autograph.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::AutographSignature; 9 | #[cfg(feature = "anchor")] 10 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 11 | #[cfg(not(feature = "anchor"))] 12 | use borsh::{BorshDeserialize, BorshSerialize}; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct Autograph { 19 | pub signatures: Vec, 20 | } 21 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/autograph_signature.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use solana_program::pubkey::Pubkey; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct AutographSignature { 19 | #[cfg_attr( 20 | feature = "serde", 21 | serde(with = "serde_with::As::") 22 | )] 23 | pub address: Pubkey, 24 | pub message: String, 25 | } 26 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/bubblegum_v2.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct BubblegumV2 {} 18 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/burn_delegate.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct BurnDelegate {} 18 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/compression_proof.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::HashablePluginSchema; 9 | use crate::generated::types::UpdateAuthority; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | use solana_program::pubkey::Pubkey; 15 | 16 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 17 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 18 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 19 | #[derive(Clone, Debug, Eq, PartialEq)] 20 | pub struct CompressionProof { 21 | #[cfg_attr( 22 | feature = "serde", 23 | serde(with = "serde_with::As::") 24 | )] 25 | pub owner: Pubkey, 26 | pub update_authority: UpdateAuthority, 27 | pub name: String, 28 | pub uri: String, 29 | pub seq: u64, 30 | pub plugins: Vec, 31 | } 32 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/creator.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use solana_program::pubkey::Pubkey; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct Creator { 19 | #[cfg_attr( 20 | feature = "serde", 21 | serde(with = "serde_with::As::") 22 | )] 23 | pub address: Pubkey, 24 | pub percentage: u8, 25 | } 26 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/data_section.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | use crate::generated::types::LinkedDataKey; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct DataSection { 20 | pub parent_key: LinkedDataKey, 21 | pub schema: ExternalPluginAdapterSchema, 22 | } 23 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/data_section_init_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | use crate::generated::types::LinkedDataKey; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct DataSectionInitInfo { 20 | pub parent_key: LinkedDataKey, 21 | pub schema: ExternalPluginAdapterSchema, 22 | } 23 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/data_section_update_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct DataSectionUpdateInfo {} 18 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/data_state.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use num_derive::FromPrimitive; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] 18 | pub enum DataState { 19 | AccountState, 20 | LedgerState, 21 | } 22 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/edition.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct Edition { 18 | pub number: u32, 19 | } 20 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/external_check_result.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct ExternalCheckResult { 18 | pub flags: u32, 19 | } 20 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/external_plugin_adapter.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::AppData; 9 | use crate::generated::types::DataSection; 10 | use crate::generated::types::LifecycleHook; 11 | use crate::generated::types::LinkedAppData; 12 | use crate::generated::types::LinkedLifecycleHook; 13 | use crate::generated::types::Oracle; 14 | #[cfg(feature = "anchor")] 15 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 16 | #[cfg(not(feature = "anchor"))] 17 | use borsh::{BorshDeserialize, BorshSerialize}; 18 | 19 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 20 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 21 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 22 | #[derive(Clone, Debug, Eq, PartialEq)] 23 | pub enum ExternalPluginAdapter { 24 | LifecycleHook(LifecycleHook), 25 | Oracle(Oracle), 26 | AppData(AppData), 27 | LinkedLifecycleHook(LinkedLifecycleHook), 28 | LinkedAppData(LinkedAppData), 29 | DataSection(DataSection), 30 | } 31 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/external_plugin_adapter_init_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::AppDataInitInfo; 9 | use crate::generated::types::DataSectionInitInfo; 10 | use crate::generated::types::LifecycleHookInitInfo; 11 | use crate::generated::types::LinkedAppDataInitInfo; 12 | use crate::generated::types::LinkedLifecycleHookInitInfo; 13 | use crate::generated::types::OracleInitInfo; 14 | #[cfg(feature = "anchor")] 15 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 16 | #[cfg(not(feature = "anchor"))] 17 | use borsh::{BorshDeserialize, BorshSerialize}; 18 | 19 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 20 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 21 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 22 | #[derive(Clone, Debug, Eq, PartialEq)] 23 | pub enum ExternalPluginAdapterInitInfo { 24 | LifecycleHook(LifecycleHookInitInfo), 25 | Oracle(OracleInitInfo), 26 | AppData(AppDataInitInfo), 27 | LinkedLifecycleHook(LinkedLifecycleHookInitInfo), 28 | LinkedAppData(LinkedAppDataInitInfo), 29 | DataSection(DataSectionInitInfo), 30 | } 31 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/external_plugin_adapter_key.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::LinkedDataKey; 9 | use crate::generated::types::PluginAuthority; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | use solana_program::pubkey::Pubkey; 15 | 16 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 17 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 18 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 19 | #[derive(Clone, Debug, Eq, PartialEq)] 20 | pub enum ExternalPluginAdapterKey { 21 | #[cfg_attr( 22 | feature = "serde", 23 | serde(with = "serde_with::As::") 24 | )] 25 | LifecycleHook(Pubkey), 26 | #[cfg_attr( 27 | feature = "serde", 28 | serde(with = "serde_with::As::") 29 | )] 30 | Oracle(Pubkey), 31 | AppData(PluginAuthority), 32 | #[cfg_attr( 33 | feature = "serde", 34 | serde(with = "serde_with::As::") 35 | )] 36 | LinkedLifecycleHook(Pubkey), 37 | LinkedAppData(PluginAuthority), 38 | DataSection(LinkedDataKey), 39 | } 40 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/external_plugin_adapter_schema.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use num_derive::FromPrimitive; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] 18 | pub enum ExternalPluginAdapterSchema { 19 | Binary, 20 | Json, 21 | MsgPack, 22 | } 23 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/external_plugin_adapter_type.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use num_derive::FromPrimitive; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] 18 | pub enum ExternalPluginAdapterType { 19 | LifecycleHook, 20 | Oracle, 21 | AppData, 22 | LinkedLifecycleHook, 23 | LinkedAppData, 24 | DataSection, 25 | } 26 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/external_plugin_adapter_update_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::AppDataUpdateInfo; 9 | use crate::generated::types::LifecycleHookUpdateInfo; 10 | use crate::generated::types::LinkedAppDataUpdateInfo; 11 | use crate::generated::types::LinkedLifecycleHookUpdateInfo; 12 | use crate::generated::types::OracleUpdateInfo; 13 | #[cfg(feature = "anchor")] 14 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 15 | #[cfg(not(feature = "anchor"))] 16 | use borsh::{BorshDeserialize, BorshSerialize}; 17 | 18 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 19 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 20 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 21 | #[derive(Clone, Debug, Eq, PartialEq)] 22 | pub enum ExternalPluginAdapterUpdateInfo { 23 | LifecycleHook(LifecycleHookUpdateInfo), 24 | Oracle(OracleUpdateInfo), 25 | AppData(AppDataUpdateInfo), 26 | LinkedLifecycleHook(LinkedLifecycleHookUpdateInfo), 27 | LinkedAppData(LinkedAppDataUpdateInfo), 28 | } 29 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/external_registry_record.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalCheckResult; 9 | use crate::generated::types::ExternalPluginAdapterType; 10 | use crate::generated::types::HookableLifecycleEvent; 11 | use crate::generated::types::PluginAuthority; 12 | #[cfg(feature = "anchor")] 13 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 14 | #[cfg(not(feature = "anchor"))] 15 | use borsh::{BorshDeserialize, BorshSerialize}; 16 | 17 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 18 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 19 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 20 | #[derive(Clone, Debug, Eq, PartialEq)] 21 | pub struct ExternalRegistryRecord { 22 | pub plugin_type: ExternalPluginAdapterType, 23 | pub authority: PluginAuthority, 24 | pub lifecycle_checks: Option>, 25 | pub offset: u64, 26 | pub data_offset: Option, 27 | pub data_len: Option, 28 | } 29 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/external_validation_result.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use num_derive::FromPrimitive; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] 18 | pub enum ExternalValidationResult { 19 | Approved, 20 | Rejected, 21 | Pass, 22 | } 23 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/freeze_delegate.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct FreezeDelegate { 18 | pub frozen: bool, 19 | } 20 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/hashable_plugin_schema.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::Plugin; 9 | use crate::generated::types::PluginAuthority; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct HashablePluginSchema { 20 | pub index: u64, 21 | pub authority: PluginAuthority, 22 | pub plugin: Plugin, 23 | } 24 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/hashed_asset_schema.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct HashedAssetSchema { 18 | pub asset_hash: [u8; 32], 19 | pub plugin_hashes: Vec<[u8; 32]>, 20 | } 21 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/hookable_lifecycle_event.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use num_derive::FromPrimitive; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] 18 | pub enum HookableLifecycleEvent { 19 | Create, 20 | Transfer, 21 | Burn, 22 | Update, 23 | } 24 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/immutable_metadata.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct ImmutableMetadata {} 18 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/key.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use num_derive::FromPrimitive; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] 18 | pub enum Key { 19 | Uninitialized, 20 | AssetV1, 21 | HashedAssetV1, 22 | PluginHeaderV1, 23 | PluginRegistryV1, 24 | CollectionV1, 25 | } 26 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/lifecycle_hook.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | use crate::generated::types::ExtraAccount; 10 | use crate::generated::types::PluginAuthority; 11 | #[cfg(feature = "anchor")] 12 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 13 | #[cfg(not(feature = "anchor"))] 14 | use borsh::{BorshDeserialize, BorshSerialize}; 15 | use solana_program::pubkey::Pubkey; 16 | 17 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 18 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 19 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 20 | #[derive(Clone, Debug, Eq, PartialEq)] 21 | pub struct LifecycleHook { 22 | #[cfg_attr( 23 | feature = "serde", 24 | serde(with = "serde_with::As::") 25 | )] 26 | pub hooked_program: Pubkey, 27 | pub extra_accounts: Option>, 28 | pub data_authority: Option, 29 | pub schema: ExternalPluginAdapterSchema, 30 | } 31 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/lifecycle_hook_init_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalCheckResult; 9 | use crate::generated::types::ExternalPluginAdapterSchema; 10 | use crate::generated::types::ExtraAccount; 11 | use crate::generated::types::HookableLifecycleEvent; 12 | use crate::generated::types::PluginAuthority; 13 | #[cfg(feature = "anchor")] 14 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 15 | #[cfg(not(feature = "anchor"))] 16 | use borsh::{BorshDeserialize, BorshSerialize}; 17 | use solana_program::pubkey::Pubkey; 18 | 19 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 20 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 21 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 22 | #[derive(Clone, Debug, Eq, PartialEq)] 23 | pub struct LifecycleHookInitInfo { 24 | #[cfg_attr( 25 | feature = "serde", 26 | serde(with = "serde_with::As::") 27 | )] 28 | pub hooked_program: Pubkey, 29 | pub init_plugin_authority: Option, 30 | pub lifecycle_checks: Vec<(HookableLifecycleEvent, ExternalCheckResult)>, 31 | pub extra_accounts: Option>, 32 | pub data_authority: Option, 33 | pub schema: Option, 34 | } 35 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/lifecycle_hook_update_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalCheckResult; 9 | use crate::generated::types::ExternalPluginAdapterSchema; 10 | use crate::generated::types::ExtraAccount; 11 | use crate::generated::types::HookableLifecycleEvent; 12 | #[cfg(feature = "anchor")] 13 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 14 | #[cfg(not(feature = "anchor"))] 15 | use borsh::{BorshDeserialize, BorshSerialize}; 16 | 17 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 18 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 19 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 20 | #[derive(Clone, Debug, Eq, PartialEq)] 21 | pub struct LifecycleHookUpdateInfo { 22 | pub lifecycle_checks: Option>, 23 | pub extra_accounts: Option>, 24 | pub schema: Option, 25 | } 26 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/linked_app_data.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | use crate::generated::types::PluginAuthority; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct LinkedAppData { 20 | pub data_authority: PluginAuthority, 21 | pub schema: ExternalPluginAdapterSchema, 22 | } 23 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/linked_app_data_init_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | use crate::generated::types::PluginAuthority; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct LinkedAppDataInitInfo { 20 | pub data_authority: PluginAuthority, 21 | pub init_plugin_authority: Option, 22 | pub schema: Option, 23 | } 24 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/linked_app_data_update_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | #[cfg(feature = "anchor")] 10 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 11 | #[cfg(not(feature = "anchor"))] 12 | use borsh::{BorshDeserialize, BorshSerialize}; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct LinkedAppDataUpdateInfo { 19 | pub schema: Option, 20 | } 21 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/linked_data_key.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::PluginAuthority; 9 | #[cfg(feature = "anchor")] 10 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 11 | #[cfg(not(feature = "anchor"))] 12 | use borsh::{BorshDeserialize, BorshSerialize}; 13 | use solana_program::pubkey::Pubkey; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub enum LinkedDataKey { 20 | #[cfg_attr( 21 | feature = "serde", 22 | serde(with = "serde_with::As::") 23 | )] 24 | LinkedLifecycleHook(Pubkey), 25 | LinkedAppData(PluginAuthority), 26 | } 27 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/linked_lifecycle_hook.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalPluginAdapterSchema; 9 | use crate::generated::types::ExtraAccount; 10 | use crate::generated::types::PluginAuthority; 11 | #[cfg(feature = "anchor")] 12 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 13 | #[cfg(not(feature = "anchor"))] 14 | use borsh::{BorshDeserialize, BorshSerialize}; 15 | use solana_program::pubkey::Pubkey; 16 | 17 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 18 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 19 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 20 | #[derive(Clone, Debug, Eq, PartialEq)] 21 | pub struct LinkedLifecycleHook { 22 | #[cfg_attr( 23 | feature = "serde", 24 | serde(with = "serde_with::As::") 25 | )] 26 | pub hooked_program: Pubkey, 27 | pub extra_accounts: Option>, 28 | pub data_authority: Option, 29 | pub schema: ExternalPluginAdapterSchema, 30 | } 31 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/linked_lifecycle_hook_init_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalCheckResult; 9 | use crate::generated::types::ExternalPluginAdapterSchema; 10 | use crate::generated::types::ExtraAccount; 11 | use crate::generated::types::HookableLifecycleEvent; 12 | use crate::generated::types::PluginAuthority; 13 | #[cfg(feature = "anchor")] 14 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 15 | #[cfg(not(feature = "anchor"))] 16 | use borsh::{BorshDeserialize, BorshSerialize}; 17 | use solana_program::pubkey::Pubkey; 18 | 19 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 20 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 21 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 22 | #[derive(Clone, Debug, Eq, PartialEq)] 23 | pub struct LinkedLifecycleHookInitInfo { 24 | #[cfg_attr( 25 | feature = "serde", 26 | serde(with = "serde_with::As::") 27 | )] 28 | pub hooked_program: Pubkey, 29 | pub init_plugin_authority: Option, 30 | pub lifecycle_checks: Vec<(HookableLifecycleEvent, ExternalCheckResult)>, 31 | pub extra_accounts: Option>, 32 | pub data_authority: Option, 33 | pub schema: Option, 34 | } 35 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/linked_lifecycle_hook_update_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalCheckResult; 9 | use crate::generated::types::ExternalPluginAdapterSchema; 10 | use crate::generated::types::ExtraAccount; 11 | use crate::generated::types::HookableLifecycleEvent; 12 | #[cfg(feature = "anchor")] 13 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 14 | #[cfg(not(feature = "anchor"))] 15 | use borsh::{BorshDeserialize, BorshSerialize}; 16 | 17 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 18 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 19 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 20 | #[derive(Clone, Debug, Eq, PartialEq)] 21 | pub struct LinkedLifecycleHookUpdateInfo { 22 | pub lifecycle_checks: Option>, 23 | pub extra_accounts: Option>, 24 | pub schema: Option, 25 | } 26 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/master_edition.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct MasterEdition { 18 | pub max_supply: Option, 19 | pub name: Option, 20 | pub uri: Option, 21 | } 22 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/oracle.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExtraAccount; 9 | use crate::generated::types::ValidationResultsOffset; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | use solana_program::pubkey::Pubkey; 15 | 16 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 17 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 18 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 19 | #[derive(Clone, Debug, Eq, PartialEq)] 20 | pub struct Oracle { 21 | #[cfg_attr( 22 | feature = "serde", 23 | serde(with = "serde_with::As::") 24 | )] 25 | pub base_address: Pubkey, 26 | pub base_address_config: Option, 27 | pub results_offset: ValidationResultsOffset, 28 | } 29 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/oracle_init_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalCheckResult; 9 | use crate::generated::types::ExtraAccount; 10 | use crate::generated::types::HookableLifecycleEvent; 11 | use crate::generated::types::PluginAuthority; 12 | use crate::generated::types::ValidationResultsOffset; 13 | #[cfg(feature = "anchor")] 14 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 15 | #[cfg(not(feature = "anchor"))] 16 | use borsh::{BorshDeserialize, BorshSerialize}; 17 | use solana_program::pubkey::Pubkey; 18 | 19 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 20 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 21 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 22 | #[derive(Clone, Debug, Eq, PartialEq)] 23 | pub struct OracleInitInfo { 24 | #[cfg_attr( 25 | feature = "serde", 26 | serde(with = "serde_with::As::") 27 | )] 28 | pub base_address: Pubkey, 29 | pub init_plugin_authority: Option, 30 | pub lifecycle_checks: Vec<(HookableLifecycleEvent, ExternalCheckResult)>, 31 | pub base_address_config: Option, 32 | pub results_offset: Option, 33 | } 34 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/oracle_update_info.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalCheckResult; 9 | use crate::generated::types::ExtraAccount; 10 | use crate::generated::types::HookableLifecycleEvent; 11 | use crate::generated::types::ValidationResultsOffset; 12 | #[cfg(feature = "anchor")] 13 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 14 | #[cfg(not(feature = "anchor"))] 15 | use borsh::{BorshDeserialize, BorshSerialize}; 16 | 17 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 18 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 19 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 20 | #[derive(Clone, Debug, Eq, PartialEq)] 21 | pub struct OracleUpdateInfo { 22 | pub lifecycle_checks: Option>, 23 | pub base_address_config: Option, 24 | pub results_offset: Option, 25 | } 26 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/oracle_validation.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::ExternalValidationResult; 9 | #[cfg(feature = "anchor")] 10 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 11 | #[cfg(not(feature = "anchor"))] 12 | use borsh::{BorshDeserialize, BorshSerialize}; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub enum OracleValidation { 19 | Uninitialized, 20 | V1 { 21 | create: ExternalValidationResult, 22 | transfer: ExternalValidationResult, 23 | burn: ExternalValidationResult, 24 | update: ExternalValidationResult, 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/permanent_burn_delegate.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct PermanentBurnDelegate {} 18 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/permanent_freeze_delegate.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct PermanentFreezeDelegate { 18 | pub frozen: bool, 19 | } 20 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/permanent_transfer_delegate.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct PermanentTransferDelegate {} 18 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/plugin_authority.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use solana_program::pubkey::Pubkey; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub enum PluginAuthority { 19 | None, 20 | Owner, 21 | UpdateAuthority, 22 | Address { 23 | #[cfg_attr( 24 | feature = "serde", 25 | serde(with = "serde_with::As::") 26 | )] 27 | address: Pubkey, 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/plugin_authority_pair.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::Plugin; 9 | use crate::generated::types::PluginAuthority; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct PluginAuthorityPair { 20 | pub plugin: Plugin, 21 | pub authority: Option, 22 | } 23 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/plugin_type.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use num_derive::FromPrimitive; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] 18 | pub enum PluginType { 19 | Royalties, 20 | FreezeDelegate, 21 | BurnDelegate, 22 | TransferDelegate, 23 | UpdateDelegate, 24 | PermanentFreezeDelegate, 25 | Attributes, 26 | PermanentTransferDelegate, 27 | PermanentBurnDelegate, 28 | Edition, 29 | MasterEdition, 30 | AddBlocker, 31 | ImmutableMetadata, 32 | VerifiedCreators, 33 | Autograph, 34 | BubblegumV2, 35 | } 36 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/registry_record.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::PluginAuthority; 9 | use crate::generated::types::PluginType; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct RegistryRecord { 20 | pub plugin_type: PluginType, 21 | pub authority: PluginAuthority, 22 | pub offset: u64, 23 | } 24 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/royalties.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::Creator; 9 | use crate::generated::types::RuleSet; 10 | #[cfg(feature = "anchor")] 11 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 12 | #[cfg(not(feature = "anchor"))] 13 | use borsh::{BorshDeserialize, BorshSerialize}; 14 | 15 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 16 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 17 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 18 | #[derive(Clone, Debug, Eq, PartialEq)] 19 | pub struct Royalties { 20 | pub basis_points: u16, 21 | pub creators: Vec, 22 | pub rule_set: RuleSet, 23 | } 24 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/rule_set.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use solana_program::pubkey::Pubkey; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub enum RuleSet { 19 | None, 20 | #[cfg_attr( 21 | feature = "serde", 22 | serde(with = "serde_with::As::>") 23 | )] 24 | ProgramAllowList(Vec), 25 | #[cfg_attr( 26 | feature = "serde", 27 | serde(with = "serde_with::As::>") 28 | )] 29 | ProgramDenyList(Vec), 30 | } 31 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/seed.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use solana_program::pubkey::Pubkey; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub enum Seed { 19 | Collection, 20 | Owner, 21 | Recipient, 22 | Asset, 23 | #[cfg_attr( 24 | feature = "serde", 25 | serde(with = "serde_with::As::") 26 | )] 27 | Address(Pubkey), 28 | Bytes(Vec), 29 | } 30 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/transfer_delegate.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub struct TransferDelegate {} 18 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/update_authority.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use solana_program::pubkey::Pubkey; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub enum UpdateAuthority { 19 | None, 20 | #[cfg_attr( 21 | feature = "serde", 22 | serde(with = "serde_with::As::") 23 | )] 24 | Address(Pubkey), 25 | #[cfg_attr( 26 | feature = "serde", 27 | serde(with = "serde_with::As::") 28 | )] 29 | Collection(Pubkey), 30 | } 31 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/update_delegate.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use solana_program::pubkey::Pubkey; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct UpdateDelegate { 19 | #[cfg_attr( 20 | feature = "serde", 21 | serde(with = "serde_with::As::>") 22 | )] 23 | pub additional_delegates: Vec, 24 | } 25 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/update_type.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use num_derive::FromPrimitive; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] 18 | pub enum UpdateType { 19 | Mint, 20 | Add, 21 | Remove, 22 | } 23 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/validation_result.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use num_derive::FromPrimitive; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive)] 18 | pub enum ValidationResult { 19 | Approved, 20 | Rejected, 21 | Pass, 22 | ForceApproved, 23 | } 24 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/validation_results_offset.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | 13 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 14 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 15 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 16 | #[derive(Clone, Debug, Eq, PartialEq)] 17 | pub enum ValidationResultsOffset { 18 | NoOffset, 19 | Anchor, 20 | Custom(u64), 21 | } 22 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/verified_creators.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | use crate::generated::types::VerifiedCreatorsSignature; 9 | #[cfg(feature = "anchor")] 10 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 11 | #[cfg(not(feature = "anchor"))] 12 | use borsh::{BorshDeserialize, BorshSerialize}; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct VerifiedCreators { 19 | pub signatures: Vec, 20 | } 21 | -------------------------------------------------------------------------------- /clients/rust/src/generated/types/verified_creators_signature.rs: -------------------------------------------------------------------------------- 1 | //! This code was AUTOGENERATED using the kinobi library. 2 | //! Please DO NOT EDIT THIS FILE, instead use visitors 3 | //! to add features, then rerun kinobi to update it. 4 | //! 5 | //! [https://github.com/metaplex-foundation/kinobi] 6 | //! 7 | 8 | #[cfg(feature = "anchor")] 9 | use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize}; 10 | #[cfg(not(feature = "anchor"))] 11 | use borsh::{BorshDeserialize, BorshSerialize}; 12 | use solana_program::pubkey::Pubkey; 13 | 14 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] 15 | #[cfg_attr(not(feature = "anchor"), derive(BorshSerialize, BorshDeserialize))] 16 | #[cfg_attr(feature = "anchor", derive(AnchorSerialize, AnchorDeserialize))] 17 | #[derive(Clone, Debug, Eq, PartialEq)] 18 | pub struct VerifiedCreatorsSignature { 19 | #[cfg_attr( 20 | feature = "serde", 21 | serde(with = "serde_with::As::") 22 | )] 23 | pub address: Pubkey, 24 | pub verified: bool, 25 | } 26 | -------------------------------------------------------------------------------- /clients/rust/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod generated; 2 | mod hooked; 3 | mod indexable_asset; 4 | 5 | pub use generated::programs::MPL_CORE_ID as ID; 6 | pub use generated::*; 7 | pub use hooked::*; 8 | pub use indexable_asset::*; 9 | 10 | impl Copy for generated::types::Key {} 11 | -------------------------------------------------------------------------------- /configs/scripts/client/benchmark-js.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | # go to parent folder 5 | cd $(dirname $(dirname $(dirname $SCRIPT_DIR))) 6 | WORKING_DIR=$(pwd) 7 | 8 | # command-line input 9 | ARGS=$* 10 | 11 | # js client tests folder 12 | cd ${WORKING_DIR}/clients/js 13 | 14 | pnpm install && pnpm build && pnpm bench ${ARGS} -------------------------------------------------------------------------------- /configs/scripts/client/format-js.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | # go to parent folder 5 | cd $(dirname $(dirname $(dirname $SCRIPT_DIR))) 6 | WORKING_DIR=$(pwd) 7 | 8 | # command-line input 9 | ARGS=$* 10 | 11 | # js client tests folder 12 | cd ${WORKING_DIR}/clients/js 13 | 14 | pnpm install && pnpm format:fix -------------------------------------------------------------------------------- /configs/scripts/client/lint-js.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | # go to parent folder 5 | cd $(dirname $(dirname $(dirname $SCRIPT_DIR))) 6 | WORKING_DIR=$(pwd) 7 | 8 | # command-line input 9 | ARGS=$* 10 | 11 | # js client tests folder 12 | cd ${WORKING_DIR}/clients/js 13 | 14 | pnpm install && pnpm format -------------------------------------------------------------------------------- /configs/scripts/client/test-js.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | # go to parent folder 5 | cd $(dirname $(dirname $(dirname $SCRIPT_DIR))) 6 | WORKING_DIR=$(pwd) 7 | 8 | # command-line input 9 | ARGS=$* 10 | 11 | # js client tests folder 12 | cd ${WORKING_DIR}/clients/js 13 | 14 | pnpm install && pnpm build && pnpm test ${ARGS} -------------------------------------------------------------------------------- /configs/scripts/client/test-rust.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | PROGRAMS_OUTPUT="./programs/.bin" 5 | # go to parent folder 6 | cd $(dirname $(dirname $(dirname $SCRIPT_DIR))) 7 | 8 | # command-line input 9 | ARGS=$* 10 | 11 | WORKING_DIR=$(pwd) 12 | SOLFMT="solfmt" 13 | export SBF_OUT_DIR="${WORKING_DIR}/${PROGRAMS_OUTPUT}" 14 | 15 | # client SDK tests 16 | cd ${WORKING_DIR}/clients/rust 17 | 18 | if [ ! "$(command -v $SOLFMT)" = "" ]; then 19 | CARGO_TERM_COLOR=always cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${PROGRAMS_OUTPUT} ${ARGS} 2>&1 | ${SOLFMT} -- --nocapture 20 | else 21 | cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${PROGRAMS_OUTPUT} ${ARGS} -- --nocapture 22 | fi -------------------------------------------------------------------------------- /configs/scripts/program/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | OUTPUT="./programs/.bin" 5 | # saves external programs binaries to the output directory 6 | source ${SCRIPT_DIR}/dump.sh ${OUTPUT} 7 | 8 | # Oracle program used for tests and is only deployed to devnet 9 | source ${SCRIPT_DIR}/dump_oracle_example.sh ${OUTPUT} 10 | 11 | # go to parent folder 12 | cd $(dirname $(dirname $(dirname ${SCRIPT_DIR}))) 13 | 14 | if [ -z ${PROGRAMS+x} ]; then 15 | PROGRAMS="$(cat .github/.env | grep "PROGRAMS" | cut -d '=' -f 2)" 16 | fi 17 | 18 | # default to input from the command-line 19 | ARGS=$* 20 | 21 | # command-line arguments override env variable 22 | if [ ! -z "$ARGS" ]; then 23 | PROGRAMS="[\"${1}\"]" 24 | shift 25 | ARGS=$* 26 | fi 27 | 28 | PROGRAMS=$(echo ${PROGRAMS} | jq -c '.[]' | sed 's/"//g') 29 | 30 | # creates the output directory if it doesn't exist 31 | if [ ! -d ${OUTPUT} ]; then 32 | mkdir ${OUTPUT} 33 | fi 34 | 35 | WORKING_DIR=$(pwd) 36 | export SBF_OUT_DIR="${WORKING_DIR}/${OUTPUT}" 37 | 38 | for p in ${PROGRAMS[@]}; do 39 | cd ${WORKING_DIR}/programs/${p} 40 | cargo build-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} $ARGS 41 | done -------------------------------------------------------------------------------- /configs/scripts/program/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | OUTPUT="./programs/.bin" 5 | # go to parent folder 6 | cd $(dirname $(dirname $(dirname ${SCRIPT_DIR}))) 7 | 8 | rm -rf $OUTPUT 9 | 10 | if [ -z ${PROGRAMS+x} ]; then 11 | PROGRAMS="$(cat .github/.env | grep "PROGRAMS" | cut -d '=' -f 2)" 12 | fi 13 | 14 | PROGRAMS=$(echo ${PROGRAMS} | jq -c '.[]' | sed 's/"//g') 15 | WORKING_DIR=$(pwd) 16 | 17 | for p in ${PROGRAMS[@]}; do 18 | cd ${WORKING_DIR}/programs/${p} 19 | rm -rf target 20 | done -------------------------------------------------------------------------------- /configs/scripts/program/format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | OUTPUT="./programs/.bin" 5 | # go to parent folder 6 | cd $(dirname $(dirname $(dirname ${SCRIPT_DIR}))) 7 | 8 | rm -rf $OUTPUT 9 | 10 | if [ -z ${PROGRAMS+x} ]; then 11 | PROGRAMS="$(cat .github/.env | grep "PROGRAMS" | cut -d '=' -f 2)" 12 | fi 13 | 14 | PROGRAMS=$(echo ${PROGRAMS} | jq -c '.[]' | sed 's/"//g') 15 | WORKING_DIR=$(pwd) 16 | 17 | for p in ${PROGRAMS[@]}; do 18 | cargo fmt --all --manifest-path ./programs/${p}/Cargo.toml 19 | done -------------------------------------------------------------------------------- /configs/scripts/program/lint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | OUTPUT="./programs/.bin" 5 | # go to parent folder 6 | cd $(dirname $(dirname $(dirname ${SCRIPT_DIR}))) 7 | 8 | rm -rf $OUTPUT 9 | 10 | if [ -z ${PROGRAMS+x} ]; then 11 | PROGRAMS="$(cat .github/.env | grep "PROGRAMS" | cut -d '=' -f 2)" 12 | fi 13 | 14 | PROGRAMS=$(echo ${PROGRAMS} | jq -c '.[]' | sed 's/"//g') 15 | WORKING_DIR=$(pwd) 16 | 17 | for p in ${PROGRAMS[@]}; do 18 | cargo fmt --all --manifest-path ./programs/${p}/Cargo.toml -- --check 19 | done -------------------------------------------------------------------------------- /configs/scripts/program/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 4 | OUTPUT="./programs/.bin" 5 | # saves external programs binaries to the output directory 6 | source ${SCRIPT_DIR}/dump.sh ${OUTPUT} 7 | # go to parent folder 8 | cd $(dirname $(dirname $(dirname $SCRIPT_DIR))) 9 | 10 | if [ ! -z "$PROGRAM" ]; then 11 | PROGRAMS='["'${PROGRAM}'"]' 12 | fi 13 | 14 | if [ -z "$PROGRAMS" ]; then 15 | PROGRAMS="$(cat .github/.env | grep "PROGRAMS" | cut -d '=' -f 2)" 16 | fi 17 | 18 | # default to input from the command-line 19 | ARGS=$* 20 | 21 | # command-line arguments override env variable 22 | if [ ! -z "$ARGS" ]; then 23 | PROGRAMS="[\"${1}\"]" 24 | shift 25 | ARGS=$* 26 | fi 27 | 28 | PROGRAMS=$(echo $PROGRAMS | jq -c '.[]' | sed 's/"//g') 29 | 30 | WORKING_DIR=$(pwd) 31 | SOLFMT="solfmt" 32 | export SBF_OUT_DIR="${WORKING_DIR}/${OUTPUT}" 33 | 34 | for p in ${PROGRAMS[@]}; do 35 | cd ${WORKING_DIR}/programs/${p} 36 | 37 | if [ ! "$(command -v $SOLFMT)" = "" ]; then 38 | CARGO_TERM_COLOR=always cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} 2>&1 | ${SOLFMT} 39 | else 40 | RUST_LOG=error cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} 41 | fi 42 | done -------------------------------------------------------------------------------- /configs/shank.cjs: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const { generateIdl } = require("@metaplex-foundation/shank-js"); 3 | 4 | const idlDir = path.join(__dirname, "..", "idls"); 5 | const binaryInstallDir = path.join(__dirname, "..", ".crates"); 6 | const programDir = path.join(__dirname, "..", "programs"); 7 | 8 | generateIdl({ 9 | generator: "shank", 10 | programName: "mpl_core", 11 | programId: "CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d", 12 | idlDir, 13 | idlName: "mpl_core", 14 | binaryInstallDir, 15 | programDir: path.join(programDir, "mpl-core"), 16 | }); 17 | -------------------------------------------------------------------------------- /configs/validator.cjs: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | const programDir = path.join(__dirname, "..", "programs"); 4 | 5 | function getProgram(programBinary) { 6 | return path.join(programDir, ".bin", programBinary); 7 | } 8 | 9 | module.exports = { 10 | validator: { 11 | commitment: "processed", 12 | programs: [ 13 | { 14 | label: "Mpl Core", 15 | programId: "CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d", 16 | deployPath: getProgram("mpl_core_program.so"), 17 | }, 18 | { 19 | label: "Mpl Core Oracle Example", 20 | programId: "4RZ7RhXeL4oz4kVX5fpRfkNQ3nz1n4eruqBn2AGPQepo", 21 | deployPath: getProgram("mpl_core_oracle_example.so"), 22 | }, 23 | // Below are external programs that should be included in the local validator. 24 | // You may configure which ones to fetch from the cluster when building 25 | // programs within the `configs/program-scripts/dump.sh` script. 26 | { 27 | label: "SPL Noop", 28 | programId: "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV", 29 | deployPath: getProgram("spl_noop.so"), 30 | }, 31 | ], 32 | }, 33 | }; 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "programs:build": "./configs/scripts/program/build.sh", 5 | "programs:test": "RUST_LOG=error ./configs/scripts/program/test.sh", 6 | "programs:debug": "./configs/scripts/program/test.sh", 7 | "programs:clean": "./configs/scripts/program/clean.sh", 8 | "clients:rust:test": "./configs/scripts/client/test-rust.sh", 9 | "clients:js:test": "./configs/scripts/client/test-js.sh", 10 | "generate": "pnpm generate:idls && pnpm generate:clients", 11 | "generate:idls": "node ./configs/shank.cjs", 12 | "generate:clients": "node ./configs/kinobi.cjs", 13 | "validator": "CI=1 amman start --config ./configs/validator.cjs", 14 | "validator:debug": "amman start --config ./configs/validator.cjs", 15 | "validator:logs": "CI=1 amman logs", 16 | "validator:stop": "amman stop", 17 | "lint:fix": "./configs/scripts/client/format-js.sh && ./configs/scripts/program/format.sh", 18 | "format:fix": "pnpm lint:fix", 19 | "lint": "./configs/scripts/client/lint-js.sh && ./configs/scripts/program/lint.sh", 20 | "prepare": "husky" 21 | }, 22 | "devDependencies": { 23 | "@metaplex-foundation/amman": "^0.12.1", 24 | "@metaplex-foundation/kinobi": "0.18.8-alpha.0", 25 | "@metaplex-foundation/shank-js": "^0.1.7", 26 | "husky": "^9.0.11", 27 | "typescript": "^4.9.4" 28 | }, 29 | "packageManager": "pnpm@8.9.0" 30 | } 31 | -------------------------------------------------------------------------------- /programs/mpl-core/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mpl-core-program" 3 | version = "0.1.0" 4 | edition = "2021" 5 | readme = "./README.md" 6 | license-file = "../../LICENSE" 7 | publish = false 8 | 9 | [lib] 10 | crate-type = ["cdylib", "lib"] 11 | 12 | [dependencies] 13 | borsh = "^0.10" 14 | shank = "0.4.2" 15 | modular-bitfield = "0.11.2" 16 | mpl-bubblegum = "1.4.0" 17 | num-derive = "^0.3" 18 | num-traits = "^0.2" 19 | solana-program = "^1.17" 20 | thiserror = "^1.0" 21 | bytemuck = "1.14.1" 22 | mpl-utils = "0.3.5" 23 | spl-noop = { version = "0.2.0", features = ["cpi"] } 24 | podded = "0.5.1" 25 | strum = { version = "0.26.1", features = ["derive"] } 26 | -------------------------------------------------------------------------------- /programs/mpl-core/README.md: -------------------------------------------------------------------------------- 1 | # Mpl Core 2 | 3 | Digital Assets 4 | 5 | ## Building 6 | 7 | This will build the program and output a `.so` file in a non-comitted `target/deploy` directory which is used by the `config/shank.cjs` configuration file to start a new local validator with the latest changes on the program. 8 | 9 | ```sh 10 | cargo build-bpf 11 | ``` 12 | 13 | ## Testing 14 | 15 | You may run the following command to build the program and run its Rust tests. 16 | 17 | ```sh 18 | cargo test-bpf 19 | ``` 20 | -------------------------------------------------------------------------------- /programs/mpl-core/rustfmt.toml: -------------------------------------------------------------------------------- 1 | max_width = 100 2 | imports_indent = "Block" 3 | imports_layout = "Mixed" 4 | imports_granularity = "Crate" 5 | group_imports = "Preserve" 6 | reorder_imports = true 7 | reorder_modules = true 8 | reorder_impl_items = false 9 | -------------------------------------------------------------------------------- /programs/mpl-core/src/entrypoint.rs: -------------------------------------------------------------------------------- 1 | use solana_program::{ 2 | account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, 3 | program_error::PrintProgramError, pubkey::Pubkey, 4 | }; 5 | 6 | use crate::{error::MplCoreError, processor}; 7 | 8 | entrypoint!(process_instruction); 9 | 10 | /// Entrypoint function 11 | fn process_instruction<'a>( 12 | program_id: &'a Pubkey, 13 | accounts: &'a [AccountInfo<'a>], 14 | instruction_data: &[u8], 15 | ) -> ProgramResult { 16 | if let Err(error) = processor::process_instruction(program_id, accounts, instruction_data) { 17 | // catch the error so we can print it 18 | error.print::(); 19 | return Err(error); 20 | } 21 | Ok(()) 22 | } 23 | -------------------------------------------------------------------------------- /programs/mpl-core/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![deny(missing_docs)] 2 | //! # MPL Core 3 | //! 4 | //! Metaplex Core (“Core”) sheds the complexity and technical debt of previous 5 | //! standards and provides a clean and simple core spec for digital assets. 6 | //! This makes the bare minimum use case easy and understandable for users just 7 | //! starting out with Digital Assets. 8 | //! 9 | //!However, it's designed with a flexible plugin system that allows for users 10 | //! to extend the program itself without relying on Metaplex to add support to 11 | //! a rigid standard like Token Metadata. The plugin system is so powerful that 12 | //! it could even allow users to contribute third party plugins after the core 13 | //! program is made immutable. 14 | 15 | /// Standard Solana entrypoint. 16 | pub mod entrypoint; 17 | /// Error types for MPL Core. 18 | pub mod error; 19 | /// Main enum for managing instructions on MPL Core. 20 | pub mod instruction; 21 | /// Module for managing plugins. 22 | pub mod plugins; 23 | /// Module for processing instructions and routing them 24 | /// to the associated processor. 25 | pub mod processor; 26 | /// State and Type definitions for MPL Core. 27 | pub mod state; 28 | /// Program-wide utility functions. 29 | pub mod utils; 30 | 31 | pub use solana_program; 32 | 33 | solana_program::declare_id!("CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d"); 34 | -------------------------------------------------------------------------------- /programs/mpl-core/src/plugins/external/data_section.rs: -------------------------------------------------------------------------------- 1 | use borsh::{BorshDeserialize, BorshSerialize}; 2 | 3 | use crate::plugins::{ExternalPluginAdapterSchema, LinkedDataKey, PluginValidation}; 4 | 5 | /// The data section plugin is a third party plugin that is _always_ managed by another plugin. 6 | /// Currently these are used for the `LinkedAppData`, and `LinkedLifecycleHook` plugins. 7 | #[derive(Clone, Debug, BorshSerialize, BorshDeserialize, Eq, PartialEq)] 8 | pub struct DataSection { 9 | /// The key to the plugin that manages this data section. 10 | pub parent_key: LinkedDataKey, 11 | /// Schema for the data used by the plugin. 12 | pub schema: ExternalPluginAdapterSchema, 13 | } 14 | 15 | impl PluginValidation for DataSection {} 16 | 17 | impl From<&DataSectionInitInfo> for DataSection { 18 | fn from(init_info: &DataSectionInitInfo) -> Self { 19 | Self { 20 | parent_key: init_info.parent_key, 21 | schema: init_info.schema, 22 | } 23 | } 24 | } 25 | 26 | /// App data initialization info. 27 | #[derive(Clone, Debug, BorshSerialize, BorshDeserialize, Eq, PartialEq)] 28 | pub struct DataSectionInitInfo { 29 | /// The key to the plugin that manages this data section. 30 | pub parent_key: LinkedDataKey, 31 | /// Schema for the data used by the plugin. 32 | pub schema: ExternalPluginAdapterSchema, 33 | } 34 | 35 | /// App data update info. 36 | #[derive(Clone, Debug, BorshSerialize, BorshDeserialize, Eq, PartialEq)] 37 | pub struct DataSectionUpdateInfo {} 38 | -------------------------------------------------------------------------------- /programs/mpl-core/src/plugins/external/mod.rs: -------------------------------------------------------------------------------- 1 | mod app_data; 2 | mod data_section; 3 | mod lifecycle_hook; 4 | mod linked_app_data; 5 | mod linked_lifecycle_hook; 6 | mod oracle; 7 | 8 | pub use app_data::*; 9 | pub use data_section::*; 10 | pub use lifecycle_hook::*; 11 | pub use linked_app_data::*; 12 | pub use linked_lifecycle_hook::*; 13 | pub use oracle::*; 14 | -------------------------------------------------------------------------------- /programs/mpl-core/src/plugins/internal/authority_managed/add_blocker.rs: -------------------------------------------------------------------------------- 1 | use borsh::{BorshDeserialize, BorshSerialize}; 2 | use solana_program::program_error::ProgramError; 3 | 4 | use crate::{ 5 | plugins::{ 6 | abstain, reject, PluginType, PluginValidation, PluginValidationContext, ValidationResult, 7 | }, 8 | state::{Authority, DataBlob}, 9 | }; 10 | 11 | /// The AddBlocker plugin prevents any plugin except for owner-managed plugins from being added. 12 | /// The default authority for this plugin is None. 13 | 14 | #[repr(C)] 15 | #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq, Default)] 16 | pub struct AddBlocker {} 17 | 18 | impl DataBlob for AddBlocker { 19 | fn len(&self) -> usize { 20 | // Stateless data blob 21 | 0 22 | } 23 | } 24 | 25 | impl PluginValidation for AddBlocker { 26 | fn validate_add_plugin( 27 | &self, 28 | ctx: &PluginValidationContext, 29 | ) -> Result { 30 | if let Some(plugin) = ctx.target_plugin { 31 | if plugin.manager() == Authority::Owner 32 | || PluginType::from(plugin) == PluginType::AddBlocker 33 | { 34 | return abstain!(); 35 | } 36 | } 37 | 38 | reject!() 39 | } 40 | } 41 | 42 | #[cfg(test)] 43 | mod tests { 44 | use super::*; 45 | 46 | #[test] 47 | fn test_add_blocker_len() { 48 | let add_blocker = AddBlocker {}; 49 | let serialized = add_blocker.try_to_vec().unwrap(); 50 | assert_eq!(serialized.len(), add_blocker.len()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /programs/mpl-core/src/plugins/internal/authority_managed/immutable_metadata.rs: -------------------------------------------------------------------------------- 1 | use borsh::{BorshDeserialize, BorshSerialize}; 2 | use solana_program::program_error::ProgramError; 3 | 4 | use crate::{ 5 | plugins::{reject, PluginValidation, PluginValidationContext, ValidationResult}, 6 | state::DataBlob, 7 | }; 8 | 9 | /// The immutable metadata plugin allows its authority to prevent plugin's meta from changing. 10 | /// The default authority for this plugin is None. 11 | 12 | #[repr(C)] 13 | #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq, Default)] 14 | pub struct ImmutableMetadata {} 15 | 16 | impl DataBlob for ImmutableMetadata { 17 | fn len(&self) -> usize { 18 | // Stateless data blob 19 | 0 20 | } 21 | } 22 | 23 | impl PluginValidation for ImmutableMetadata { 24 | /// Validate the update lifecycle action. 25 | fn validate_update( 26 | &self, 27 | _ctx: &PluginValidationContext, 28 | ) -> Result { 29 | reject!() 30 | } 31 | } 32 | 33 | #[cfg(test)] 34 | mod tests { 35 | use super::*; 36 | 37 | #[test] 38 | fn test_immutable_metadata_len() { 39 | let immutable_metadata = ImmutableMetadata {}; 40 | let serialized = immutable_metadata.try_to_vec().unwrap(); 41 | assert_eq!(serialized.len(), immutable_metadata.len()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /programs/mpl-core/src/plugins/internal/authority_managed/mod.rs: -------------------------------------------------------------------------------- 1 | mod add_blocker; 2 | mod attributes; 3 | mod immutable_metadata; 4 | mod master_edition; 5 | mod royalties; 6 | mod update_delegate; 7 | mod verified_creators; 8 | 9 | pub use add_blocker::*; 10 | pub use attributes::*; 11 | pub use immutable_metadata::*; 12 | pub use master_edition::*; 13 | pub use royalties::*; 14 | pub use update_delegate::*; 15 | pub use verified_creators::*; 16 | -------------------------------------------------------------------------------- /programs/mpl-core/src/plugins/internal/mod.rs: -------------------------------------------------------------------------------- 1 | mod authority_managed; 2 | mod owner_managed; 3 | mod permanent; 4 | 5 | pub use authority_managed::*; 6 | pub use owner_managed::*; 7 | pub use permanent::*; 8 | -------------------------------------------------------------------------------- /programs/mpl-core/src/plugins/internal/owner_managed/mod.rs: -------------------------------------------------------------------------------- 1 | mod autograph; 2 | mod burn_delegate; 3 | mod freeze_delegate; 4 | mod transfer_delegate; 5 | 6 | pub use autograph::*; 7 | pub use burn_delegate::*; 8 | pub use freeze_delegate::*; 9 | pub use transfer_delegate::*; 10 | -------------------------------------------------------------------------------- /programs/mpl-core/src/plugins/internal/permanent/mod.rs: -------------------------------------------------------------------------------- 1 | mod bubblegum_v2; 2 | mod edition; 3 | mod permanent_burn_delegate; 4 | mod permanent_freeze_delegate; 5 | mod permanent_transfer_delegate; 6 | 7 | pub use bubblegum_v2::*; 8 | pub use edition::*; 9 | pub use permanent_burn_delegate::*; 10 | pub use permanent_freeze_delegate::*; 11 | pub use permanent_transfer_delegate::*; 12 | -------------------------------------------------------------------------------- /programs/mpl-core/src/plugins/plugin_header.rs: -------------------------------------------------------------------------------- 1 | use crate::state::{DataBlob, Key, SolanaAccount}; 2 | use borsh::{BorshDeserialize, BorshSerialize}; 3 | use shank::ShankAccount; 4 | 5 | /// The plugin header is the first part of the plugin metadata. 6 | /// This field stores the Key 7 | /// And a pointer to the Plugin Registry stored at the end of the account. 8 | #[repr(C)] 9 | #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, ShankAccount)] 10 | pub struct PluginHeaderV1 { 11 | /// The Discriminator of the header which doubles as a Plugin metadata version. 12 | pub key: Key, // 1 13 | /// The offset to the plugin registry stored at the end of the account. 14 | pub plugin_registry_offset: usize, // 8 15 | } 16 | 17 | impl PluginHeaderV1 { 18 | const BASE_LEN: usize = 1 // Key 19 | + 8; // Offset 20 | } 21 | 22 | impl DataBlob for PluginHeaderV1 { 23 | fn len(&self) -> usize { 24 | Self::BASE_LEN 25 | } 26 | } 27 | 28 | impl SolanaAccount for PluginHeaderV1 { 29 | fn key() -> Key { 30 | Key::PluginHeaderV1 31 | } 32 | } 33 | 34 | #[cfg(test)] 35 | mod tests { 36 | use super::*; 37 | 38 | #[test] 39 | fn test_plugin_header_v1_len() { 40 | let header = PluginHeaderV1 { 41 | key: Key::PluginHeaderV1, 42 | plugin_registry_offset: 0, 43 | }; 44 | let serialized = header.try_to_vec().unwrap(); 45 | assert_eq!(serialized.len(), header.len()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /programs/mpl-core/src/state/collect.rs: -------------------------------------------------------------------------------- 1 | use solana_program::{program_error::ProgramError, pubkey::Pubkey, rent::Rent, sysvar::Sysvar}; 2 | 3 | use crate::error::MplCoreError; 4 | 5 | pub(crate) const COLLECT_RECIPIENT1: Pubkey = 6 | solana_program::pubkey!("8AT6o8Qk5T9QnZvPThMrF9bcCQLTGkyGvVZZzHgCw11v"); 7 | 8 | pub(crate) const COLLECT_RECIPIENT2: Pubkey = 9 | solana_program::pubkey!("MmHsqX4LxTfifxoH8BVRLUKrwDn1LPCac6YcCZTHhwt"); 10 | 11 | const CREATE_FEE_SCALAR: usize = 87; 12 | const CREATE_FEE_OFFSET: u64 = 3600; 13 | pub fn get_create_fee() -> Result { 14 | let rent = Rent::get()?.minimum_balance(CREATE_FEE_SCALAR); 15 | 16 | Ok(rent 17 | .checked_add(CREATE_FEE_OFFSET) 18 | .ok_or(MplCoreError::NumericalOverflowError)?) 19 | } 20 | 21 | const EXECUTE_FEE_SCALAR: usize = 7; 22 | pub fn get_execute_fee() -> Result { 23 | Ok(Rent::get()?.minimum_balance(EXECUTE_FEE_SCALAR) - Rent::get()?.minimum_balance(0)) 24 | } 25 | -------------------------------------------------------------------------------- /programs/mpl-core/src/state/compression_proof.rs: -------------------------------------------------------------------------------- 1 | use borsh::{BorshDeserialize, BorshSerialize}; 2 | use solana_program::pubkey::Pubkey; 3 | 4 | use crate::state::{AssetV1, HashablePluginSchema, UpdateAuthority, Wrappable}; 5 | 6 | /// A simple struct to store the compression proof of an asset. 7 | #[repr(C)] 8 | #[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] 9 | pub struct CompressionProof { 10 | /// The owner of the asset. 11 | pub owner: Pubkey, //32 12 | /// The update authority of the asset. 13 | pub update_authority: UpdateAuthority, //33 14 | /// The name of the asset. 15 | pub name: String, //4 16 | /// The URI of the asset that points to the off-chain data. 17 | pub uri: String, //4 18 | /// The sequence number used for indexing with compression. 19 | pub seq: u64, //8 20 | /// The plugins for the asset. 21 | pub plugins: Vec, //4 22 | } 23 | 24 | impl CompressionProof { 25 | /// Create a new `CompressionProof`. Note this uses a passed-in `seq` rather than 26 | /// the one contained in `asset` to avoid errors. 27 | pub fn new(asset: AssetV1, seq: u64, plugins: Vec) -> Self { 28 | Self { 29 | owner: asset.owner, 30 | update_authority: asset.update_authority, 31 | name: asset.name, 32 | uri: asset.uri, 33 | seq, 34 | plugins, 35 | } 36 | } 37 | } 38 | 39 | impl Wrappable for CompressionProof {} 40 | -------------------------------------------------------------------------------- /programs/mpl-core/src/state/hashable_plugin_schema.rs: -------------------------------------------------------------------------------- 1 | use borsh::{BorshDeserialize, BorshSerialize}; 2 | use std::cmp::Ordering; 3 | 4 | use crate::{ 5 | plugins::Plugin, 6 | state::{Authority, Compressible}, 7 | }; 8 | 9 | /// A type that stores a plugin's authority and deserialized data into a 10 | /// schema that will be later hashed into a hashed asset. Also used in 11 | /// `CompressionProof`. 12 | #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq)] 13 | pub struct HashablePluginSchema { 14 | /// This is the order the plugins are stored in the account, allowing us 15 | /// to keep track of their order in the hashing. 16 | pub index: usize, 17 | /// The authority who has permission to utilize a plugin. 18 | pub authority: Authority, 19 | /// The deserialized plugin. 20 | pub plugin: Plugin, 21 | } 22 | 23 | impl HashablePluginSchema { 24 | /// Associated function for sorting `RegistryRecords` by offset. 25 | pub fn compare_indeces(a: &HashablePluginSchema, b: &HashablePluginSchema) -> Ordering { 26 | a.index.cmp(&b.index) 27 | } 28 | } 29 | 30 | impl Compressible for HashablePluginSchema {} 31 | -------------------------------------------------------------------------------- /programs/mpl-core/src/state/hashed_asset.rs: -------------------------------------------------------------------------------- 1 | use borsh::{BorshDeserialize, BorshSerialize}; 2 | use shank::ShankAccount; 3 | 4 | use crate::state::{DataBlob, Key, SolanaAccount}; 5 | 6 | /// The structure representing the hash of the asset. 7 | #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, ShankAccount, PartialEq, Eq)] 8 | pub struct HashedAssetV1 { 9 | /// The account discriminator. 10 | pub key: Key, //1 11 | /// The hash of the asset content. 12 | pub hash: [u8; 32], //32 13 | } 14 | 15 | impl HashedAssetV1 { 16 | const BASE_LEN: usize = 1 // The Key 17 | + 32; // The hash 18 | 19 | /// Create a new hashed asset. 20 | pub fn new(hash: [u8; 32]) -> Self { 21 | Self { 22 | key: Key::HashedAssetV1, 23 | hash, 24 | } 25 | } 26 | } 27 | 28 | impl DataBlob for HashedAssetV1 { 29 | fn len(&self) -> usize { 30 | Self::BASE_LEN 31 | } 32 | } 33 | 34 | impl SolanaAccount for HashedAssetV1 { 35 | fn key() -> Key { 36 | Key::HashedAssetV1 37 | } 38 | } 39 | 40 | #[cfg(test)] 41 | mod tests { 42 | use super::*; 43 | 44 | #[test] 45 | fn test_hashed_asset_len() { 46 | let hashed_asset = HashedAssetV1::new([0; 32]); 47 | let serialized = hashed_asset.try_to_vec().unwrap(); 48 | assert_eq!(serialized.len(), hashed_asset.len()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /programs/mpl-core/src/state/hashed_asset_schema.rs: -------------------------------------------------------------------------------- 1 | use borsh::{BorshDeserialize, BorshSerialize}; 2 | 3 | use crate::state::Compressible; 4 | 5 | /// The hashed asset schema is a schema that contains a hash of the asset and a vec of plugin hashes. 6 | #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq)] 7 | pub struct HashedAssetSchema { 8 | /// The hash of the asset. 9 | pub asset_hash: [u8; 32], 10 | /// A vec of plugin hashes. 11 | pub plugin_hashes: Vec<[u8; 32]>, 12 | } 13 | 14 | impl Compressible for HashedAssetSchema {} 15 | -------------------------------------------------------------------------------- /programs/mpl-core/src/state/update_authority.rs: -------------------------------------------------------------------------------- 1 | use borsh::{BorshDeserialize, BorshSerialize}; 2 | use solana_program::pubkey::Pubkey; 3 | 4 | /// An enum representing the types of accounts that can update data on an asset. 5 | #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, Eq, PartialEq)] 6 | pub enum UpdateAuthority { 7 | /// No update authority, used for immutability. 8 | None, 9 | /// A standard address or PDA. 10 | Address(Pubkey), 11 | /// Authority delegated to a collection. 12 | Collection(Pubkey), 13 | } 14 | 15 | impl UpdateAuthority { 16 | /// Get the address of the update authority. 17 | pub fn key(&self) -> Pubkey { 18 | match self { 19 | Self::None => Pubkey::default(), 20 | Self::Address(address) => *address, 21 | Self::Collection(address) => *address, 22 | } 23 | } 24 | } 25 | --------------------------------------------------------------------------------