From 8167bb4837bc9b6a86662c0bba1dcd5c4ffc2067 Mon Sep 17 00:00:00 2001 From: blockiosaurus Date: Fri, 19 Apr 2024 12:38:37 -0400 Subject: [PATCH 1/6] Adding new IXes and data auth. --- .../allocateCollectionExternalPluginDataV1.ts | 171 +++++ .../allocateExternalPluginDataV1.ts | 178 ++++++ .../clearCollectionExternalPluginDataV1.ts | 167 +++++ .../instructions/clearExternalPluginDataV1.ts | 172 +++++ .../js/src/generated/instructions/index.ts | 6 + .../writeCollectionExternalPluginDataV1.ts | 176 +++++ .../instructions/writeExternalPluginDataV1.ts | 181 ++++++ .../generated/types/externalPluginInitInfo.ts | 4 +- .../types/externalPluginUpdateInfo.ts | 4 +- .../js/src/generated/types/lifecycleHook.ts | 6 + .../generated/types/lifecycleHookInitInfo.ts | 3 + ...cate_collection_external_plugin_data_v1.rs | 543 ++++++++++++++++ .../allocate_external_plugin_data_v1.rs | 593 +++++++++++++++++ ...lear_collection_external_plugin_data_v1.rs | 521 +++++++++++++++ .../clear_external_plugin_data_v1.rs | 573 +++++++++++++++++ .../rust/src/generated/instructions/mod.rs | 12 + ...rite_collection_external_plugin_data_v1.rs | 553 ++++++++++++++++ .../write_external_plugin_data_v1.rs | 605 ++++++++++++++++++ .../generated/types/external_plugin_schema.rs | 5 +- .../generated/types/external_plugin_type.rs | 5 +- .../types/hookable_lifecycle_event.rs | 5 +- .../src/generated/types/lifecycle_hook.rs | 2 + .../types/lifecycle_hook_init_info.rs | 1 + .../src/generated/types/validation_result.rs | 5 +- idls/mpl_core.json | 505 +++++++++++++++ programs/mpl-core/src/instruction.rs | 68 +- programs/mpl-core/src/plugins/data_store.rs | 4 +- .../mpl-core/src/plugins/lifecycle_hook.rs | 8 + .../allocate_external_plugin_data.rs | 36 ++ .../processor/clear_external_plugin_data.rs | 32 + programs/mpl-core/src/processor/mod.rs | 30 + .../processor/write_external_plugin_data.rs | 40 ++ 32 files changed, 5197 insertions(+), 17 deletions(-) create mode 100644 clients/js/src/generated/instructions/allocateCollectionExternalPluginDataV1.ts create mode 100644 clients/js/src/generated/instructions/allocateExternalPluginDataV1.ts create mode 100644 clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts create mode 100644 clients/js/src/generated/instructions/clearExternalPluginDataV1.ts create mode 100644 clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts create mode 100644 clients/js/src/generated/instructions/writeExternalPluginDataV1.ts create mode 100644 clients/rust/src/generated/instructions/allocate_collection_external_plugin_data_v1.rs create mode 100644 clients/rust/src/generated/instructions/allocate_external_plugin_data_v1.rs create mode 100644 clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs create mode 100644 clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs create mode 100644 clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs create mode 100644 clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs create mode 100644 programs/mpl-core/src/processor/allocate_external_plugin_data.rs create mode 100644 programs/mpl-core/src/processor/clear_external_plugin_data.rs create mode 100644 programs/mpl-core/src/processor/write_external_plugin_data.rs diff --git a/clients/js/src/generated/instructions/allocateCollectionExternalPluginDataV1.ts b/clients/js/src/generated/instructions/allocateCollectionExternalPluginDataV1.ts new file mode 100644 index 00000000..40d39fac --- /dev/null +++ b/clients/js/src/generated/instructions/allocateCollectionExternalPluginDataV1.ts @@ -0,0 +1,171 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/metaplex-foundation/kinobi + */ + +import { + Context, + Pda, + PublicKey, + Signer, + TransactionBuilder, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + mapSerializer, + struct, + u64, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + getAccountMetasAndSigners, +} from '../shared'; +import { + ExternalPluginKey, + ExternalPluginKeyArgs, + getExternalPluginKeySerializer, +} from '../types'; + +// Accounts. +export type AllocateCollectionExternalPluginDataV1InstructionAccounts = { + /** The address of the asset */ + collection: PublicKey | Pda; + /** The account paying for the storage fees */ + payer?: Signer; + /** The owner or delegate of the asset */ + authority?: Signer; + /** The system program */ + systemProgram?: PublicKey | Pda; + /** The SPL Noop Program */ + logWrapper?: PublicKey | Pda; +}; + +// Data. +export type AllocateCollectionExternalPluginDataV1InstructionData = { + discriminator: number; + key: ExternalPluginKey; + targetSize: bigint; +}; + +export type AllocateCollectionExternalPluginDataV1InstructionDataArgs = { + key: ExternalPluginKeyArgs; + targetSize: number | bigint; +}; + +export function getAllocateCollectionExternalPluginDataV1InstructionDataSerializer(): Serializer< + AllocateCollectionExternalPluginDataV1InstructionDataArgs, + AllocateCollectionExternalPluginDataV1InstructionData +> { + return mapSerializer< + AllocateCollectionExternalPluginDataV1InstructionDataArgs, + any, + AllocateCollectionExternalPluginDataV1InstructionData + >( + struct( + [ + ['discriminator', u8()], + ['key', getExternalPluginKeySerializer()], + ['targetSize', u64()], + ], + { description: 'AllocateCollectionExternalPluginDataV1InstructionData' } + ), + (value) => ({ ...value, discriminator: 29 }) + ) as Serializer< + AllocateCollectionExternalPluginDataV1InstructionDataArgs, + AllocateCollectionExternalPluginDataV1InstructionData + >; +} + +// Args. +export type AllocateCollectionExternalPluginDataV1InstructionArgs = + AllocateCollectionExternalPluginDataV1InstructionDataArgs; + +// Instruction. +export function allocateCollectionExternalPluginDataV1( + context: Pick, + input: AllocateCollectionExternalPluginDataV1InstructionAccounts & + AllocateCollectionExternalPluginDataV1InstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplCore', + 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' + ); + + // Accounts. + const resolvedAccounts = { + collection: { + index: 0, + isWritable: true as boolean, + value: input.collection ?? null, + }, + payer: { + index: 1, + isWritable: true as boolean, + value: input.payer ?? null, + }, + authority: { + index: 2, + isWritable: false as boolean, + value: input.authority ?? null, + }, + systemProgram: { + index: 3, + isWritable: false as boolean, + value: input.systemProgram ?? null, + }, + logWrapper: { + index: 4, + isWritable: false as boolean, + value: input.logWrapper ?? null, + }, + } satisfies ResolvedAccountsWithIndices; + + // Arguments. + const resolvedArgs: AllocateCollectionExternalPluginDataV1InstructionArgs = { + ...input, + }; + + // Default values. + if (!resolvedAccounts.payer.value) { + resolvedAccounts.payer.value = context.payer; + } + if (!resolvedAccounts.systemProgram.value) { + resolvedAccounts.systemProgram.value = context.programs.getPublicKey( + 'splSystem', + '11111111111111111111111111111111' + ); + resolvedAccounts.systemProgram.isWritable = false; + } + + // Accounts in order. + const orderedAccounts: ResolvedAccount[] = Object.values( + resolvedAccounts + ).sort((a, b) => a.index - b.index); + + // Keys and Signers. + const [keys, signers] = getAccountMetasAndSigners( + orderedAccounts, + 'programId', + programId + ); + + // Data. + const data = + getAllocateCollectionExternalPluginDataV1InstructionDataSerializer().serialize( + resolvedArgs as AllocateCollectionExternalPluginDataV1InstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/allocateExternalPluginDataV1.ts b/clients/js/src/generated/instructions/allocateExternalPluginDataV1.ts new file mode 100644 index 00000000..50bf35b6 --- /dev/null +++ b/clients/js/src/generated/instructions/allocateExternalPluginDataV1.ts @@ -0,0 +1,178 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/metaplex-foundation/kinobi + */ + +import { + Context, + Pda, + PublicKey, + Signer, + TransactionBuilder, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + mapSerializer, + struct, + u64, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + getAccountMetasAndSigners, +} from '../shared'; +import { + ExternalPluginKey, + ExternalPluginKeyArgs, + getExternalPluginKeySerializer, +} from '../types'; + +// Accounts. +export type AllocateExternalPluginDataV1InstructionAccounts = { + /** The address of the asset */ + asset: PublicKey | Pda; + /** The collection to which the asset belongs */ + collection?: PublicKey | Pda; + /** The account paying for the storage fees */ + payer?: Signer; + /** The owner or delegate of the asset */ + authority?: Signer; + /** The system program */ + systemProgram?: PublicKey | Pda; + /** The SPL Noop Program */ + logWrapper?: PublicKey | Pda; +}; + +// Data. +export type AllocateExternalPluginDataV1InstructionData = { + discriminator: number; + key: ExternalPluginKey; + targetSize: bigint; +}; + +export type AllocateExternalPluginDataV1InstructionDataArgs = { + key: ExternalPluginKeyArgs; + targetSize: number | bigint; +}; + +export function getAllocateExternalPluginDataV1InstructionDataSerializer(): Serializer< + AllocateExternalPluginDataV1InstructionDataArgs, + AllocateExternalPluginDataV1InstructionData +> { + return mapSerializer< + AllocateExternalPluginDataV1InstructionDataArgs, + any, + AllocateExternalPluginDataV1InstructionData + >( + struct( + [ + ['discriminator', u8()], + ['key', getExternalPluginKeySerializer()], + ['targetSize', u64()], + ], + { description: 'AllocateExternalPluginDataV1InstructionData' } + ), + (value) => ({ ...value, discriminator: 28 }) + ) as Serializer< + AllocateExternalPluginDataV1InstructionDataArgs, + AllocateExternalPluginDataV1InstructionData + >; +} + +// Args. +export type AllocateExternalPluginDataV1InstructionArgs = + AllocateExternalPluginDataV1InstructionDataArgs; + +// Instruction. +export function allocateExternalPluginDataV1( + context: Pick, + input: AllocateExternalPluginDataV1InstructionAccounts & + AllocateExternalPluginDataV1InstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplCore', + 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' + ); + + // Accounts. + const resolvedAccounts = { + asset: { + index: 0, + isWritable: true as boolean, + value: input.asset ?? null, + }, + collection: { + index: 1, + isWritable: true as boolean, + value: input.collection ?? null, + }, + payer: { + index: 2, + isWritable: true as boolean, + value: input.payer ?? null, + }, + authority: { + index: 3, + isWritable: false as boolean, + value: input.authority ?? null, + }, + systemProgram: { + index: 4, + isWritable: false as boolean, + value: input.systemProgram ?? null, + }, + logWrapper: { + index: 5, + isWritable: false as boolean, + value: input.logWrapper ?? null, + }, + } satisfies ResolvedAccountsWithIndices; + + // Arguments. + const resolvedArgs: AllocateExternalPluginDataV1InstructionArgs = { + ...input, + }; + + // Default values. + if (!resolvedAccounts.payer.value) { + resolvedAccounts.payer.value = context.payer; + } + if (!resolvedAccounts.systemProgram.value) { + resolvedAccounts.systemProgram.value = context.programs.getPublicKey( + 'splSystem', + '11111111111111111111111111111111' + ); + resolvedAccounts.systemProgram.isWritable = false; + } + + // Accounts in order. + const orderedAccounts: ResolvedAccount[] = Object.values( + resolvedAccounts + ).sort((a, b) => a.index - b.index); + + // Keys and Signers. + const [keys, signers] = getAccountMetasAndSigners( + orderedAccounts, + 'programId', + programId + ); + + // Data. + const data = + getAllocateExternalPluginDataV1InstructionDataSerializer().serialize( + resolvedArgs as AllocateExternalPluginDataV1InstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts b/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts new file mode 100644 index 00000000..7ad66d36 --- /dev/null +++ b/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts @@ -0,0 +1,167 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/metaplex-foundation/kinobi + */ + +import { + Context, + Pda, + PublicKey, + Signer, + TransactionBuilder, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + mapSerializer, + struct, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + getAccountMetasAndSigners, +} from '../shared'; +import { + ExternalPluginKey, + ExternalPluginKeyArgs, + getExternalPluginKeySerializer, +} from '../types'; + +// Accounts. +export type ClearCollectionExternalPluginDataV1InstructionAccounts = { + /** The address of the asset */ + collection: PublicKey | Pda; + /** The account paying for the storage fees */ + payer?: Signer; + /** The owner or delegate of the asset */ + authority?: Signer; + /** The system program */ + systemProgram?: PublicKey | Pda; + /** The SPL Noop Program */ + logWrapper?: PublicKey | Pda; +}; + +// Data. +export type ClearCollectionExternalPluginDataV1InstructionData = { + discriminator: number; + key: ExternalPluginKey; +}; + +export type ClearCollectionExternalPluginDataV1InstructionDataArgs = { + key: ExternalPluginKeyArgs; +}; + +export function getClearCollectionExternalPluginDataV1InstructionDataSerializer(): Serializer< + ClearCollectionExternalPluginDataV1InstructionDataArgs, + ClearCollectionExternalPluginDataV1InstructionData +> { + return mapSerializer< + ClearCollectionExternalPluginDataV1InstructionDataArgs, + any, + ClearCollectionExternalPluginDataV1InstructionData + >( + struct( + [ + ['discriminator', u8()], + ['key', getExternalPluginKeySerializer()], + ], + { description: 'ClearCollectionExternalPluginDataV1InstructionData' } + ), + (value) => ({ ...value, discriminator: 33 }) + ) as Serializer< + ClearCollectionExternalPluginDataV1InstructionDataArgs, + ClearCollectionExternalPluginDataV1InstructionData + >; +} + +// Args. +export type ClearCollectionExternalPluginDataV1InstructionArgs = + ClearCollectionExternalPluginDataV1InstructionDataArgs; + +// Instruction. +export function clearCollectionExternalPluginDataV1( + context: Pick, + input: ClearCollectionExternalPluginDataV1InstructionAccounts & + ClearCollectionExternalPluginDataV1InstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplCore', + 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' + ); + + // Accounts. + const resolvedAccounts = { + collection: { + index: 0, + isWritable: true as boolean, + value: input.collection ?? null, + }, + payer: { + index: 1, + isWritable: true as boolean, + value: input.payer ?? null, + }, + authority: { + index: 2, + isWritable: false as boolean, + value: input.authority ?? null, + }, + systemProgram: { + index: 3, + isWritable: false as boolean, + value: input.systemProgram ?? null, + }, + logWrapper: { + index: 4, + isWritable: false as boolean, + value: input.logWrapper ?? null, + }, + } satisfies ResolvedAccountsWithIndices; + + // Arguments. + const resolvedArgs: ClearCollectionExternalPluginDataV1InstructionArgs = { + ...input, + }; + + // Default values. + if (!resolvedAccounts.payer.value) { + resolvedAccounts.payer.value = context.payer; + } + if (!resolvedAccounts.systemProgram.value) { + resolvedAccounts.systemProgram.value = context.programs.getPublicKey( + 'splSystem', + '11111111111111111111111111111111' + ); + resolvedAccounts.systemProgram.isWritable = false; + } + + // Accounts in order. + const orderedAccounts: ResolvedAccount[] = Object.values( + resolvedAccounts + ).sort((a, b) => a.index - b.index); + + // Keys and Signers. + const [keys, signers] = getAccountMetasAndSigners( + orderedAccounts, + 'programId', + programId + ); + + // Data. + const data = + getClearCollectionExternalPluginDataV1InstructionDataSerializer().serialize( + resolvedArgs as ClearCollectionExternalPluginDataV1InstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts b/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts new file mode 100644 index 00000000..423d13ac --- /dev/null +++ b/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts @@ -0,0 +1,172 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/metaplex-foundation/kinobi + */ + +import { + Context, + Pda, + PublicKey, + Signer, + TransactionBuilder, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + mapSerializer, + struct, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + getAccountMetasAndSigners, +} from '../shared'; +import { + ExternalPluginKey, + ExternalPluginKeyArgs, + getExternalPluginKeySerializer, +} from '../types'; + +// Accounts. +export type ClearExternalPluginDataV1InstructionAccounts = { + /** The address of the asset */ + asset: PublicKey | Pda; + /** The collection to which the asset belongs */ + collection?: PublicKey | Pda; + /** The account paying for the storage fees */ + payer?: Signer; + /** The owner or delegate of the asset */ + authority?: Signer; + /** The system program */ + systemProgram?: PublicKey | Pda; + /** The SPL Noop Program */ + logWrapper?: PublicKey | Pda; +}; + +// Data. +export type ClearExternalPluginDataV1InstructionData = { + discriminator: number; + key: ExternalPluginKey; +}; + +export type ClearExternalPluginDataV1InstructionDataArgs = { + key: ExternalPluginKeyArgs; +}; + +export function getClearExternalPluginDataV1InstructionDataSerializer(): Serializer< + ClearExternalPluginDataV1InstructionDataArgs, + ClearExternalPluginDataV1InstructionData +> { + return mapSerializer< + ClearExternalPluginDataV1InstructionDataArgs, + any, + ClearExternalPluginDataV1InstructionData + >( + struct( + [ + ['discriminator', u8()], + ['key', getExternalPluginKeySerializer()], + ], + { description: 'ClearExternalPluginDataV1InstructionData' } + ), + (value) => ({ ...value, discriminator: 32 }) + ) as Serializer< + ClearExternalPluginDataV1InstructionDataArgs, + ClearExternalPluginDataV1InstructionData + >; +} + +// Args. +export type ClearExternalPluginDataV1InstructionArgs = + ClearExternalPluginDataV1InstructionDataArgs; + +// Instruction. +export function clearExternalPluginDataV1( + context: Pick, + input: ClearExternalPluginDataV1InstructionAccounts & + ClearExternalPluginDataV1InstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplCore', + 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' + ); + + // Accounts. + const resolvedAccounts = { + asset: { + index: 0, + isWritable: true as boolean, + value: input.asset ?? null, + }, + collection: { + index: 1, + isWritable: true as boolean, + value: input.collection ?? null, + }, + payer: { + index: 2, + isWritable: true as boolean, + value: input.payer ?? null, + }, + authority: { + index: 3, + isWritable: false as boolean, + value: input.authority ?? null, + }, + systemProgram: { + index: 4, + isWritable: false as boolean, + value: input.systemProgram ?? null, + }, + logWrapper: { + index: 5, + isWritable: false as boolean, + value: input.logWrapper ?? null, + }, + } satisfies ResolvedAccountsWithIndices; + + // Arguments. + const resolvedArgs: ClearExternalPluginDataV1InstructionArgs = { ...input }; + + // Default values. + if (!resolvedAccounts.payer.value) { + resolvedAccounts.payer.value = context.payer; + } + if (!resolvedAccounts.systemProgram.value) { + resolvedAccounts.systemProgram.value = context.programs.getPublicKey( + 'splSystem', + '11111111111111111111111111111111' + ); + resolvedAccounts.systemProgram.isWritable = false; + } + + // Accounts in order. + const orderedAccounts: ResolvedAccount[] = Object.values( + resolvedAccounts + ).sort((a, b) => a.index - b.index); + + // Keys and Signers. + const [keys, signers] = getAccountMetasAndSigners( + orderedAccounts, + 'programId', + programId + ); + + // Data. + const data = + getClearExternalPluginDataV1InstructionDataSerializer().serialize( + resolvedArgs as ClearExternalPluginDataV1InstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/index.ts b/clients/js/src/generated/instructions/index.ts index 263e35f6..13d07d35 100644 --- a/clients/js/src/generated/instructions/index.ts +++ b/clients/js/src/generated/instructions/index.ts @@ -10,10 +10,14 @@ export * from './addCollectionExternalPluginV1'; export * from './addCollectionPluginV1'; export * from './addExternalPluginV1'; export * from './addPluginV1'; +export * from './allocateCollectionExternalPluginDataV1'; +export * from './allocateExternalPluginDataV1'; export * from './approveCollectionPluginAuthorityV1'; export * from './approvePluginAuthorityV1'; export * from './burnCollectionV1'; export * from './burnV1'; +export * from './clearCollectionExternalPluginDataV1'; +export * from './clearExternalPluginDataV1'; export * from './collect'; export * from './compressV1'; export * from './createCollectionV1'; @@ -34,3 +38,5 @@ export * from './updateCollectionV1'; export * from './updateExternalPluginV1'; export * from './updatePluginV1'; export * from './updateV1'; +export * from './writeCollectionExternalPluginDataV1'; +export * from './writeExternalPluginDataV1'; diff --git a/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts b/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts new file mode 100644 index 00000000..bb56bb8c --- /dev/null +++ b/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts @@ -0,0 +1,176 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/metaplex-foundation/kinobi + */ + +import { + Context, + Pda, + PublicKey, + Signer, + TransactionBuilder, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + bytes, + mapSerializer, + struct, + u32, + u64, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + getAccountMetasAndSigners, +} from '../shared'; +import { + ExternalPluginKey, + ExternalPluginKeyArgs, + getExternalPluginKeySerializer, +} from '../types'; + +// Accounts. +export type WriteCollectionExternalPluginDataV1InstructionAccounts = { + /** The address of the asset */ + collection: PublicKey | Pda; + /** The account paying for the storage fees */ + payer?: Signer; + /** The owner or delegate of the asset */ + authority?: Signer; + /** The system program */ + systemProgram?: PublicKey | Pda; + /** The SPL Noop Program */ + logWrapper?: PublicKey | Pda; +}; + +// Data. +export type WriteCollectionExternalPluginDataV1InstructionData = { + discriminator: number; + key: ExternalPluginKey; + offset: bigint; + data: Uint8Array; +}; + +export type WriteCollectionExternalPluginDataV1InstructionDataArgs = { + key: ExternalPluginKeyArgs; + offset: number | bigint; + data: Uint8Array; +}; + +export function getWriteCollectionExternalPluginDataV1InstructionDataSerializer(): Serializer< + WriteCollectionExternalPluginDataV1InstructionDataArgs, + WriteCollectionExternalPluginDataV1InstructionData +> { + return mapSerializer< + WriteCollectionExternalPluginDataV1InstructionDataArgs, + any, + WriteCollectionExternalPluginDataV1InstructionData + >( + struct( + [ + ['discriminator', u8()], + ['key', getExternalPluginKeySerializer()], + ['offset', u64()], + ['data', bytes({ size: u32() })], + ], + { description: 'WriteCollectionExternalPluginDataV1InstructionData' } + ), + (value) => ({ ...value, discriminator: 31 }) + ) as Serializer< + WriteCollectionExternalPluginDataV1InstructionDataArgs, + WriteCollectionExternalPluginDataV1InstructionData + >; +} + +// Args. +export type WriteCollectionExternalPluginDataV1InstructionArgs = + WriteCollectionExternalPluginDataV1InstructionDataArgs; + +// Instruction. +export function writeCollectionExternalPluginDataV1( + context: Pick, + input: WriteCollectionExternalPluginDataV1InstructionAccounts & + WriteCollectionExternalPluginDataV1InstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplCore', + 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' + ); + + // Accounts. + const resolvedAccounts = { + collection: { + index: 0, + isWritable: true as boolean, + value: input.collection ?? null, + }, + payer: { + index: 1, + isWritable: true as boolean, + value: input.payer ?? null, + }, + authority: { + index: 2, + isWritable: false as boolean, + value: input.authority ?? null, + }, + systemProgram: { + index: 3, + isWritable: false as boolean, + value: input.systemProgram ?? null, + }, + logWrapper: { + index: 4, + isWritable: false as boolean, + value: input.logWrapper ?? null, + }, + } satisfies ResolvedAccountsWithIndices; + + // Arguments. + const resolvedArgs: WriteCollectionExternalPluginDataV1InstructionArgs = { + ...input, + }; + + // Default values. + if (!resolvedAccounts.payer.value) { + resolvedAccounts.payer.value = context.payer; + } + if (!resolvedAccounts.systemProgram.value) { + resolvedAccounts.systemProgram.value = context.programs.getPublicKey( + 'splSystem', + '11111111111111111111111111111111' + ); + resolvedAccounts.systemProgram.isWritable = false; + } + + // Accounts in order. + const orderedAccounts: ResolvedAccount[] = Object.values( + resolvedAccounts + ).sort((a, b) => a.index - b.index); + + // Keys and Signers. + const [keys, signers] = getAccountMetasAndSigners( + orderedAccounts, + 'programId', + programId + ); + + // Data. + const data = + getWriteCollectionExternalPluginDataV1InstructionDataSerializer().serialize( + resolvedArgs as WriteCollectionExternalPluginDataV1InstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts b/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts new file mode 100644 index 00000000..b2748107 --- /dev/null +++ b/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts @@ -0,0 +1,181 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/metaplex-foundation/kinobi + */ + +import { + Context, + Pda, + PublicKey, + Signer, + TransactionBuilder, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + bytes, + mapSerializer, + struct, + u32, + u64, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + getAccountMetasAndSigners, +} from '../shared'; +import { + ExternalPluginKey, + ExternalPluginKeyArgs, + getExternalPluginKeySerializer, +} from '../types'; + +// Accounts. +export type WriteExternalPluginDataV1InstructionAccounts = { + /** The address of the asset */ + asset: PublicKey | Pda; + /** The collection to which the asset belongs */ + collection?: PublicKey | Pda; + /** The account paying for the storage fees */ + payer?: Signer; + /** The owner or delegate of the asset */ + authority?: Signer; + /** The system program */ + systemProgram?: PublicKey | Pda; + /** The SPL Noop Program */ + logWrapper?: PublicKey | Pda; +}; + +// Data. +export type WriteExternalPluginDataV1InstructionData = { + discriminator: number; + key: ExternalPluginKey; + offset: bigint; + data: Uint8Array; +}; + +export type WriteExternalPluginDataV1InstructionDataArgs = { + key: ExternalPluginKeyArgs; + offset: number | bigint; + data: Uint8Array; +}; + +export function getWriteExternalPluginDataV1InstructionDataSerializer(): Serializer< + WriteExternalPluginDataV1InstructionDataArgs, + WriteExternalPluginDataV1InstructionData +> { + return mapSerializer< + WriteExternalPluginDataV1InstructionDataArgs, + any, + WriteExternalPluginDataV1InstructionData + >( + struct( + [ + ['discriminator', u8()], + ['key', getExternalPluginKeySerializer()], + ['offset', u64()], + ['data', bytes({ size: u32() })], + ], + { description: 'WriteExternalPluginDataV1InstructionData' } + ), + (value) => ({ ...value, discriminator: 30 }) + ) as Serializer< + WriteExternalPluginDataV1InstructionDataArgs, + WriteExternalPluginDataV1InstructionData + >; +} + +// Args. +export type WriteExternalPluginDataV1InstructionArgs = + WriteExternalPluginDataV1InstructionDataArgs; + +// Instruction. +export function writeExternalPluginDataV1( + context: Pick, + input: WriteExternalPluginDataV1InstructionAccounts & + WriteExternalPluginDataV1InstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplCore', + 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' + ); + + // Accounts. + const resolvedAccounts = { + asset: { + index: 0, + isWritable: true as boolean, + value: input.asset ?? null, + }, + collection: { + index: 1, + isWritable: true as boolean, + value: input.collection ?? null, + }, + payer: { + index: 2, + isWritable: true as boolean, + value: input.payer ?? null, + }, + authority: { + index: 3, + isWritable: false as boolean, + value: input.authority ?? null, + }, + systemProgram: { + index: 4, + isWritable: false as boolean, + value: input.systemProgram ?? null, + }, + logWrapper: { + index: 5, + isWritable: false as boolean, + value: input.logWrapper ?? null, + }, + } satisfies ResolvedAccountsWithIndices; + + // Arguments. + const resolvedArgs: WriteExternalPluginDataV1InstructionArgs = { ...input }; + + // Default values. + if (!resolvedAccounts.payer.value) { + resolvedAccounts.payer.value = context.payer; + } + if (!resolvedAccounts.systemProgram.value) { + resolvedAccounts.systemProgram.value = context.programs.getPublicKey( + 'splSystem', + '11111111111111111111111111111111' + ); + resolvedAccounts.systemProgram.isWritable = false; + } + + // Accounts in order. + const orderedAccounts: ResolvedAccount[] = Object.values( + resolvedAccounts + ).sort((a, b) => a.index - b.index); + + // Keys and Signers. + const [keys, signers] = getAccountMetasAndSigners( + orderedAccounts, + 'programId', + programId + ); + + // Data. + const data = + getWriteExternalPluginDataV1InstructionDataSerializer().serialize( + resolvedArgs as WriteExternalPluginDataV1InstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/types/externalPluginInitInfo.ts b/clients/js/src/generated/types/externalPluginInitInfo.ts index c41d8803..194ccfee 100644 --- a/clients/js/src/generated/types/externalPluginInitInfo.ts +++ b/clients/js/src/generated/types/externalPluginInitInfo.ts @@ -85,14 +85,14 @@ export function externalPluginInitInfo( >['fields'] ): GetDataEnumKind; export function externalPluginInitInfo< - K extends ExternalPluginInitInfoArgs['__kind'] + K extends ExternalPluginInitInfoArgs['__kind'], >(kind: K, data?: any): Extract { return Array.isArray(data) ? { __kind: kind, fields: data } : { __kind: kind, ...(data ?? {}) }; } export function isExternalPluginInitInfo< - K extends ExternalPluginInitInfo['__kind'] + K extends ExternalPluginInitInfo['__kind'], >( kind: K, value: ExternalPluginInitInfo diff --git a/clients/js/src/generated/types/externalPluginUpdateInfo.ts b/clients/js/src/generated/types/externalPluginUpdateInfo.ts index 4e232e8e..93848277 100644 --- a/clients/js/src/generated/types/externalPluginUpdateInfo.ts +++ b/clients/js/src/generated/types/externalPluginUpdateInfo.ts @@ -85,14 +85,14 @@ export function externalPluginUpdateInfo( >['fields'] ): GetDataEnumKind; export function externalPluginUpdateInfo< - K extends ExternalPluginUpdateInfoArgs['__kind'] + K extends ExternalPluginUpdateInfoArgs['__kind'], >(kind: K, data?: any): Extract { return Array.isArray(data) ? { __kind: kind, fields: data } : { __kind: kind, ...(data ?? {}) }; } export function isExternalPluginUpdateInfo< - K extends ExternalPluginUpdateInfo['__kind'] + K extends ExternalPluginUpdateInfo['__kind'], >( kind: K, value: ExternalPluginUpdateInfo diff --git a/clients/js/src/generated/types/lifecycleHook.ts b/clients/js/src/generated/types/lifecycleHook.ts index 8d444400..3689a806 100644 --- a/clients/js/src/generated/types/lifecycleHook.ts +++ b/clients/js/src/generated/types/lifecycleHook.ts @@ -20,13 +20,17 @@ import { ExternalPluginSchemaArgs, ExtraAccount, ExtraAccountArgs, + PluginAuthority, + PluginAuthorityArgs, getExternalPluginSchemaSerializer, getExtraAccountSerializer, + getPluginAuthoritySerializer, } from '.'; export type LifecycleHook = { hookedProgram: PublicKey; extraAccounts: Option>; + dataAuthority: Option; schema: ExternalPluginSchema; dataOffset: bigint; dataLen: bigint; @@ -35,6 +39,7 @@ export type LifecycleHook = { export type LifecycleHookArgs = { hookedProgram: PublicKey; extraAccounts: OptionOrNullable>; + dataAuthority: OptionOrNullable; schema: ExternalPluginSchemaArgs; dataOffset: number | bigint; dataLen: number | bigint; @@ -48,6 +53,7 @@ export function getLifecycleHookSerializer(): Serializer< [ ['hookedProgram', publicKeySerializer()], ['extraAccounts', option(array(getExtraAccountSerializer()))], + ['dataAuthority', option(getPluginAuthoritySerializer())], ['schema', getExternalPluginSchemaSerializer()], ['dataOffset', u64()], ['dataLen', u64()], diff --git a/clients/js/src/generated/types/lifecycleHookInitInfo.ts b/clients/js/src/generated/types/lifecycleHookInitInfo.ts index 789aa1ec..25b54483 100644 --- a/clients/js/src/generated/types/lifecycleHookInitInfo.ts +++ b/clients/js/src/generated/types/lifecycleHookInitInfo.ts @@ -38,6 +38,7 @@ export type LifecycleHookInitInfo = { initPluginAuthority: Option; lifecycleChecks: Option>; extraAccounts: Option>; + dataAuthority: Option; schema: Option; }; @@ -48,6 +49,7 @@ export type LifecycleHookInitInfoArgs = { Array<[HookableLifecycleEventArgs, ExternalCheckResultArgs]> >; extraAccounts: OptionOrNullable>; + dataAuthority: OptionOrNullable; schema: OptionOrNullable; }; @@ -71,6 +73,7 @@ export function getLifecycleHookInitInfoSerializer(): Serializer< ), ], ['extraAccounts', option(array(getExtraAccountSerializer()))], + ['dataAuthority', option(getPluginAuthoritySerializer())], ['schema', option(getExternalPluginSchemaSerializer())], ], { description: 'LifecycleHookInitInfo' } diff --git a/clients/rust/src/generated/instructions/allocate_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/allocate_collection_external_plugin_data_v1.rs new file mode 100644 index 00000000..f7562763 --- /dev/null +++ b/clients/rust/src/generated/instructions/allocate_collection_external_plugin_data_v1.rs @@ -0,0 +1,543 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::ExternalPluginKey; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct AllocateCollectionExternalPluginDataV1 { + /// The address of the asset + pub collection: solana_program::pubkey::Pubkey, + /// The account paying for the storage fees + pub payer: solana_program::pubkey::Pubkey, + /// The owner or delegate of the asset + pub authority: Option, + /// The system program + pub system_program: solana_program::pubkey::Pubkey, + /// The SPL Noop Program + pub log_wrapper: Option, +} + +impl AllocateCollectionExternalPluginDataV1 { + pub fn instruction( + &self, + args: AllocateCollectionExternalPluginDataV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: AllocateCollectionExternalPluginDataV1InstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authority, true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + log_wrapper, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.extend_from_slice(remaining_accounts); + let mut data = AllocateCollectionExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct AllocateCollectionExternalPluginDataV1InstructionData { + discriminator: u8, +} + +impl AllocateCollectionExternalPluginDataV1InstructionData { + fn new() -> Self { + Self { discriminator: 29 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AllocateCollectionExternalPluginDataV1InstructionArgs { + pub key: ExternalPluginKey, + pub target_size: u64, +} + +/// Instruction builder for `AllocateCollectionExternalPluginDataV1`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` collection +/// 1. `[writable, signer]` payer +/// 2. `[signer, optional]` authority +/// 3. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 4. `[optional]` log_wrapper +#[derive(Default)] +pub struct AllocateCollectionExternalPluginDataV1Builder { + collection: Option, + payer: Option, + authority: Option, + system_program: Option, + log_wrapper: Option, + key: Option, + target_size: Option, + __remaining_accounts: Vec, +} + +impl AllocateCollectionExternalPluginDataV1Builder { + pub fn new() -> Self { + Self::default() + } + /// The address of the asset + #[inline(always)] + pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { + self.collection = Some(collection); + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority(&mut self, authority: Option) -> &mut Self { + self.authority = authority; + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + /// The system program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option, + ) -> &mut Self { + self.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.key = Some(key); + self + } + #[inline(always)] + pub fn target_size(&mut self, target_size: u64) -> &mut Self { + self.target_size = Some(target_size); + self + } + /// Add an aditional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = AllocateCollectionExternalPluginDataV1 { + collection: self.collection.expect("collection is not set"), + payer: self.payer.expect("payer is not set"), + authority: self.authority, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + log_wrapper: self.log_wrapper, + }; + let args = AllocateCollectionExternalPluginDataV1InstructionArgs { + key: self.key.clone().expect("key is not set"), + target_size: self.target_size.clone().expect("target_size is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `allocate_collection_external_plugin_data_v1` CPI accounts. +pub struct AllocateCollectionExternalPluginDataV1CpiAccounts<'a, 'b> { + /// The address of the asset + pub collection: &'b solana_program::account_info::AccountInfo<'a>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, +} + +/// `allocate_collection_external_plugin_data_v1` CPI instruction. +pub struct AllocateCollectionExternalPluginDataV1Cpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + /// The address of the asset + pub collection: &'b solana_program::account_info::AccountInfo<'a>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: AllocateCollectionExternalPluginDataV1InstructionArgs, +} + +impl<'a, 'b> AllocateCollectionExternalPluginDataV1Cpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: AllocateCollectionExternalPluginDataV1CpiAccounts<'a, 'b>, + args: AllocateCollectionExternalPluginDataV1InstructionArgs, + ) -> Self { + Self { + __program: program, + collection: accounts.collection, + payer: accounts.payer, + authority: accounts.authority, + system_program: accounts.system_program, + log_wrapper: accounts.log_wrapper, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authority.key, + true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *log_wrapper.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = AllocateCollectionExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.collection.clone()); + account_infos.push(self.payer.clone()); + if let Some(authority) = self.authority { + account_infos.push(authority.clone()); + } + account_infos.push(self.system_program.clone()); + if let Some(log_wrapper) = self.log_wrapper { + account_infos.push(log_wrapper.clone()); + } + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `AllocateCollectionExternalPluginDataV1` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` collection +/// 1. `[writable, signer]` payer +/// 2. `[signer, optional]` authority +/// 3. `[]` system_program +/// 4. `[optional]` log_wrapper +pub struct AllocateCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> AllocateCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new( + AllocateCollectionExternalPluginDataV1CpiBuilderInstruction { + __program: program, + collection: None, + payer: None, + authority: None, + system_program: None, + log_wrapper: None, + key: None, + target_size: None, + __remaining_accounts: Vec::new(), + }, + ); + Self { instruction } + } + /// The address of the asset + #[inline(always)] + pub fn collection( + &mut self, + collection: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority( + &mut self, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.authority = authority; + self + } + /// The system program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.instruction.key = Some(key); + self + } + #[inline(always)] + pub fn target_size(&mut self, target_size: u64) -> &mut Self { + self.instruction.target_size = Some(target_size); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let args = AllocateCollectionExternalPluginDataV1InstructionArgs { + key: self.instruction.key.clone().expect("key is not set"), + target_size: self + .instruction + .target_size + .clone() + .expect("target_size is not set"), + }; + let instruction = AllocateCollectionExternalPluginDataV1Cpi { + __program: self.instruction.__program, + + collection: self.instruction.collection.expect("collection is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + authority: self.instruction.authority, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + log_wrapper: self.instruction.log_wrapper, + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct AllocateCollectionExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + key: Option, + target_size: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/clients/rust/src/generated/instructions/allocate_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/allocate_external_plugin_data_v1.rs new file mode 100644 index 00000000..8c9c74f4 --- /dev/null +++ b/clients/rust/src/generated/instructions/allocate_external_plugin_data_v1.rs @@ -0,0 +1,593 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::ExternalPluginKey; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct AllocateExternalPluginDataV1 { + /// The address of the asset + pub asset: solana_program::pubkey::Pubkey, + /// The collection to which the asset belongs + pub collection: Option, + /// The account paying for the storage fees + pub payer: solana_program::pubkey::Pubkey, + /// The owner or delegate of the asset + pub authority: Option, + /// The system program + pub system_program: solana_program::pubkey::Pubkey, + /// The SPL Noop Program + pub log_wrapper: Option, +} + +impl AllocateExternalPluginDataV1 { + pub fn instruction( + &self, + args: AllocateExternalPluginDataV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: AllocateExternalPluginDataV1InstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.asset, false, + )); + if let Some(collection) = self.collection { + accounts.push(solana_program::instruction::AccountMeta::new( + collection, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authority, true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + log_wrapper, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.extend_from_slice(remaining_accounts); + let mut data = AllocateExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct AllocateExternalPluginDataV1InstructionData { + discriminator: u8, +} + +impl AllocateExternalPluginDataV1InstructionData { + fn new() -> Self { + Self { discriminator: 28 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AllocateExternalPluginDataV1InstructionArgs { + pub key: ExternalPluginKey, + pub target_size: u64, +} + +/// Instruction builder for `AllocateExternalPluginDataV1`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` asset +/// 1. `[writable, optional]` collection +/// 2. `[writable, signer]` payer +/// 3. `[signer, optional]` authority +/// 4. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 5. `[optional]` log_wrapper +#[derive(Default)] +pub struct AllocateExternalPluginDataV1Builder { + asset: Option, + collection: Option, + payer: Option, + authority: Option, + system_program: Option, + log_wrapper: Option, + key: Option, + target_size: Option, + __remaining_accounts: Vec, +} + +impl AllocateExternalPluginDataV1Builder { + pub fn new() -> Self { + Self::default() + } + /// The address of the asset + #[inline(always)] + pub fn asset(&mut self, asset: solana_program::pubkey::Pubkey) -> &mut Self { + self.asset = Some(asset); + self + } + /// `[optional account]` + /// The collection to which the asset belongs + #[inline(always)] + pub fn collection(&mut self, collection: Option) -> &mut Self { + self.collection = collection; + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority(&mut self, authority: Option) -> &mut Self { + self.authority = authority; + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + /// The system program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option, + ) -> &mut Self { + self.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.key = Some(key); + self + } + #[inline(always)] + pub fn target_size(&mut self, target_size: u64) -> &mut Self { + self.target_size = Some(target_size); + self + } + /// Add an aditional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = AllocateExternalPluginDataV1 { + asset: self.asset.expect("asset is not set"), + collection: self.collection, + payer: self.payer.expect("payer is not set"), + authority: self.authority, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + log_wrapper: self.log_wrapper, + }; + let args = AllocateExternalPluginDataV1InstructionArgs { + key: self.key.clone().expect("key is not set"), + target_size: self.target_size.clone().expect("target_size is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `allocate_external_plugin_data_v1` CPI accounts. +pub struct AllocateExternalPluginDataV1CpiAccounts<'a, 'b> { + /// The address of the asset + pub asset: &'b solana_program::account_info::AccountInfo<'a>, + /// The collection to which the asset belongs + pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, +} + +/// `allocate_external_plugin_data_v1` CPI instruction. +pub struct AllocateExternalPluginDataV1Cpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + /// The address of the asset + pub asset: &'b solana_program::account_info::AccountInfo<'a>, + /// The collection to which the asset belongs + pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: AllocateExternalPluginDataV1InstructionArgs, +} + +impl<'a, 'b> AllocateExternalPluginDataV1Cpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: AllocateExternalPluginDataV1CpiAccounts<'a, 'b>, + args: AllocateExternalPluginDataV1InstructionArgs, + ) -> Self { + Self { + __program: program, + asset: accounts.asset, + collection: accounts.collection, + payer: accounts.payer, + authority: accounts.authority, + system_program: accounts.system_program, + log_wrapper: accounts.log_wrapper, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.asset.key, + false, + )); + if let Some(collection) = self.collection { + accounts.push(solana_program::instruction::AccountMeta::new( + *collection.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authority.key, + true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *log_wrapper.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = AllocateExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(6 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.asset.clone()); + if let Some(collection) = self.collection { + account_infos.push(collection.clone()); + } + account_infos.push(self.payer.clone()); + if let Some(authority) = self.authority { + account_infos.push(authority.clone()); + } + account_infos.push(self.system_program.clone()); + if let Some(log_wrapper) = self.log_wrapper { + account_infos.push(log_wrapper.clone()); + } + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `AllocateExternalPluginDataV1` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` asset +/// 1. `[writable, optional]` collection +/// 2. `[writable, signer]` payer +/// 3. `[signer, optional]` authority +/// 4. `[]` system_program +/// 5. `[optional]` log_wrapper +pub struct AllocateExternalPluginDataV1CpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> AllocateExternalPluginDataV1CpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(AllocateExternalPluginDataV1CpiBuilderInstruction { + __program: program, + asset: None, + collection: None, + payer: None, + authority: None, + system_program: None, + log_wrapper: None, + key: None, + target_size: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + /// The address of the asset + #[inline(always)] + pub fn asset(&mut self, asset: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.asset = Some(asset); + self + } + /// `[optional account]` + /// The collection to which the asset belongs + #[inline(always)] + pub fn collection( + &mut self, + collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.collection = collection; + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority( + &mut self, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.authority = authority; + self + } + /// The system program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.instruction.key = Some(key); + self + } + #[inline(always)] + pub fn target_size(&mut self, target_size: u64) -> &mut Self { + self.instruction.target_size = Some(target_size); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let args = AllocateExternalPluginDataV1InstructionArgs { + key: self.instruction.key.clone().expect("key is not set"), + target_size: self + .instruction + .target_size + .clone() + .expect("target_size is not set"), + }; + let instruction = AllocateExternalPluginDataV1Cpi { + __program: self.instruction.__program, + + asset: self.instruction.asset.expect("asset is not set"), + + collection: self.instruction.collection, + + payer: self.instruction.payer.expect("payer is not set"), + + authority: self.instruction.authority, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + log_wrapper: self.instruction.log_wrapper, + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct AllocateExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + asset: Option<&'b solana_program::account_info::AccountInfo<'a>>, + collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + key: Option, + target_size: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs new file mode 100644 index 00000000..4602348d --- /dev/null +++ b/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs @@ -0,0 +1,521 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::ExternalPluginKey; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct ClearCollectionExternalPluginDataV1 { + /// The address of the asset + pub collection: solana_program::pubkey::Pubkey, + /// The account paying for the storage fees + pub payer: solana_program::pubkey::Pubkey, + /// The owner or delegate of the asset + pub authority: Option, + /// The system program + pub system_program: solana_program::pubkey::Pubkey, + /// The SPL Noop Program + pub log_wrapper: Option, +} + +impl ClearCollectionExternalPluginDataV1 { + pub fn instruction( + &self, + args: ClearCollectionExternalPluginDataV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: ClearCollectionExternalPluginDataV1InstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authority, true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + log_wrapper, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.extend_from_slice(remaining_accounts); + let mut data = ClearCollectionExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct ClearCollectionExternalPluginDataV1InstructionData { + discriminator: u8, +} + +impl ClearCollectionExternalPluginDataV1InstructionData { + fn new() -> Self { + Self { discriminator: 33 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ClearCollectionExternalPluginDataV1InstructionArgs { + pub key: ExternalPluginKey, +} + +/// Instruction builder for `ClearCollectionExternalPluginDataV1`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` collection +/// 1. `[writable, signer]` payer +/// 2. `[signer, optional]` authority +/// 3. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 4. `[optional]` log_wrapper +#[derive(Default)] +pub struct ClearCollectionExternalPluginDataV1Builder { + collection: Option, + payer: Option, + authority: Option, + system_program: Option, + log_wrapper: Option, + key: Option, + __remaining_accounts: Vec, +} + +impl ClearCollectionExternalPluginDataV1Builder { + pub fn new() -> Self { + Self::default() + } + /// The address of the asset + #[inline(always)] + pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { + self.collection = Some(collection); + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority(&mut self, authority: Option) -> &mut Self { + self.authority = authority; + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + /// The system program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option, + ) -> &mut Self { + self.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.key = Some(key); + self + } + /// Add an aditional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = ClearCollectionExternalPluginDataV1 { + collection: self.collection.expect("collection is not set"), + payer: self.payer.expect("payer is not set"), + authority: self.authority, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + log_wrapper: self.log_wrapper, + }; + let args = ClearCollectionExternalPluginDataV1InstructionArgs { + key: self.key.clone().expect("key is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `clear_collection_external_plugin_data_v1` CPI accounts. +pub struct ClearCollectionExternalPluginDataV1CpiAccounts<'a, 'b> { + /// The address of the asset + pub collection: &'b solana_program::account_info::AccountInfo<'a>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, +} + +/// `clear_collection_external_plugin_data_v1` CPI instruction. +pub struct ClearCollectionExternalPluginDataV1Cpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + /// The address of the asset + pub collection: &'b solana_program::account_info::AccountInfo<'a>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: ClearCollectionExternalPluginDataV1InstructionArgs, +} + +impl<'a, 'b> ClearCollectionExternalPluginDataV1Cpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: ClearCollectionExternalPluginDataV1CpiAccounts<'a, 'b>, + args: ClearCollectionExternalPluginDataV1InstructionArgs, + ) -> Self { + Self { + __program: program, + collection: accounts.collection, + payer: accounts.payer, + authority: accounts.authority, + system_program: accounts.system_program, + log_wrapper: accounts.log_wrapper, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authority.key, + true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *log_wrapper.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = ClearCollectionExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.collection.clone()); + account_infos.push(self.payer.clone()); + if let Some(authority) = self.authority { + account_infos.push(authority.clone()); + } + account_infos.push(self.system_program.clone()); + if let Some(log_wrapper) = self.log_wrapper { + account_infos.push(log_wrapper.clone()); + } + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `ClearCollectionExternalPluginDataV1` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` collection +/// 1. `[writable, signer]` payer +/// 2. `[signer, optional]` authority +/// 3. `[]` system_program +/// 4. `[optional]` log_wrapper +pub struct ClearCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> ClearCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ClearCollectionExternalPluginDataV1CpiBuilderInstruction { + __program: program, + collection: None, + payer: None, + authority: None, + system_program: None, + log_wrapper: None, + key: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + /// The address of the asset + #[inline(always)] + pub fn collection( + &mut self, + collection: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority( + &mut self, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.authority = authority; + self + } + /// The system program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.instruction.key = Some(key); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let args = ClearCollectionExternalPluginDataV1InstructionArgs { + key: self.instruction.key.clone().expect("key is not set"), + }; + let instruction = ClearCollectionExternalPluginDataV1Cpi { + __program: self.instruction.__program, + + collection: self.instruction.collection.expect("collection is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + authority: self.instruction.authority, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + log_wrapper: self.instruction.log_wrapper, + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct ClearCollectionExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + key: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs new file mode 100644 index 00000000..f08144d9 --- /dev/null +++ b/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs @@ -0,0 +1,573 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::ExternalPluginKey; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct ClearExternalPluginDataV1 { + /// The address of the asset + pub asset: solana_program::pubkey::Pubkey, + /// The collection to which the asset belongs + pub collection: Option, + /// The account paying for the storage fees + pub payer: solana_program::pubkey::Pubkey, + /// The owner or delegate of the asset + pub authority: Option, + /// The system program + pub system_program: solana_program::pubkey::Pubkey, + /// The SPL Noop Program + pub log_wrapper: Option, +} + +impl ClearExternalPluginDataV1 { + pub fn instruction( + &self, + args: ClearExternalPluginDataV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: ClearExternalPluginDataV1InstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.asset, false, + )); + if let Some(collection) = self.collection { + accounts.push(solana_program::instruction::AccountMeta::new( + collection, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authority, true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + log_wrapper, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.extend_from_slice(remaining_accounts); + let mut data = ClearExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct ClearExternalPluginDataV1InstructionData { + discriminator: u8, +} + +impl ClearExternalPluginDataV1InstructionData { + fn new() -> Self { + Self { discriminator: 32 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ClearExternalPluginDataV1InstructionArgs { + pub key: ExternalPluginKey, +} + +/// Instruction builder for `ClearExternalPluginDataV1`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` asset +/// 1. `[writable, optional]` collection +/// 2. `[writable, signer]` payer +/// 3. `[signer, optional]` authority +/// 4. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 5. `[optional]` log_wrapper +#[derive(Default)] +pub struct ClearExternalPluginDataV1Builder { + asset: Option, + collection: Option, + payer: Option, + authority: Option, + system_program: Option, + log_wrapper: Option, + key: Option, + __remaining_accounts: Vec, +} + +impl ClearExternalPluginDataV1Builder { + pub fn new() -> Self { + Self::default() + } + /// The address of the asset + #[inline(always)] + pub fn asset(&mut self, asset: solana_program::pubkey::Pubkey) -> &mut Self { + self.asset = Some(asset); + self + } + /// `[optional account]` + /// The collection to which the asset belongs + #[inline(always)] + pub fn collection(&mut self, collection: Option) -> &mut Self { + self.collection = collection; + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority(&mut self, authority: Option) -> &mut Self { + self.authority = authority; + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + /// The system program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option, + ) -> &mut Self { + self.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.key = Some(key); + self + } + /// Add an aditional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = ClearExternalPluginDataV1 { + asset: self.asset.expect("asset is not set"), + collection: self.collection, + payer: self.payer.expect("payer is not set"), + authority: self.authority, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + log_wrapper: self.log_wrapper, + }; + let args = ClearExternalPluginDataV1InstructionArgs { + key: self.key.clone().expect("key is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `clear_external_plugin_data_v1` CPI accounts. +pub struct ClearExternalPluginDataV1CpiAccounts<'a, 'b> { + /// The address of the asset + pub asset: &'b solana_program::account_info::AccountInfo<'a>, + /// The collection to which the asset belongs + pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, +} + +/// `clear_external_plugin_data_v1` CPI instruction. +pub struct ClearExternalPluginDataV1Cpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + /// The address of the asset + pub asset: &'b solana_program::account_info::AccountInfo<'a>, + /// The collection to which the asset belongs + pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: ClearExternalPluginDataV1InstructionArgs, +} + +impl<'a, 'b> ClearExternalPluginDataV1Cpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: ClearExternalPluginDataV1CpiAccounts<'a, 'b>, + args: ClearExternalPluginDataV1InstructionArgs, + ) -> Self { + Self { + __program: program, + asset: accounts.asset, + collection: accounts.collection, + payer: accounts.payer, + authority: accounts.authority, + system_program: accounts.system_program, + log_wrapper: accounts.log_wrapper, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.asset.key, + false, + )); + if let Some(collection) = self.collection { + accounts.push(solana_program::instruction::AccountMeta::new( + *collection.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authority.key, + true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *log_wrapper.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = ClearExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(6 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.asset.clone()); + if let Some(collection) = self.collection { + account_infos.push(collection.clone()); + } + account_infos.push(self.payer.clone()); + if let Some(authority) = self.authority { + account_infos.push(authority.clone()); + } + account_infos.push(self.system_program.clone()); + if let Some(log_wrapper) = self.log_wrapper { + account_infos.push(log_wrapper.clone()); + } + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `ClearExternalPluginDataV1` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` asset +/// 1. `[writable, optional]` collection +/// 2. `[writable, signer]` payer +/// 3. `[signer, optional]` authority +/// 4. `[]` system_program +/// 5. `[optional]` log_wrapper +pub struct ClearExternalPluginDataV1CpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> ClearExternalPluginDataV1CpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ClearExternalPluginDataV1CpiBuilderInstruction { + __program: program, + asset: None, + collection: None, + payer: None, + authority: None, + system_program: None, + log_wrapper: None, + key: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + /// The address of the asset + #[inline(always)] + pub fn asset(&mut self, asset: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.asset = Some(asset); + self + } + /// `[optional account]` + /// The collection to which the asset belongs + #[inline(always)] + pub fn collection( + &mut self, + collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.collection = collection; + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority( + &mut self, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.authority = authority; + self + } + /// The system program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.instruction.key = Some(key); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let args = ClearExternalPluginDataV1InstructionArgs { + key: self.instruction.key.clone().expect("key is not set"), + }; + let instruction = ClearExternalPluginDataV1Cpi { + __program: self.instruction.__program, + + asset: self.instruction.asset.expect("asset is not set"), + + collection: self.instruction.collection, + + payer: self.instruction.payer.expect("payer is not set"), + + authority: self.instruction.authority, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + log_wrapper: self.instruction.log_wrapper, + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct ClearExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + asset: Option<&'b solana_program::account_info::AccountInfo<'a>>, + collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + key: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/clients/rust/src/generated/instructions/mod.rs b/clients/rust/src/generated/instructions/mod.rs index 73ca2983..c53cc1a7 100644 --- a/clients/rust/src/generated/instructions/mod.rs +++ b/clients/rust/src/generated/instructions/mod.rs @@ -9,10 +9,14 @@ pub(crate) mod r#add_collection_external_plugin_v1; pub(crate) mod r#add_collection_plugin_v1; pub(crate) mod r#add_external_plugin_v1; pub(crate) mod r#add_plugin_v1; +pub(crate) mod r#allocate_collection_external_plugin_data_v1; +pub(crate) mod r#allocate_external_plugin_data_v1; pub(crate) mod r#approve_collection_plugin_authority_v1; pub(crate) mod r#approve_plugin_authority_v1; pub(crate) mod r#burn_collection_v1; pub(crate) mod r#burn_v1; +pub(crate) mod r#clear_collection_external_plugin_data_v1; +pub(crate) mod r#clear_external_plugin_data_v1; pub(crate) mod r#collect; pub(crate) mod r#compress_v1; pub(crate) mod r#create_collection_v1; @@ -33,15 +37,21 @@ pub(crate) mod r#update_collection_v1; pub(crate) mod r#update_external_plugin_v1; pub(crate) mod r#update_plugin_v1; pub(crate) mod r#update_v1; +pub(crate) mod r#write_collection_external_plugin_data_v1; +pub(crate) mod r#write_external_plugin_data_v1; pub use self::r#add_collection_external_plugin_v1::*; pub use self::r#add_collection_plugin_v1::*; pub use self::r#add_external_plugin_v1::*; pub use self::r#add_plugin_v1::*; +pub use self::r#allocate_collection_external_plugin_data_v1::*; +pub use self::r#allocate_external_plugin_data_v1::*; pub use self::r#approve_collection_plugin_authority_v1::*; pub use self::r#approve_plugin_authority_v1::*; pub use self::r#burn_collection_v1::*; pub use self::r#burn_v1::*; +pub use self::r#clear_collection_external_plugin_data_v1::*; +pub use self::r#clear_external_plugin_data_v1::*; pub use self::r#collect::*; pub use self::r#compress_v1::*; pub use self::r#create_collection_v1::*; @@ -62,3 +72,5 @@ pub use self::r#update_collection_v1::*; pub use self::r#update_external_plugin_v1::*; pub use self::r#update_plugin_v1::*; pub use self::r#update_v1::*; +pub use self::r#write_collection_external_plugin_data_v1::*; +pub use self::r#write_external_plugin_data_v1::*; diff --git a/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs new file mode 100644 index 00000000..c12cd303 --- /dev/null +++ b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs @@ -0,0 +1,553 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::ExternalPluginKey; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct WriteCollectionExternalPluginDataV1 { + /// The address of the asset + pub collection: solana_program::pubkey::Pubkey, + /// The account paying for the storage fees + pub payer: solana_program::pubkey::Pubkey, + /// The owner or delegate of the asset + pub authority: Option, + /// The system program + pub system_program: solana_program::pubkey::Pubkey, + /// The SPL Noop Program + pub log_wrapper: Option, +} + +impl WriteCollectionExternalPluginDataV1 { + pub fn instruction( + &self, + args: WriteCollectionExternalPluginDataV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: WriteCollectionExternalPluginDataV1InstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authority, true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + log_wrapper, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.extend_from_slice(remaining_accounts); + let mut data = WriteCollectionExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct WriteCollectionExternalPluginDataV1InstructionData { + discriminator: u8, +} + +impl WriteCollectionExternalPluginDataV1InstructionData { + fn new() -> Self { + Self { discriminator: 31 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct WriteCollectionExternalPluginDataV1InstructionArgs { + pub key: ExternalPluginKey, + pub offset: u64, + pub data: Vec, +} + +/// Instruction builder for `WriteCollectionExternalPluginDataV1`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` collection +/// 1. `[writable, signer]` payer +/// 2. `[signer, optional]` authority +/// 3. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 4. `[optional]` log_wrapper +#[derive(Default)] +pub struct WriteCollectionExternalPluginDataV1Builder { + collection: Option, + payer: Option, + authority: Option, + system_program: Option, + log_wrapper: Option, + key: Option, + offset: Option, + data: Option>, + __remaining_accounts: Vec, +} + +impl WriteCollectionExternalPluginDataV1Builder { + pub fn new() -> Self { + Self::default() + } + /// The address of the asset + #[inline(always)] + pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { + self.collection = Some(collection); + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority(&mut self, authority: Option) -> &mut Self { + self.authority = authority; + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + /// The system program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option, + ) -> &mut Self { + self.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.key = Some(key); + self + } + #[inline(always)] + pub fn offset(&mut self, offset: u64) -> &mut Self { + self.offset = Some(offset); + self + } + #[inline(always)] + pub fn data(&mut self, data: Vec) -> &mut Self { + self.data = Some(data); + self + } + /// Add an aditional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = WriteCollectionExternalPluginDataV1 { + collection: self.collection.expect("collection is not set"), + payer: self.payer.expect("payer is not set"), + authority: self.authority, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + log_wrapper: self.log_wrapper, + }; + let args = WriteCollectionExternalPluginDataV1InstructionArgs { + key: self.key.clone().expect("key is not set"), + offset: self.offset.clone().expect("offset is not set"), + data: self.data.clone().expect("data is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `write_collection_external_plugin_data_v1` CPI accounts. +pub struct WriteCollectionExternalPluginDataV1CpiAccounts<'a, 'b> { + /// The address of the asset + pub collection: &'b solana_program::account_info::AccountInfo<'a>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, +} + +/// `write_collection_external_plugin_data_v1` CPI instruction. +pub struct WriteCollectionExternalPluginDataV1Cpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + /// The address of the asset + pub collection: &'b solana_program::account_info::AccountInfo<'a>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: WriteCollectionExternalPluginDataV1InstructionArgs, +} + +impl<'a, 'b> WriteCollectionExternalPluginDataV1Cpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: WriteCollectionExternalPluginDataV1CpiAccounts<'a, 'b>, + args: WriteCollectionExternalPluginDataV1InstructionArgs, + ) -> Self { + Self { + __program: program, + collection: accounts.collection, + payer: accounts.payer, + authority: accounts.authority, + system_program: accounts.system_program, + log_wrapper: accounts.log_wrapper, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authority.key, + true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *log_wrapper.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = WriteCollectionExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(5 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.collection.clone()); + account_infos.push(self.payer.clone()); + if let Some(authority) = self.authority { + account_infos.push(authority.clone()); + } + account_infos.push(self.system_program.clone()); + if let Some(log_wrapper) = self.log_wrapper { + account_infos.push(log_wrapper.clone()); + } + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `WriteCollectionExternalPluginDataV1` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` collection +/// 1. `[writable, signer]` payer +/// 2. `[signer, optional]` authority +/// 3. `[]` system_program +/// 4. `[optional]` log_wrapper +pub struct WriteCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> WriteCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(WriteCollectionExternalPluginDataV1CpiBuilderInstruction { + __program: program, + collection: None, + payer: None, + authority: None, + system_program: None, + log_wrapper: None, + key: None, + offset: None, + data: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + /// The address of the asset + #[inline(always)] + pub fn collection( + &mut self, + collection: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection = Some(collection); + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority( + &mut self, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.authority = authority; + self + } + /// The system program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.instruction.key = Some(key); + self + } + #[inline(always)] + pub fn offset(&mut self, offset: u64) -> &mut Self { + self.instruction.offset = Some(offset); + self + } + #[inline(always)] + pub fn data(&mut self, data: Vec) -> &mut Self { + self.instruction.data = Some(data); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let args = WriteCollectionExternalPluginDataV1InstructionArgs { + key: self.instruction.key.clone().expect("key is not set"), + offset: self.instruction.offset.clone().expect("offset is not set"), + data: self.instruction.data.clone().expect("data is not set"), + }; + let instruction = WriteCollectionExternalPluginDataV1Cpi { + __program: self.instruction.__program, + + collection: self.instruction.collection.expect("collection is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + authority: self.instruction.authority, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + log_wrapper: self.instruction.log_wrapper, + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct WriteCollectionExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + key: Option, + offset: Option, + data: Option>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs new file mode 100644 index 00000000..33b9e4b5 --- /dev/null +++ b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs @@ -0,0 +1,605 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use crate::generated::types::ExternalPluginKey; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct WriteExternalPluginDataV1 { + /// The address of the asset + pub asset: solana_program::pubkey::Pubkey, + /// The collection to which the asset belongs + pub collection: Option, + /// The account paying for the storage fees + pub payer: solana_program::pubkey::Pubkey, + /// The owner or delegate of the asset + pub authority: Option, + /// The system program + pub system_program: solana_program::pubkey::Pubkey, + /// The SPL Noop Program + pub log_wrapper: Option, +} + +impl WriteExternalPluginDataV1 { + pub fn instruction( + &self, + args: WriteExternalPluginDataV1InstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: WriteExternalPluginDataV1InstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.asset, false, + )); + if let Some(collection) = self.collection { + accounts.push(solana_program::instruction::AccountMeta::new( + collection, false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + authority, true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + log_wrapper, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.extend_from_slice(remaining_accounts); + let mut data = WriteExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct WriteExternalPluginDataV1InstructionData { + discriminator: u8, +} + +impl WriteExternalPluginDataV1InstructionData { + fn new() -> Self { + Self { discriminator: 30 } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct WriteExternalPluginDataV1InstructionArgs { + pub key: ExternalPluginKey, + pub offset: u64, + pub data: Vec, +} + +/// Instruction builder for `WriteExternalPluginDataV1`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` asset +/// 1. `[writable, optional]` collection +/// 2. `[writable, signer]` payer +/// 3. `[signer, optional]` authority +/// 4. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 5. `[optional]` log_wrapper +#[derive(Default)] +pub struct WriteExternalPluginDataV1Builder { + asset: Option, + collection: Option, + payer: Option, + authority: Option, + system_program: Option, + log_wrapper: Option, + key: Option, + offset: Option, + data: Option>, + __remaining_accounts: Vec, +} + +impl WriteExternalPluginDataV1Builder { + pub fn new() -> Self { + Self::default() + } + /// The address of the asset + #[inline(always)] + pub fn asset(&mut self, asset: solana_program::pubkey::Pubkey) -> &mut Self { + self.asset = Some(asset); + self + } + /// `[optional account]` + /// The collection to which the asset belongs + #[inline(always)] + pub fn collection(&mut self, collection: Option) -> &mut Self { + self.collection = collection; + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority(&mut self, authority: Option) -> &mut Self { + self.authority = authority; + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + /// The system program + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option, + ) -> &mut Self { + self.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.key = Some(key); + self + } + #[inline(always)] + pub fn offset(&mut self, offset: u64) -> &mut Self { + self.offset = Some(offset); + self + } + #[inline(always)] + pub fn data(&mut self, data: Vec) -> &mut Self { + self.data = Some(data); + self + } + /// Add an aditional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = WriteExternalPluginDataV1 { + asset: self.asset.expect("asset is not set"), + collection: self.collection, + payer: self.payer.expect("payer is not set"), + authority: self.authority, + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + log_wrapper: self.log_wrapper, + }; + let args = WriteExternalPluginDataV1InstructionArgs { + key: self.key.clone().expect("key is not set"), + offset: self.offset.clone().expect("offset is not set"), + data: self.data.clone().expect("data is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `write_external_plugin_data_v1` CPI accounts. +pub struct WriteExternalPluginDataV1CpiAccounts<'a, 'b> { + /// The address of the asset + pub asset: &'b solana_program::account_info::AccountInfo<'a>, + /// The collection to which the asset belongs + pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, +} + +/// `write_external_plugin_data_v1` CPI instruction. +pub struct WriteExternalPluginDataV1Cpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + /// The address of the asset + pub asset: &'b solana_program::account_info::AccountInfo<'a>, + /// The collection to which the asset belongs + pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The account paying for the storage fees + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + /// The owner or delegate of the asset + pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The system program + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The SPL Noop Program + pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// The arguments for the instruction. + pub __args: WriteExternalPluginDataV1InstructionArgs, +} + +impl<'a, 'b> WriteExternalPluginDataV1Cpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: WriteExternalPluginDataV1CpiAccounts<'a, 'b>, + args: WriteExternalPluginDataV1InstructionArgs, + ) -> Self { + Self { + __program: program, + asset: accounts.asset, + collection: accounts.collection, + payer: accounts.payer, + authority: accounts.authority, + system_program: accounts.system_program, + log_wrapper: accounts.log_wrapper, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.asset.key, + false, + )); + if let Some(collection) = self.collection { + accounts.push(solana_program::instruction::AccountMeta::new( + *collection.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + if let Some(authority) = self.authority { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *authority.key, + true, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + if let Some(log_wrapper) = self.log_wrapper { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *log_wrapper.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_CORE_ID, + false, + )); + } + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = WriteExternalPluginDataV1InstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = self.__args.try_to_vec().unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::MPL_CORE_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(6 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.asset.clone()); + if let Some(collection) = self.collection { + account_infos.push(collection.clone()); + } + account_infos.push(self.payer.clone()); + if let Some(authority) = self.authority { + account_infos.push(authority.clone()); + } + account_infos.push(self.system_program.clone()); + if let Some(log_wrapper) = self.log_wrapper { + account_infos.push(log_wrapper.clone()); + } + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `WriteExternalPluginDataV1` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` asset +/// 1. `[writable, optional]` collection +/// 2. `[writable, signer]` payer +/// 3. `[signer, optional]` authority +/// 4. `[]` system_program +/// 5. `[optional]` log_wrapper +pub struct WriteExternalPluginDataV1CpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> WriteExternalPluginDataV1CpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(WriteExternalPluginDataV1CpiBuilderInstruction { + __program: program, + asset: None, + collection: None, + payer: None, + authority: None, + system_program: None, + log_wrapper: None, + key: None, + offset: None, + data: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + /// The address of the asset + #[inline(always)] + pub fn asset(&mut self, asset: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.asset = Some(asset); + self + } + /// `[optional account]` + /// The collection to which the asset belongs + #[inline(always)] + pub fn collection( + &mut self, + collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.collection = collection; + self + } + /// The account paying for the storage fees + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// `[optional account]` + /// The owner or delegate of the asset + #[inline(always)] + pub fn authority( + &mut self, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.authority = authority; + self + } + /// The system program + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional account]` + /// The SPL Noop Program + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.log_wrapper = log_wrapper; + self + } + #[inline(always)] + pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { + self.instruction.key = Some(key); + self + } + #[inline(always)] + pub fn offset(&mut self, offset: u64) -> &mut Self { + self.instruction.offset = Some(offset); + self + } + #[inline(always)] + pub fn data(&mut self, data: Vec) -> &mut Self { + self.instruction.data = Some(data); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let args = WriteExternalPluginDataV1InstructionArgs { + key: self.instruction.key.clone().expect("key is not set"), + offset: self.instruction.offset.clone().expect("offset is not set"), + data: self.instruction.data.clone().expect("data is not set"), + }; + let instruction = WriteExternalPluginDataV1Cpi { + __program: self.instruction.__program, + + asset: self.instruction.asset.expect("asset is not set"), + + collection: self.instruction.collection, + + payer: self.instruction.payer.expect("payer is not set"), + + authority: self.instruction.authority, + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + log_wrapper: self.instruction.log_wrapper, + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct WriteExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + asset: Option<&'b solana_program::account_info::AccountInfo<'a>>, + collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + key: Option, + offset: Option, + data: Option>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/clients/rust/src/generated/types/external_plugin_schema.rs b/clients/rust/src/generated/types/external_plugin_schema.rs index 3d54f031..c75e7616 100644 --- a/clients/rust/src/generated/types/external_plugin_schema.rs +++ b/clients/rust/src/generated/types/external_plugin_schema.rs @@ -7,8 +7,11 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; +use num_derive::FromPrimitive; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +#[derive( + BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, +)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum ExternalPluginSchema { Binary, diff --git a/clients/rust/src/generated/types/external_plugin_type.rs b/clients/rust/src/generated/types/external_plugin_type.rs index cfdc4fda..8f3795c6 100644 --- a/clients/rust/src/generated/types/external_plugin_type.rs +++ b/clients/rust/src/generated/types/external_plugin_type.rs @@ -7,8 +7,11 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; +use num_derive::FromPrimitive; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +#[derive( + BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, +)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum ExternalPluginType { LifecycleHook, diff --git a/clients/rust/src/generated/types/hookable_lifecycle_event.rs b/clients/rust/src/generated/types/hookable_lifecycle_event.rs index b0a4a6b3..2fcfe611 100644 --- a/clients/rust/src/generated/types/hookable_lifecycle_event.rs +++ b/clients/rust/src/generated/types/hookable_lifecycle_event.rs @@ -7,8 +7,11 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; +use num_derive::FromPrimitive; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +#[derive( + BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, +)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum HookableLifecycleEvent { Create, diff --git a/clients/rust/src/generated/types/lifecycle_hook.rs b/clients/rust/src/generated/types/lifecycle_hook.rs index 64b4c1a8..44f9c95f 100644 --- a/clients/rust/src/generated/types/lifecycle_hook.rs +++ b/clients/rust/src/generated/types/lifecycle_hook.rs @@ -7,6 +7,7 @@ use crate::generated::types::ExternalPluginSchema; use crate::generated::types::ExtraAccount; +use crate::generated::types::PluginAuthority; use borsh::BorshDeserialize; use borsh::BorshSerialize; use solana_program::pubkey::Pubkey; @@ -20,6 +21,7 @@ pub struct LifecycleHook { )] pub hooked_program: Pubkey, pub extra_accounts: Option>, + pub data_authority: Option, pub schema: ExternalPluginSchema, pub data_offset: u64, pub data_len: u64, diff --git a/clients/rust/src/generated/types/lifecycle_hook_init_info.rs b/clients/rust/src/generated/types/lifecycle_hook_init_info.rs index 1c333f80..4a032a1f 100644 --- a/clients/rust/src/generated/types/lifecycle_hook_init_info.rs +++ b/clients/rust/src/generated/types/lifecycle_hook_init_info.rs @@ -25,5 +25,6 @@ pub struct LifecycleHookInitInfo { pub init_plugin_authority: Option, pub lifecycle_checks: Option>, pub extra_accounts: Option>, + pub data_authority: Option, pub schema: Option, } diff --git a/clients/rust/src/generated/types/validation_result.rs b/clients/rust/src/generated/types/validation_result.rs index 4ecdb3ab..2a4a59d5 100644 --- a/clients/rust/src/generated/types/validation_result.rs +++ b/clients/rust/src/generated/types/validation_result.rs @@ -7,8 +7,11 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; +use num_derive::FromPrimitive; -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] +#[derive( + BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq, PartialOrd, Hash, FromPrimitive, +)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum ValidationResult { Approved, diff --git a/idls/mpl_core.json b/idls/mpl_core.json index f997a93d..9832d60d 100644 --- a/idls/mpl_core.json +++ b/idls/mpl_core.json @@ -1784,6 +1784,387 @@ "type": "u8", "value": 27 } + }, + { + "name": "AllocateExternalPluginDataV1", + "accounts": [ + { + "name": "asset", + "isMut": true, + "isSigner": false, + "docs": [ + "The address of the asset" + ] + }, + { + "name": "collection", + "isMut": true, + "isSigner": false, + "isOptional": true, + "docs": [ + "The collection to which the asset belongs" + ] + }, + { + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "The account paying for the storage fees" + ] + }, + { + "name": "authority", + "isMut": false, + "isSigner": true, + "isOptional": true, + "docs": [ + "The owner or delegate of the asset" + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "The system program" + ] + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false, + "isOptional": true, + "docs": [ + "The SPL Noop Program" + ] + } + ], + "args": [ + { + "name": "allocateExternalPluginDataV1Args", + "type": { + "defined": "AllocateExternalPluginDataV1Args" + } + } + ], + "discriminant": { + "type": "u8", + "value": 28 + } + }, + { + "name": "AllocateCollectionExternalPluginDataV1", + "accounts": [ + { + "name": "collection", + "isMut": true, + "isSigner": false, + "docs": [ + "The address of the asset" + ] + }, + { + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "The account paying for the storage fees" + ] + }, + { + "name": "authority", + "isMut": false, + "isSigner": true, + "isOptional": true, + "docs": [ + "The owner or delegate of the asset" + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "The system program" + ] + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false, + "isOptional": true, + "docs": [ + "The SPL Noop Program" + ] + } + ], + "args": [ + { + "name": "allocateCollectionExternalPluginDataV1Args", + "type": { + "defined": "AllocateCollectionExternalPluginDataV1Args" + } + } + ], + "discriminant": { + "type": "u8", + "value": 29 + } + }, + { + "name": "WriteExternalPluginDataV1", + "accounts": [ + { + "name": "asset", + "isMut": true, + "isSigner": false, + "docs": [ + "The address of the asset" + ] + }, + { + "name": "collection", + "isMut": true, + "isSigner": false, + "isOptional": true, + "docs": [ + "The collection to which the asset belongs" + ] + }, + { + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "The account paying for the storage fees" + ] + }, + { + "name": "authority", + "isMut": false, + "isSigner": true, + "isOptional": true, + "docs": [ + "The owner or delegate of the asset" + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "The system program" + ] + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false, + "isOptional": true, + "docs": [ + "The SPL Noop Program" + ] + } + ], + "args": [ + { + "name": "writeExternalPluginDataV1Args", + "type": { + "defined": "WriteExternalPluginDataV1Args" + } + } + ], + "discriminant": { + "type": "u8", + "value": 30 + } + }, + { + "name": "WriteCollectionExternalPluginDataV1", + "accounts": [ + { + "name": "collection", + "isMut": true, + "isSigner": false, + "docs": [ + "The address of the asset" + ] + }, + { + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "The account paying for the storage fees" + ] + }, + { + "name": "authority", + "isMut": false, + "isSigner": true, + "isOptional": true, + "docs": [ + "The owner or delegate of the asset" + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "The system program" + ] + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false, + "isOptional": true, + "docs": [ + "The SPL Noop Program" + ] + } + ], + "args": [ + { + "name": "writeCollectionExternalPluginDataV1Args", + "type": { + "defined": "WriteCollectionExternalPluginDataV1Args" + } + } + ], + "discriminant": { + "type": "u8", + "value": 31 + } + }, + { + "name": "ClearExternalPluginDataV1", + "accounts": [ + { + "name": "asset", + "isMut": true, + "isSigner": false, + "docs": [ + "The address of the asset" + ] + }, + { + "name": "collection", + "isMut": true, + "isSigner": false, + "isOptional": true, + "docs": [ + "The collection to which the asset belongs" + ] + }, + { + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "The account paying for the storage fees" + ] + }, + { + "name": "authority", + "isMut": false, + "isSigner": true, + "isOptional": true, + "docs": [ + "The owner or delegate of the asset" + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "The system program" + ] + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false, + "isOptional": true, + "docs": [ + "The SPL Noop Program" + ] + } + ], + "args": [ + { + "name": "clearExternalPluginDataV1Args", + "type": { + "defined": "ClearExternalPluginDataV1Args" + } + } + ], + "discriminant": { + "type": "u8", + "value": 32 + } + }, + { + "name": "ClearCollectionExternalPluginDataV1", + "accounts": [ + { + "name": "collection", + "isMut": true, + "isSigner": false, + "docs": [ + "The address of the asset" + ] + }, + { + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "The account paying for the storage fees" + ] + }, + { + "name": "authority", + "isMut": false, + "isSigner": true, + "isOptional": true, + "docs": [ + "The owner or delegate of the asset" + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "The system program" + ] + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false, + "isOptional": true, + "docs": [ + "The SPL Noop Program" + ] + } + ], + "args": [ + { + "name": "clearCollectionExternalPluginDataV1Args", + "type": { + "defined": "ClearCollectionExternalPluginDataV1Args" + } + } + ], + "discriminant": { + "type": "u8", + "value": 33 + } } ], "accounts": [ @@ -2122,6 +2503,14 @@ } } }, + { + "name": "dataAuthority", + "type": { + "option": { + "defined": "Authority" + } + } + }, { "name": "schema", "type": { @@ -2183,6 +2572,14 @@ } } }, + { + "name": "dataAuthority", + "type": { + "option": { + "defined": "Authority" + } + } + }, { "name": "schema", "type": { @@ -2561,6 +2958,42 @@ ] } }, + { + "name": "AllocateExternalPluginDataV1Args", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "ExternalPluginKey" + } + }, + { + "name": "targetSize", + "type": "u64" + } + ] + } + }, + { + "name": "AllocateCollectionExternalPluginDataV1Args", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "ExternalPluginKey" + } + }, + { + "name": "targetSize", + "type": "u64" + } + ] + } + }, { "name": "ApprovePluginAuthorityV1Args", "type": { @@ -2633,6 +3066,34 @@ ] } }, + { + "name": "ClearExternalPluginDataV1Args", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "ExternalPluginKey" + } + } + ] + } + }, + { + "name": "ClearCollectionExternalPluginDataV1Args", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "ExternalPluginKey" + } + } + ] + } + }, { "name": "CompressV1Args", "type": { @@ -3006,6 +3467,50 @@ ] } }, + { + "name": "WriteExternalPluginDataV1Args", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "ExternalPluginKey" + } + }, + { + "name": "offset", + "type": "u64" + }, + { + "name": "data", + "type": "bytes" + } + ] + } + }, + { + "name": "WriteCollectionExternalPluginDataV1Args", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "ExternalPluginKey" + } + }, + { + "name": "offset", + "type": "u64" + }, + { + "name": "data", + "type": "bytes" + } + ] + } + }, { "name": "CompressionProof", "type": { diff --git a/programs/mpl-core/src/instruction.rs b/programs/mpl-core/src/instruction.rs index ac669c39..03c17e08 100644 --- a/programs/mpl-core/src/instruction.rs +++ b/programs/mpl-core/src/instruction.rs @@ -4,13 +4,16 @@ use shank::{ShankContext, ShankInstruction}; use crate::processor::{ AddCollectionExternalPluginV1Args, AddCollectionPluginV1Args, AddExternalPluginV1Args, - AddPluginV1Args, ApproveCollectionPluginAuthorityV1Args, ApprovePluginAuthorityV1Args, - BurnCollectionV1Args, BurnV1Args, CompressV1Args, CreateCollectionV1Args, - CreateCollectionV2Args, CreateV1Args, CreateV2Args, DecompressV1Args, - RemoveCollectionExternalPluginV1Args, RemoveCollectionPluginV1Args, RemoveExternalPluginV1Args, - RemovePluginV1Args, RevokeCollectionPluginAuthorityV1Args, RevokePluginAuthorityV1Args, - TransferV1Args, UpdateCollectionExternalPluginV1Args, UpdateCollectionPluginV1Args, - UpdateCollectionV1Args, UpdateExternalPluginV1Args, UpdatePluginV1Args, UpdateV1Args, + AddPluginV1Args, AllocateCollectionExternalPluginDataV1Args, AllocateExternalPluginDataV1Args, + ApproveCollectionPluginAuthorityV1Args, ApprovePluginAuthorityV1Args, BurnCollectionV1Args, + BurnV1Args, ClearCollectionExternalPluginDataV1Args, ClearExternalPluginDataV1Args, + CompressV1Args, CreateCollectionV1Args, CreateCollectionV2Args, CreateV1Args, CreateV2Args, + DecompressV1Args, RemoveCollectionExternalPluginV1Args, RemoveCollectionPluginV1Args, + RemoveExternalPluginV1Args, RemovePluginV1Args, RevokeCollectionPluginAuthorityV1Args, + RevokePluginAuthorityV1Args, TransferV1Args, UpdateCollectionExternalPluginV1Args, + UpdateCollectionPluginV1Args, UpdateCollectionV1Args, UpdateExternalPluginV1Args, + UpdatePluginV1Args, UpdateV1Args, WriteCollectionExternalPluginDataV1Args, + WriteExternalPluginDataV1Args, }; /// Instructions supported by the mpl-core program. @@ -261,4 +264,55 @@ pub(crate) enum MplAssetInstruction { #[account(3, name="system_program", desc = "The system program")] #[account(4, optional, name="log_wrapper", desc = "The SPL Noop Program")] UpdateCollectionExternalPluginV1(UpdateCollectionExternalPluginV1Args), + + /// Add an external plugin to an mpl-core. + #[account(0, writable, name="asset", desc = "The address of the asset")] + #[account(1, optional, writable, name="collection", desc = "The collection to which the asset belongs")] + #[account(2, writable, signer, name="payer", desc = "The account paying for the storage fees")] + #[account(3, optional, signer, name="authority", desc = "The owner or delegate of the asset")] + #[account(4, name="system_program", desc = "The system program")] + #[account(5, optional, name="log_wrapper", desc = "The SPL Noop Program")] + AllocateExternalPluginDataV1(AllocateExternalPluginDataV1Args), + + /// Add an external plugin to an mpl-core. + #[account(0, writable, name="collection", desc = "The address of the asset")] + #[account(1, writable, signer, name="payer", desc = "The account paying for the storage fees")] + #[account(2, optional, signer, name="authority", desc = "The owner or delegate of the asset")] + #[account(3, name="system_program", desc = "The system program")] + #[account(4, optional, name="log_wrapper", desc = "The SPL Noop Program")] + AllocateCollectionExternalPluginDataV1(AllocateCollectionExternalPluginDataV1Args), + + /// Add an external plugin to an mpl-core. + #[account(0, writable, name="asset", desc = "The address of the asset")] + #[account(1, optional, writable, name="collection", desc = "The collection to which the asset belongs")] + #[account(2, writable, signer, name="payer", desc = "The account paying for the storage fees")] + #[account(3, optional, signer, name="authority", desc = "The owner or delegate of the asset")] + #[account(4, name="system_program", desc = "The system program")] + #[account(5, optional, name="log_wrapper", desc = "The SPL Noop Program")] + WriteExternalPluginDataV1(WriteExternalPluginDataV1Args), + + /// Add an external plugin to an mpl-core. + #[account(0, writable, name="collection", desc = "The address of the asset")] + #[account(1, writable, signer, name="payer", desc = "The account paying for the storage fees")] + #[account(2, optional, signer, name="authority", desc = "The owner or delegate of the asset")] + #[account(3, name="system_program", desc = "The system program")] + #[account(4, optional, name="log_wrapper", desc = "The SPL Noop Program")] + WriteCollectionExternalPluginDataV1(WriteCollectionExternalPluginDataV1Args), + + /// Add an external plugin to an mpl-core. + #[account(0, writable, name="asset", desc = "The address of the asset")] + #[account(1, optional, writable, name="collection", desc = "The collection to which the asset belongs")] + #[account(2, writable, signer, name="payer", desc = "The account paying for the storage fees")] + #[account(3, optional, signer, name="authority", desc = "The owner or delegate of the asset")] + #[account(4, name="system_program", desc = "The system program")] + #[account(5, optional, name="log_wrapper", desc = "The SPL Noop Program")] + ClearExternalPluginDataV1(ClearExternalPluginDataV1Args), + + /// Add an external plugin to an mpl-core. + #[account(0, writable, name="collection", desc = "The address of the asset")] + #[account(1, writable, signer, name="payer", desc = "The account paying for the storage fees")] + #[account(2, optional, signer, name="authority", desc = "The owner or delegate of the asset")] + #[account(3, name="system_program", desc = "The system program")] + #[account(4, optional, name="log_wrapper", desc = "The SPL Noop Program")] + ClearCollectionExternalPluginDataV1(ClearCollectionExternalPluginDataV1Args), } diff --git a/programs/mpl-core/src/plugins/data_store.rs b/programs/mpl-core/src/plugins/data_store.rs index 214a2c81..01b4edf1 100644 --- a/programs/mpl-core/src/plugins/data_store.rs +++ b/programs/mpl-core/src/plugins/data_store.rs @@ -23,8 +23,8 @@ pub struct DataStore { /// Data store initialization info. #[derive(Clone, Debug, BorshSerialize, BorshDeserialize, Eq, PartialEq)] pub struct DataStoreInitInfo { - /// Data authority who can update the data store. Cannot be changed after plugin is - /// added. + /// Data authority who can update the data store. This field cannot be + /// changed after the plugin is added. pub data_authority: Authority, /// Initial plugin authority who can update plugin properties. pub init_plugin_authority: Option, diff --git a/programs/mpl-core/src/plugins/lifecycle_hook.rs b/programs/mpl-core/src/plugins/lifecycle_hook.rs index c3a079b3..8e35986f 100644 --- a/programs/mpl-core/src/plugins/lifecycle_hook.rs +++ b/programs/mpl-core/src/plugins/lifecycle_hook.rs @@ -17,6 +17,10 @@ pub struct LifecycleHook { pub hooked_program: Pubkey, /// The extra accounts to use for the lifecycle hook. pub extra_accounts: Option>, + /// Data authority who can update the Lifecycle Hook data. This can be for the purposes. + /// of initialization of data, or schema migration. This field cannot be changed after + /// the plugin is added. + pub data_authority: Option, /// Schema for the data used by the plugin. pub schema: ExternalPluginSchema, /// The offset to the plugin data in the account. @@ -36,6 +40,10 @@ pub struct LifecycleHookInitInfo { pub lifecycle_checks: Option>, /// The extra accounts to use for the lifecycle hook. pub extra_accounts: Option>, + /// Data authority who can update the Lifecycle Hook data. This can be for the purposes. + /// of initialization of data, or schema migration. This field cannot be changed after + /// the plugin is added. + pub data_authority: Option, /// Schema for the data used by the plugin. pub schema: Option, } diff --git a/programs/mpl-core/src/processor/allocate_external_plugin_data.rs b/programs/mpl-core/src/processor/allocate_external_plugin_data.rs new file mode 100644 index 00000000..f0763f4c --- /dev/null +++ b/programs/mpl-core/src/processor/allocate_external_plugin_data.rs @@ -0,0 +1,36 @@ +use borsh::{BorshDeserialize, BorshSerialize}; +use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult}; + +use crate::{error::MplCoreError, plugins::ExternalPluginKey}; + +#[repr(C)] +#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] +pub(crate) struct AllocateExternalPluginDataV1Args { + /// External plugin key. + pub key: ExternalPluginKey, + /// External plugin initialization info. + pub target_size: usize, +} + +pub(crate) fn allocate_external_plugin_data<'a>( + _accounts: &'a [AccountInfo<'a>], + _args: AllocateExternalPluginDataV1Args, +) -> ProgramResult { + Err(MplCoreError::NotAvailable.into()) +} + +#[repr(C)] +#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] +pub(crate) struct AllocateCollectionExternalPluginDataV1Args { + /// External plugin key. + pub key: ExternalPluginKey, + /// External plugin initialization info. + pub target_size: usize, +} + +pub(crate) fn allocate_collection_external_plugin_data<'a>( + _accounts: &'a [AccountInfo<'a>], + _args: AllocateCollectionExternalPluginDataV1Args, +) -> ProgramResult { + Err(MplCoreError::NotAvailable.into()) +} diff --git a/programs/mpl-core/src/processor/clear_external_plugin_data.rs b/programs/mpl-core/src/processor/clear_external_plugin_data.rs new file mode 100644 index 00000000..da5cf51a --- /dev/null +++ b/programs/mpl-core/src/processor/clear_external_plugin_data.rs @@ -0,0 +1,32 @@ +use borsh::{BorshDeserialize, BorshSerialize}; +use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult}; + +use crate::{error::MplCoreError, plugins::ExternalPluginKey}; + +#[repr(C)] +#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] +pub(crate) struct ClearExternalPluginDataV1Args { + /// External plugin key. + pub key: ExternalPluginKey, +} + +pub(crate) fn clear_external_plugin_data<'a>( + _accounts: &'a [AccountInfo<'a>], + _args: ClearExternalPluginDataV1Args, +) -> ProgramResult { + Err(MplCoreError::NotAvailable.into()) +} + +#[repr(C)] +#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] +pub(crate) struct ClearCollectionExternalPluginDataV1Args { + /// External plugin key. + pub key: ExternalPluginKey, +} + +pub(crate) fn clear_collection_external_plugin_data<'a>( + _accounts: &'a [AccountInfo<'a>], + _args: ClearCollectionExternalPluginDataV1Args, +) -> ProgramResult { + Err(MplCoreError::NotAvailable.into()) +} diff --git a/programs/mpl-core/src/processor/mod.rs b/programs/mpl-core/src/processor/mod.rs index 13546a6e..a63c3857 100644 --- a/programs/mpl-core/src/processor/mod.rs +++ b/programs/mpl-core/src/processor/mod.rs @@ -1,7 +1,9 @@ mod add_external_plugin; mod add_plugin; +mod allocate_external_plugin_data; mod approve_plugin_authority; mod burn; +mod clear_external_plugin_data; mod collect; mod compress; mod create; @@ -14,11 +16,14 @@ mod transfer; mod update; mod update_external_plugin; mod update_plugin; +mod write_external_plugin_data; pub(crate) use add_external_plugin::*; pub(crate) use add_plugin::*; +pub(crate) use allocate_external_plugin_data::*; pub(crate) use approve_plugin_authority::*; pub(crate) use burn::*; +pub(crate) use clear_external_plugin_data::*; pub(crate) use collect::*; pub(crate) use compress::*; pub(crate) use create::*; @@ -31,6 +36,7 @@ pub(crate) use transfer::*; pub(crate) use update::*; pub(crate) use update_external_plugin::*; pub(crate) use update_plugin::*; +pub(crate) use write_external_plugin_data::*; use borsh::BorshDeserialize; use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, msg, pubkey::Pubkey}; @@ -154,5 +160,29 @@ pub fn process_instruction<'a>( msg!("Instruction: UpdateCollectionExternalPlugin"); update_collection_external_plugin(accounts, args) } + MplAssetInstruction::AllocateExternalPluginDataV1(args) => { + msg!("Instruction: AllocateExternalPluginDataV1"); + allocate_external_plugin_data(accounts, args) + } + MplAssetInstruction::AllocateCollectionExternalPluginDataV1(args) => { + msg!("Instruction: AllocateCollectionExternalPluginDataV1"); + allocate_collection_external_plugin_data(accounts, args) + } + MplAssetInstruction::WriteExternalPluginDataV1(args) => { + msg!("Instruction: WriteExternalPluginDataV1"); + write_external_plugin_data(accounts, args) + } + MplAssetInstruction::WriteCollectionExternalPluginDataV1(args) => { + msg!("Instruction: WriteCollectionExternalPluginDataV1"); + write_collection_external_plugin_data(accounts, args) + } + MplAssetInstruction::ClearExternalPluginDataV1(args) => { + msg!("Instruction: ClearExternalPluginDataV1"); + clear_external_plugin_data(accounts, args) + } + MplAssetInstruction::ClearCollectionExternalPluginDataV1(args) => { + msg!("Instruction: ClearCollectionExternalPluginDataV1"); + clear_collection_external_plugin_data(accounts, args) + } } } diff --git a/programs/mpl-core/src/processor/write_external_plugin_data.rs b/programs/mpl-core/src/processor/write_external_plugin_data.rs new file mode 100644 index 00000000..137597c7 --- /dev/null +++ b/programs/mpl-core/src/processor/write_external_plugin_data.rs @@ -0,0 +1,40 @@ +use borsh::{BorshDeserialize, BorshSerialize}; +use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult}; + +use crate::{error::MplCoreError, plugins::ExternalPluginKey}; + +#[repr(C)] +#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] +pub(crate) struct WriteExternalPluginDataV1Args { + /// External plugin key. + pub key: ExternalPluginKey, + /// The offset of the data to write. + pub offset: usize, + /// The data to write. + pub data: Vec, +} + +pub(crate) fn write_external_plugin_data<'a>( + _accounts: &'a [AccountInfo<'a>], + _args: WriteExternalPluginDataV1Args, +) -> ProgramResult { + Err(MplCoreError::NotAvailable.into()) +} + +#[repr(C)] +#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] +pub(crate) struct WriteCollectionExternalPluginDataV1Args { + /// External plugin key. + pub key: ExternalPluginKey, + /// The offset of the data to write. + pub offset: usize, + /// The data to write. + pub data: Vec, +} + +pub(crate) fn write_collection_external_plugin_data<'a>( + _accounts: &'a [AccountInfo<'a>], + _args: WriteCollectionExternalPluginDataV1Args, +) -> ProgramResult { + Err(MplCoreError::NotAvailable.into()) +} From b703d55934b36325fcd134d6c3e351694b0b5d90 Mon Sep 17 00:00:00 2001 From: blockiosaurus Date: Fri, 19 Apr 2024 12:58:23 -0400 Subject: [PATCH 2/6] Adding max size parameter. --- clients/js/src/generated/types/dataStore.ts | 3 +++ clients/js/src/generated/types/lifecycleHook.ts | 3 +++ .../src/generated/types/lifecycleHookInitInfo.ts | 4 ++++ .../generated/types/lifecycleHookUpdateInfo.ts | 4 ++++ clients/rust/src/generated/types/data_store.rs | 1 + .../rust/src/generated/types/lifecycle_hook.rs | 1 + .../generated/types/lifecycle_hook_init_info.rs | 1 + .../types/lifecycle_hook_update_info.rs | 1 + idls/mpl_core.json | 16 ++++++++++++++++ programs/mpl-core/src/plugins/data_store.rs | 2 ++ programs/mpl-core/src/plugins/lifecycle_hook.rs | 6 ++++++ 11 files changed, 42 insertions(+) diff --git a/clients/js/src/generated/types/dataStore.ts b/clients/js/src/generated/types/dataStore.ts index 7ec1331d..0b055c65 100644 --- a/clients/js/src/generated/types/dataStore.ts +++ b/clients/js/src/generated/types/dataStore.ts @@ -19,6 +19,7 @@ import { export type DataStore = { dataAuthority: PluginAuthority; schema: ExternalPluginSchema; + maxSize: bigint; dataOffset: bigint; dataLen: bigint; }; @@ -26,6 +27,7 @@ export type DataStore = { export type DataStoreArgs = { dataAuthority: PluginAuthorityArgs; schema: ExternalPluginSchemaArgs; + maxSize: number | bigint; dataOffset: number | bigint; dataLen: number | bigint; }; @@ -35,6 +37,7 @@ export function getDataStoreSerializer(): Serializer { [ ['dataAuthority', getPluginAuthoritySerializer()], ['schema', getExternalPluginSchemaSerializer()], + ['maxSize', u64()], ['dataOffset', u64()], ['dataLen', u64()], ], diff --git a/clients/js/src/generated/types/lifecycleHook.ts b/clients/js/src/generated/types/lifecycleHook.ts index 3689a806..03f9305a 100644 --- a/clients/js/src/generated/types/lifecycleHook.ts +++ b/clients/js/src/generated/types/lifecycleHook.ts @@ -32,6 +32,7 @@ export type LifecycleHook = { extraAccounts: Option>; dataAuthority: Option; schema: ExternalPluginSchema; + maxSize: bigint; dataOffset: bigint; dataLen: bigint; }; @@ -41,6 +42,7 @@ export type LifecycleHookArgs = { extraAccounts: OptionOrNullable>; dataAuthority: OptionOrNullable; schema: ExternalPluginSchemaArgs; + maxSize: number | bigint; dataOffset: number | bigint; dataLen: number | bigint; }; @@ -55,6 +57,7 @@ export function getLifecycleHookSerializer(): Serializer< ['extraAccounts', option(array(getExtraAccountSerializer()))], ['dataAuthority', option(getPluginAuthoritySerializer())], ['schema', getExternalPluginSchemaSerializer()], + ['maxSize', u64()], ['dataOffset', u64()], ['dataLen', u64()], ], diff --git a/clients/js/src/generated/types/lifecycleHookInitInfo.ts b/clients/js/src/generated/types/lifecycleHookInitInfo.ts index 25b54483..4e98224e 100644 --- a/clients/js/src/generated/types/lifecycleHookInitInfo.ts +++ b/clients/js/src/generated/types/lifecycleHookInitInfo.ts @@ -14,6 +14,7 @@ import { publicKey as publicKeySerializer, struct, tuple, + u64, } from '@metaplex-foundation/umi/serializers'; import { ExternalCheckResult, @@ -40,6 +41,7 @@ export type LifecycleHookInitInfo = { extraAccounts: Option>; dataAuthority: Option; schema: Option; + maxSize: bigint; }; export type LifecycleHookInitInfoArgs = { @@ -51,6 +53,7 @@ export type LifecycleHookInitInfoArgs = { extraAccounts: OptionOrNullable>; dataAuthority: OptionOrNullable; schema: OptionOrNullable; + maxSize: number | bigint; }; export function getLifecycleHookInitInfoSerializer(): Serializer< @@ -75,6 +78,7 @@ export function getLifecycleHookInitInfoSerializer(): Serializer< ['extraAccounts', option(array(getExtraAccountSerializer()))], ['dataAuthority', option(getPluginAuthoritySerializer())], ['schema', option(getExternalPluginSchemaSerializer())], + ['maxSize', u64()], ], { description: 'LifecycleHookInitInfo' } ) as Serializer; diff --git a/clients/js/src/generated/types/lifecycleHookUpdateInfo.ts b/clients/js/src/generated/types/lifecycleHookUpdateInfo.ts index c1d0f456..54f4be3c 100644 --- a/clients/js/src/generated/types/lifecycleHookUpdateInfo.ts +++ b/clients/js/src/generated/types/lifecycleHookUpdateInfo.ts @@ -13,6 +13,7 @@ import { option, struct, tuple, + u64, } from '@metaplex-foundation/umi/serializers'; import { ExternalCheckResult, @@ -33,6 +34,7 @@ export type LifecycleHookUpdateInfo = { lifecycleChecks: Option>; extraAccounts: Option>; schema: Option; + maxSize: bigint; }; export type LifecycleHookUpdateInfoArgs = { @@ -41,6 +43,7 @@ export type LifecycleHookUpdateInfoArgs = { >; extraAccounts: OptionOrNullable>; schema: OptionOrNullable; + maxSize: number | bigint; }; export function getLifecycleHookUpdateInfoSerializer(): Serializer< @@ -62,6 +65,7 @@ export function getLifecycleHookUpdateInfoSerializer(): Serializer< ], ['extraAccounts', option(array(getExtraAccountSerializer()))], ['schema', option(getExternalPluginSchemaSerializer())], + ['maxSize', u64()], ], { description: 'LifecycleHookUpdateInfo' } ) as Serializer; diff --git a/clients/rust/src/generated/types/data_store.rs b/clients/rust/src/generated/types/data_store.rs index 427be30b..caccabe3 100644 --- a/clients/rust/src/generated/types/data_store.rs +++ b/clients/rust/src/generated/types/data_store.rs @@ -15,6 +15,7 @@ use borsh::BorshSerialize; pub struct DataStore { pub data_authority: PluginAuthority, pub schema: ExternalPluginSchema, + pub max_size: u64, pub data_offset: u64, pub data_len: u64, } diff --git a/clients/rust/src/generated/types/lifecycle_hook.rs b/clients/rust/src/generated/types/lifecycle_hook.rs index 44f9c95f..541a829b 100644 --- a/clients/rust/src/generated/types/lifecycle_hook.rs +++ b/clients/rust/src/generated/types/lifecycle_hook.rs @@ -23,6 +23,7 @@ pub struct LifecycleHook { pub extra_accounts: Option>, pub data_authority: Option, pub schema: ExternalPluginSchema, + pub max_size: u64, pub data_offset: u64, pub data_len: u64, } diff --git a/clients/rust/src/generated/types/lifecycle_hook_init_info.rs b/clients/rust/src/generated/types/lifecycle_hook_init_info.rs index 4a032a1f..b1c3dd46 100644 --- a/clients/rust/src/generated/types/lifecycle_hook_init_info.rs +++ b/clients/rust/src/generated/types/lifecycle_hook_init_info.rs @@ -27,4 +27,5 @@ pub struct LifecycleHookInitInfo { pub extra_accounts: Option>, pub data_authority: Option, pub schema: Option, + pub max_size: u64, } diff --git a/clients/rust/src/generated/types/lifecycle_hook_update_info.rs b/clients/rust/src/generated/types/lifecycle_hook_update_info.rs index 0613f475..686b198e 100644 --- a/clients/rust/src/generated/types/lifecycle_hook_update_info.rs +++ b/clients/rust/src/generated/types/lifecycle_hook_update_info.rs @@ -18,4 +18,5 @@ pub struct LifecycleHookUpdateInfo { pub lifecycle_checks: Option>, pub extra_accounts: Option>, pub schema: Option, + pub max_size: u64, } diff --git a/idls/mpl_core.json b/idls/mpl_core.json index 9832d60d..be38344e 100644 --- a/idls/mpl_core.json +++ b/idls/mpl_core.json @@ -2391,6 +2391,10 @@ "defined": "ExternalPluginSchema" } }, + { + "name": "maxSize", + "type": "u64" + }, { "name": "dataOffset", "type": "u64" @@ -2517,6 +2521,10 @@ "defined": "ExternalPluginSchema" } }, + { + "name": "maxSize", + "type": "u64" + }, { "name": "dataOffset", "type": "u64" @@ -2587,6 +2595,10 @@ "defined": "ExternalPluginSchema" } } + }, + { + "name": "maxSize", + "type": "u64" } ] } @@ -2630,6 +2642,10 @@ "defined": "ExternalPluginSchema" } } + }, + { + "name": "maxSize", + "type": "u64" } ] } diff --git a/programs/mpl-core/src/plugins/data_store.rs b/programs/mpl-core/src/plugins/data_store.rs index 01b4edf1..ca555ab2 100644 --- a/programs/mpl-core/src/plugins/data_store.rs +++ b/programs/mpl-core/src/plugins/data_store.rs @@ -14,6 +14,8 @@ pub struct DataStore { pub data_authority: Authority, /// Schema for the data used by the plugin. pub schema: ExternalPluginSchema, + /// The maximum size of the data store. + pub max_size: usize, /// The offset to the plugin data in the account. pub data_offset: usize, /// The length of the plugin data. diff --git a/programs/mpl-core/src/plugins/lifecycle_hook.rs b/programs/mpl-core/src/plugins/lifecycle_hook.rs index 8e35986f..65777ac6 100644 --- a/programs/mpl-core/src/plugins/lifecycle_hook.rs +++ b/programs/mpl-core/src/plugins/lifecycle_hook.rs @@ -23,6 +23,8 @@ pub struct LifecycleHook { pub data_authority: Option, /// Schema for the data used by the plugin. pub schema: ExternalPluginSchema, + /// The maximum size of the lifecycle hook data. + pub max_size: usize, /// The offset to the plugin data in the account. pub data_offset: usize, /// The length of the plugin data. @@ -46,6 +48,8 @@ pub struct LifecycleHookInitInfo { pub data_authority: Option, /// Schema for the data used by the plugin. pub schema: Option, + /// The maximum size of the lifecycle hook data. + pub max_size: usize, } /// Lifecycle hook update info. @@ -57,4 +61,6 @@ pub struct LifecycleHookUpdateInfo { pub extra_accounts: Option>, /// Schema for the data used by the plugin. pub schema: Option, + /// The maximum size of the lifecycle hook data. + pub max_size: usize, } From e09fead855961ce3bdb62fb425e6f2023a42c550 Mon Sep 17 00:00:00 2001 From: blockiosaurus Date: Fri, 19 Apr 2024 13:00:31 -0400 Subject: [PATCH 3/6] Removing allocate. --- .../allocateCollectionExternalPluginDataV1.ts | 171 ----- .../allocateExternalPluginDataV1.ts | 178 ------ .../clearCollectionExternalPluginDataV1.ts | 2 +- .../instructions/clearExternalPluginDataV1.ts | 2 +- .../js/src/generated/instructions/index.ts | 2 - .../writeCollectionExternalPluginDataV1.ts | 2 +- .../instructions/writeExternalPluginDataV1.ts | 2 +- ...cate_collection_external_plugin_data_v1.rs | 543 ---------------- .../allocate_external_plugin_data_v1.rs | 593 ------------------ ...lear_collection_external_plugin_data_v1.rs | 2 +- .../clear_external_plugin_data_v1.rs | 2 +- .../rust/src/generated/instructions/mod.rs | 4 - ...rite_collection_external_plugin_data_v1.rs | 2 +- .../write_external_plugin_data_v1.rs | 2 +- idls/mpl_core.json | 171 +---- programs/mpl-core/src/instruction.rs | 36 +- .../allocate_external_plugin_data.rs | 36 -- programs/mpl-core/src/processor/mod.rs | 10 - 18 files changed, 21 insertions(+), 1739 deletions(-) delete mode 100644 clients/js/src/generated/instructions/allocateCollectionExternalPluginDataV1.ts delete mode 100644 clients/js/src/generated/instructions/allocateExternalPluginDataV1.ts delete mode 100644 clients/rust/src/generated/instructions/allocate_collection_external_plugin_data_v1.rs delete mode 100644 clients/rust/src/generated/instructions/allocate_external_plugin_data_v1.rs delete mode 100644 programs/mpl-core/src/processor/allocate_external_plugin_data.rs diff --git a/clients/js/src/generated/instructions/allocateCollectionExternalPluginDataV1.ts b/clients/js/src/generated/instructions/allocateCollectionExternalPluginDataV1.ts deleted file mode 100644 index 40d39fac..00000000 --- a/clients/js/src/generated/instructions/allocateCollectionExternalPluginDataV1.ts +++ /dev/null @@ -1,171 +0,0 @@ -/** - * This code was AUTOGENERATED using the kinobi library. - * Please DO NOT EDIT THIS FILE, instead use visitors - * to add features, then rerun kinobi to update it. - * - * @see https://github.com/metaplex-foundation/kinobi - */ - -import { - Context, - Pda, - PublicKey, - Signer, - TransactionBuilder, - transactionBuilder, -} from '@metaplex-foundation/umi'; -import { - Serializer, - mapSerializer, - struct, - u64, - u8, -} from '@metaplex-foundation/umi/serializers'; -import { - ResolvedAccount, - ResolvedAccountsWithIndices, - getAccountMetasAndSigners, -} from '../shared'; -import { - ExternalPluginKey, - ExternalPluginKeyArgs, - getExternalPluginKeySerializer, -} from '../types'; - -// Accounts. -export type AllocateCollectionExternalPluginDataV1InstructionAccounts = { - /** The address of the asset */ - collection: PublicKey | Pda; - /** The account paying for the storage fees */ - payer?: Signer; - /** The owner or delegate of the asset */ - authority?: Signer; - /** The system program */ - systemProgram?: PublicKey | Pda; - /** The SPL Noop Program */ - logWrapper?: PublicKey | Pda; -}; - -// Data. -export type AllocateCollectionExternalPluginDataV1InstructionData = { - discriminator: number; - key: ExternalPluginKey; - targetSize: bigint; -}; - -export type AllocateCollectionExternalPluginDataV1InstructionDataArgs = { - key: ExternalPluginKeyArgs; - targetSize: number | bigint; -}; - -export function getAllocateCollectionExternalPluginDataV1InstructionDataSerializer(): Serializer< - AllocateCollectionExternalPluginDataV1InstructionDataArgs, - AllocateCollectionExternalPluginDataV1InstructionData -> { - return mapSerializer< - AllocateCollectionExternalPluginDataV1InstructionDataArgs, - any, - AllocateCollectionExternalPluginDataV1InstructionData - >( - struct( - [ - ['discriminator', u8()], - ['key', getExternalPluginKeySerializer()], - ['targetSize', u64()], - ], - { description: 'AllocateCollectionExternalPluginDataV1InstructionData' } - ), - (value) => ({ ...value, discriminator: 29 }) - ) as Serializer< - AllocateCollectionExternalPluginDataV1InstructionDataArgs, - AllocateCollectionExternalPluginDataV1InstructionData - >; -} - -// Args. -export type AllocateCollectionExternalPluginDataV1InstructionArgs = - AllocateCollectionExternalPluginDataV1InstructionDataArgs; - -// Instruction. -export function allocateCollectionExternalPluginDataV1( - context: Pick, - input: AllocateCollectionExternalPluginDataV1InstructionAccounts & - AllocateCollectionExternalPluginDataV1InstructionArgs -): TransactionBuilder { - // Program ID. - const programId = context.programs.getPublicKey( - 'mplCore', - 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' - ); - - // Accounts. - const resolvedAccounts = { - collection: { - index: 0, - isWritable: true as boolean, - value: input.collection ?? null, - }, - payer: { - index: 1, - isWritable: true as boolean, - value: input.payer ?? null, - }, - authority: { - index: 2, - isWritable: false as boolean, - value: input.authority ?? null, - }, - systemProgram: { - index: 3, - isWritable: false as boolean, - value: input.systemProgram ?? null, - }, - logWrapper: { - index: 4, - isWritable: false as boolean, - value: input.logWrapper ?? null, - }, - } satisfies ResolvedAccountsWithIndices; - - // Arguments. - const resolvedArgs: AllocateCollectionExternalPluginDataV1InstructionArgs = { - ...input, - }; - - // Default values. - if (!resolvedAccounts.payer.value) { - resolvedAccounts.payer.value = context.payer; - } - if (!resolvedAccounts.systemProgram.value) { - resolvedAccounts.systemProgram.value = context.programs.getPublicKey( - 'splSystem', - '11111111111111111111111111111111' - ); - resolvedAccounts.systemProgram.isWritable = false; - } - - // Accounts in order. - const orderedAccounts: ResolvedAccount[] = Object.values( - resolvedAccounts - ).sort((a, b) => a.index - b.index); - - // Keys and Signers. - const [keys, signers] = getAccountMetasAndSigners( - orderedAccounts, - 'programId', - programId - ); - - // Data. - const data = - getAllocateCollectionExternalPluginDataV1InstructionDataSerializer().serialize( - resolvedArgs as AllocateCollectionExternalPluginDataV1InstructionDataArgs - ); - - // Bytes Created On Chain. - const bytesCreatedOnChain = 0; - - return transactionBuilder([ - { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, - ]); -} diff --git a/clients/js/src/generated/instructions/allocateExternalPluginDataV1.ts b/clients/js/src/generated/instructions/allocateExternalPluginDataV1.ts deleted file mode 100644 index 50bf35b6..00000000 --- a/clients/js/src/generated/instructions/allocateExternalPluginDataV1.ts +++ /dev/null @@ -1,178 +0,0 @@ -/** - * This code was AUTOGENERATED using the kinobi library. - * Please DO NOT EDIT THIS FILE, instead use visitors - * to add features, then rerun kinobi to update it. - * - * @see https://github.com/metaplex-foundation/kinobi - */ - -import { - Context, - Pda, - PublicKey, - Signer, - TransactionBuilder, - transactionBuilder, -} from '@metaplex-foundation/umi'; -import { - Serializer, - mapSerializer, - struct, - u64, - u8, -} from '@metaplex-foundation/umi/serializers'; -import { - ResolvedAccount, - ResolvedAccountsWithIndices, - getAccountMetasAndSigners, -} from '../shared'; -import { - ExternalPluginKey, - ExternalPluginKeyArgs, - getExternalPluginKeySerializer, -} from '../types'; - -// Accounts. -export type AllocateExternalPluginDataV1InstructionAccounts = { - /** The address of the asset */ - asset: PublicKey | Pda; - /** The collection to which the asset belongs */ - collection?: PublicKey | Pda; - /** The account paying for the storage fees */ - payer?: Signer; - /** The owner or delegate of the asset */ - authority?: Signer; - /** The system program */ - systemProgram?: PublicKey | Pda; - /** The SPL Noop Program */ - logWrapper?: PublicKey | Pda; -}; - -// Data. -export type AllocateExternalPluginDataV1InstructionData = { - discriminator: number; - key: ExternalPluginKey; - targetSize: bigint; -}; - -export type AllocateExternalPluginDataV1InstructionDataArgs = { - key: ExternalPluginKeyArgs; - targetSize: number | bigint; -}; - -export function getAllocateExternalPluginDataV1InstructionDataSerializer(): Serializer< - AllocateExternalPluginDataV1InstructionDataArgs, - AllocateExternalPluginDataV1InstructionData -> { - return mapSerializer< - AllocateExternalPluginDataV1InstructionDataArgs, - any, - AllocateExternalPluginDataV1InstructionData - >( - struct( - [ - ['discriminator', u8()], - ['key', getExternalPluginKeySerializer()], - ['targetSize', u64()], - ], - { description: 'AllocateExternalPluginDataV1InstructionData' } - ), - (value) => ({ ...value, discriminator: 28 }) - ) as Serializer< - AllocateExternalPluginDataV1InstructionDataArgs, - AllocateExternalPluginDataV1InstructionData - >; -} - -// Args. -export type AllocateExternalPluginDataV1InstructionArgs = - AllocateExternalPluginDataV1InstructionDataArgs; - -// Instruction. -export function allocateExternalPluginDataV1( - context: Pick, - input: AllocateExternalPluginDataV1InstructionAccounts & - AllocateExternalPluginDataV1InstructionArgs -): TransactionBuilder { - // Program ID. - const programId = context.programs.getPublicKey( - 'mplCore', - 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' - ); - - // Accounts. - const resolvedAccounts = { - asset: { - index: 0, - isWritable: true as boolean, - value: input.asset ?? null, - }, - collection: { - index: 1, - isWritable: true as boolean, - value: input.collection ?? null, - }, - payer: { - index: 2, - isWritable: true as boolean, - value: input.payer ?? null, - }, - authority: { - index: 3, - isWritable: false as boolean, - value: input.authority ?? null, - }, - systemProgram: { - index: 4, - isWritable: false as boolean, - value: input.systemProgram ?? null, - }, - logWrapper: { - index: 5, - isWritable: false as boolean, - value: input.logWrapper ?? null, - }, - } satisfies ResolvedAccountsWithIndices; - - // Arguments. - const resolvedArgs: AllocateExternalPluginDataV1InstructionArgs = { - ...input, - }; - - // Default values. - if (!resolvedAccounts.payer.value) { - resolvedAccounts.payer.value = context.payer; - } - if (!resolvedAccounts.systemProgram.value) { - resolvedAccounts.systemProgram.value = context.programs.getPublicKey( - 'splSystem', - '11111111111111111111111111111111' - ); - resolvedAccounts.systemProgram.isWritable = false; - } - - // Accounts in order. - const orderedAccounts: ResolvedAccount[] = Object.values( - resolvedAccounts - ).sort((a, b) => a.index - b.index); - - // Keys and Signers. - const [keys, signers] = getAccountMetasAndSigners( - orderedAccounts, - 'programId', - programId - ); - - // Data. - const data = - getAllocateExternalPluginDataV1InstructionDataSerializer().serialize( - resolvedArgs as AllocateExternalPluginDataV1InstructionDataArgs - ); - - // Bytes Created On Chain. - const bytesCreatedOnChain = 0; - - return transactionBuilder([ - { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, - ]); -} diff --git a/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts b/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts index 7ad66d36..693b5bba 100644 --- a/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts +++ b/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts @@ -71,7 +71,7 @@ export function getClearCollectionExternalPluginDataV1InstructionDataSerializer( ], { description: 'ClearCollectionExternalPluginDataV1InstructionData' } ), - (value) => ({ ...value, discriminator: 33 }) + (value) => ({ ...value, discriminator: 31 }) ) as Serializer< ClearCollectionExternalPluginDataV1InstructionDataArgs, ClearCollectionExternalPluginDataV1InstructionData diff --git a/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts b/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts index 423d13ac..3e9bde27 100644 --- a/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts +++ b/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts @@ -73,7 +73,7 @@ export function getClearExternalPluginDataV1InstructionDataSerializer(): Seriali ], { description: 'ClearExternalPluginDataV1InstructionData' } ), - (value) => ({ ...value, discriminator: 32 }) + (value) => ({ ...value, discriminator: 30 }) ) as Serializer< ClearExternalPluginDataV1InstructionDataArgs, ClearExternalPluginDataV1InstructionData diff --git a/clients/js/src/generated/instructions/index.ts b/clients/js/src/generated/instructions/index.ts index 13d07d35..cfad9bf4 100644 --- a/clients/js/src/generated/instructions/index.ts +++ b/clients/js/src/generated/instructions/index.ts @@ -10,8 +10,6 @@ export * from './addCollectionExternalPluginV1'; export * from './addCollectionPluginV1'; export * from './addExternalPluginV1'; export * from './addPluginV1'; -export * from './allocateCollectionExternalPluginDataV1'; -export * from './allocateExternalPluginDataV1'; export * from './approveCollectionPluginAuthorityV1'; export * from './approvePluginAuthorityV1'; export * from './burnCollectionV1'; diff --git a/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts b/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts index bb56bb8c..84943d10 100644 --- a/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts +++ b/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts @@ -80,7 +80,7 @@ export function getWriteCollectionExternalPluginDataV1InstructionDataSerializer( ], { description: 'WriteCollectionExternalPluginDataV1InstructionData' } ), - (value) => ({ ...value, discriminator: 31 }) + (value) => ({ ...value, discriminator: 29 }) ) as Serializer< WriteCollectionExternalPluginDataV1InstructionDataArgs, WriteCollectionExternalPluginDataV1InstructionData diff --git a/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts b/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts index b2748107..4d27021c 100644 --- a/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts +++ b/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts @@ -82,7 +82,7 @@ export function getWriteExternalPluginDataV1InstructionDataSerializer(): Seriali ], { description: 'WriteExternalPluginDataV1InstructionData' } ), - (value) => ({ ...value, discriminator: 30 }) + (value) => ({ ...value, discriminator: 28 }) ) as Serializer< WriteExternalPluginDataV1InstructionDataArgs, WriteExternalPluginDataV1InstructionData diff --git a/clients/rust/src/generated/instructions/allocate_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/allocate_collection_external_plugin_data_v1.rs deleted file mode 100644 index f7562763..00000000 --- a/clients/rust/src/generated/instructions/allocate_collection_external_plugin_data_v1.rs +++ /dev/null @@ -1,543 +0,0 @@ -//! This code was AUTOGENERATED using the kinobi library. -//! Please DO NOT EDIT THIS FILE, instead use visitors -//! to add features, then rerun kinobi to update it. -//! -//! [https://github.com/metaplex-foundation/kinobi] -//! - -use crate::generated::types::ExternalPluginKey; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; - -/// Accounts. -pub struct AllocateCollectionExternalPluginDataV1 { - /// The address of the asset - pub collection: solana_program::pubkey::Pubkey, - /// The account paying for the storage fees - pub payer: solana_program::pubkey::Pubkey, - /// The owner or delegate of the asset - pub authority: Option, - /// The system program - pub system_program: solana_program::pubkey::Pubkey, - /// The SPL Noop Program - pub log_wrapper: Option, -} - -impl AllocateCollectionExternalPluginDataV1 { - pub fn instruction( - &self, - args: AllocateCollectionExternalPluginDataV1InstructionArgs, - ) -> solana_program::instruction::Instruction { - self.instruction_with_remaining_accounts(args, &[]) - } - #[allow(clippy::vec_init_then_push)] - pub fn instruction_with_remaining_accounts( - &self, - args: AllocateCollectionExternalPluginDataV1InstructionArgs, - remaining_accounts: &[solana_program::instruction::AccountMeta], - ) -> solana_program::instruction::Instruction { - let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); - accounts.push(solana_program::instruction::AccountMeta::new( - self.collection, - false, - )); - accounts.push(solana_program::instruction::AccountMeta::new( - self.payer, true, - )); - if let Some(authority) = self.authority { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - authority, true, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.system_program, - false, - )); - if let Some(log_wrapper) = self.log_wrapper { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - log_wrapper, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.extend_from_slice(remaining_accounts); - let mut data = AllocateCollectionExternalPluginDataV1InstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = args.try_to_vec().unwrap(); - data.append(&mut args); - - solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_ID, - accounts, - data, - } - } -} - -#[derive(BorshDeserialize, BorshSerialize)] -struct AllocateCollectionExternalPluginDataV1InstructionData { - discriminator: u8, -} - -impl AllocateCollectionExternalPluginDataV1InstructionData { - fn new() -> Self { - Self { discriminator: 29 } - } -} - -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct AllocateCollectionExternalPluginDataV1InstructionArgs { - pub key: ExternalPluginKey, - pub target_size: u64, -} - -/// Instruction builder for `AllocateCollectionExternalPluginDataV1`. -/// -/// ### Accounts: -/// -/// 0. `[writable]` collection -/// 1. `[writable, signer]` payer -/// 2. `[signer, optional]` authority -/// 3. `[optional]` system_program (default to `11111111111111111111111111111111`) -/// 4. `[optional]` log_wrapper -#[derive(Default)] -pub struct AllocateCollectionExternalPluginDataV1Builder { - collection: Option, - payer: Option, - authority: Option, - system_program: Option, - log_wrapper: Option, - key: Option, - target_size: Option, - __remaining_accounts: Vec, -} - -impl AllocateCollectionExternalPluginDataV1Builder { - pub fn new() -> Self { - Self::default() - } - /// The address of the asset - #[inline(always)] - pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { - self.collection = Some(collection); - self - } - /// The account paying for the storage fees - #[inline(always)] - pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { - self.payer = Some(payer); - self - } - /// `[optional account]` - /// The owner or delegate of the asset - #[inline(always)] - pub fn authority(&mut self, authority: Option) -> &mut Self { - self.authority = authority; - self - } - /// `[optional account, default to '11111111111111111111111111111111']` - /// The system program - #[inline(always)] - pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { - self.system_program = Some(system_program); - self - } - /// `[optional account]` - /// The SPL Noop Program - #[inline(always)] - pub fn log_wrapper( - &mut self, - log_wrapper: Option, - ) -> &mut Self { - self.log_wrapper = log_wrapper; - self - } - #[inline(always)] - pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { - self.key = Some(key); - self - } - #[inline(always)] - pub fn target_size(&mut self, target_size: u64) -> &mut Self { - self.target_size = Some(target_size); - self - } - /// Add an aditional account to the instruction. - #[inline(always)] - pub fn add_remaining_account( - &mut self, - account: solana_program::instruction::AccountMeta, - ) -> &mut Self { - self.__remaining_accounts.push(account); - self - } - /// Add additional accounts to the instruction. - #[inline(always)] - pub fn add_remaining_accounts( - &mut self, - accounts: &[solana_program::instruction::AccountMeta], - ) -> &mut Self { - self.__remaining_accounts.extend_from_slice(accounts); - self - } - #[allow(clippy::clone_on_copy)] - pub fn instruction(&self) -> solana_program::instruction::Instruction { - let accounts = AllocateCollectionExternalPluginDataV1 { - collection: self.collection.expect("collection is not set"), - payer: self.payer.expect("payer is not set"), - authority: self.authority, - system_program: self - .system_program - .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), - log_wrapper: self.log_wrapper, - }; - let args = AllocateCollectionExternalPluginDataV1InstructionArgs { - key: self.key.clone().expect("key is not set"), - target_size: self.target_size.clone().expect("target_size is not set"), - }; - - accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) - } -} - -/// `allocate_collection_external_plugin_data_v1` CPI accounts. -pub struct AllocateCollectionExternalPluginDataV1CpiAccounts<'a, 'b> { - /// The address of the asset - pub collection: &'b solana_program::account_info::AccountInfo<'a>, - /// The account paying for the storage fees - pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset - pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The system program - pub system_program: &'b solana_program::account_info::AccountInfo<'a>, - /// The SPL Noop Program - pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, -} - -/// `allocate_collection_external_plugin_data_v1` CPI instruction. -pub struct AllocateCollectionExternalPluginDataV1Cpi<'a, 'b> { - /// The program to invoke. - pub __program: &'b solana_program::account_info::AccountInfo<'a>, - /// The address of the asset - pub collection: &'b solana_program::account_info::AccountInfo<'a>, - /// The account paying for the storage fees - pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset - pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The system program - pub system_program: &'b solana_program::account_info::AccountInfo<'a>, - /// The SPL Noop Program - pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The arguments for the instruction. - pub __args: AllocateCollectionExternalPluginDataV1InstructionArgs, -} - -impl<'a, 'b> AllocateCollectionExternalPluginDataV1Cpi<'a, 'b> { - pub fn new( - program: &'b solana_program::account_info::AccountInfo<'a>, - accounts: AllocateCollectionExternalPluginDataV1CpiAccounts<'a, 'b>, - args: AllocateCollectionExternalPluginDataV1InstructionArgs, - ) -> Self { - Self { - __program: program, - collection: accounts.collection, - payer: accounts.payer, - authority: accounts.authority, - system_program: accounts.system_program, - log_wrapper: accounts.log_wrapper, - __args: args, - } - } - #[inline(always)] - pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(&[], &[]) - } - #[inline(always)] - pub fn invoke_with_remaining_accounts( - &self, - remaining_accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) - } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) - } - #[allow(clippy::clone_on_copy)] - #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed_with_remaining_accounts( - &self, - signers_seeds: &[&[&[u8]]], - remaining_accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> solana_program::entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); - accounts.push(solana_program::instruction::AccountMeta::new( - *self.collection.key, - false, - )); - accounts.push(solana_program::instruction::AccountMeta::new( - *self.payer.key, - true, - )); - if let Some(authority) = self.authority { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *authority.key, - true, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.system_program.key, - false, - )); - if let Some(log_wrapper) = self.log_wrapper { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *log_wrapper.key, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - remaining_accounts.iter().for_each(|remaining_account| { - accounts.push(solana_program::instruction::AccountMeta { - pubkey: *remaining_account.0.key, - is_signer: remaining_account.1, - is_writable: remaining_account.2, - }) - }); - let mut data = AllocateCollectionExternalPluginDataV1InstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); - data.append(&mut args); - - let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_ID, - accounts, - data, - }; - let mut account_infos = Vec::with_capacity(5 + 1 + remaining_accounts.len()); - account_infos.push(self.__program.clone()); - account_infos.push(self.collection.clone()); - account_infos.push(self.payer.clone()); - if let Some(authority) = self.authority { - account_infos.push(authority.clone()); - } - account_infos.push(self.system_program.clone()); - if let Some(log_wrapper) = self.log_wrapper { - account_infos.push(log_wrapper.clone()); - } - remaining_accounts - .iter() - .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); - - if signers_seeds.is_empty() { - solana_program::program::invoke(&instruction, &account_infos) - } else { - solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) - } - } -} - -/// Instruction builder for `AllocateCollectionExternalPluginDataV1` via CPI. -/// -/// ### Accounts: -/// -/// 0. `[writable]` collection -/// 1. `[writable, signer]` payer -/// 2. `[signer, optional]` authority -/// 3. `[]` system_program -/// 4. `[optional]` log_wrapper -pub struct AllocateCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { - instruction: Box>, -} - -impl<'a, 'b> AllocateCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { - pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { - let instruction = Box::new( - AllocateCollectionExternalPluginDataV1CpiBuilderInstruction { - __program: program, - collection: None, - payer: None, - authority: None, - system_program: None, - log_wrapper: None, - key: None, - target_size: None, - __remaining_accounts: Vec::new(), - }, - ); - Self { instruction } - } - /// The address of the asset - #[inline(always)] - pub fn collection( - &mut self, - collection: &'b solana_program::account_info::AccountInfo<'a>, - ) -> &mut Self { - self.instruction.collection = Some(collection); - self - } - /// The account paying for the storage fees - #[inline(always)] - pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { - self.instruction.payer = Some(payer); - self - } - /// `[optional account]` - /// The owner or delegate of the asset - #[inline(always)] - pub fn authority( - &mut self, - authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.authority = authority; - self - } - /// The system program - #[inline(always)] - pub fn system_program( - &mut self, - system_program: &'b solana_program::account_info::AccountInfo<'a>, - ) -> &mut Self { - self.instruction.system_program = Some(system_program); - self - } - /// `[optional account]` - /// The SPL Noop Program - #[inline(always)] - pub fn log_wrapper( - &mut self, - log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.log_wrapper = log_wrapper; - self - } - #[inline(always)] - pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { - self.instruction.key = Some(key); - self - } - #[inline(always)] - pub fn target_size(&mut self, target_size: u64) -> &mut Self { - self.instruction.target_size = Some(target_size); - self - } - /// Add an additional account to the instruction. - #[inline(always)] - pub fn add_remaining_account( - &mut self, - account: &'b solana_program::account_info::AccountInfo<'a>, - is_writable: bool, - is_signer: bool, - ) -> &mut Self { - self.instruction - .__remaining_accounts - .push((account, is_writable, is_signer)); - self - } - /// Add additional accounts to the instruction. - /// - /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, - /// and a `bool` indicating whether the account is a signer or not. - #[inline(always)] - pub fn add_remaining_accounts( - &mut self, - accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> &mut Self { - self.instruction - .__remaining_accounts - .extend_from_slice(accounts); - self - } - #[inline(always)] - pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed(&[]) - } - #[allow(clippy::clone_on_copy)] - #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program::entrypoint::ProgramResult { - let args = AllocateCollectionExternalPluginDataV1InstructionArgs { - key: self.instruction.key.clone().expect("key is not set"), - target_size: self - .instruction - .target_size - .clone() - .expect("target_size is not set"), - }; - let instruction = AllocateCollectionExternalPluginDataV1Cpi { - __program: self.instruction.__program, - - collection: self.instruction.collection.expect("collection is not set"), - - payer: self.instruction.payer.expect("payer is not set"), - - authority: self.instruction.authority, - - system_program: self - .instruction - .system_program - .expect("system_program is not set"), - - log_wrapper: self.instruction.log_wrapper, - __args: args, - }; - instruction.invoke_signed_with_remaining_accounts( - signers_seeds, - &self.instruction.__remaining_accounts, - ) - } -} - -struct AllocateCollectionExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { - __program: &'b solana_program::account_info::AccountInfo<'a>, - collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, - authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, - log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - key: Option, - target_size: Option, - /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. - __remaining_accounts: Vec<( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )>, -} diff --git a/clients/rust/src/generated/instructions/allocate_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/allocate_external_plugin_data_v1.rs deleted file mode 100644 index 8c9c74f4..00000000 --- a/clients/rust/src/generated/instructions/allocate_external_plugin_data_v1.rs +++ /dev/null @@ -1,593 +0,0 @@ -//! This code was AUTOGENERATED using the kinobi library. -//! Please DO NOT EDIT THIS FILE, instead use visitors -//! to add features, then rerun kinobi to update it. -//! -//! [https://github.com/metaplex-foundation/kinobi] -//! - -use crate::generated::types::ExternalPluginKey; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; - -/// Accounts. -pub struct AllocateExternalPluginDataV1 { - /// The address of the asset - pub asset: solana_program::pubkey::Pubkey, - /// The collection to which the asset belongs - pub collection: Option, - /// The account paying for the storage fees - pub payer: solana_program::pubkey::Pubkey, - /// The owner or delegate of the asset - pub authority: Option, - /// The system program - pub system_program: solana_program::pubkey::Pubkey, - /// The SPL Noop Program - pub log_wrapper: Option, -} - -impl AllocateExternalPluginDataV1 { - pub fn instruction( - &self, - args: AllocateExternalPluginDataV1InstructionArgs, - ) -> solana_program::instruction::Instruction { - self.instruction_with_remaining_accounts(args, &[]) - } - #[allow(clippy::vec_init_then_push)] - pub fn instruction_with_remaining_accounts( - &self, - args: AllocateExternalPluginDataV1InstructionArgs, - remaining_accounts: &[solana_program::instruction::AccountMeta], - ) -> solana_program::instruction::Instruction { - let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); - accounts.push(solana_program::instruction::AccountMeta::new( - self.asset, false, - )); - if let Some(collection) = self.collection { - accounts.push(solana_program::instruction::AccountMeta::new( - collection, false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new( - self.payer, true, - )); - if let Some(authority) = self.authority { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - authority, true, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.system_program, - false, - )); - if let Some(log_wrapper) = self.log_wrapper { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - log_wrapper, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.extend_from_slice(remaining_accounts); - let mut data = AllocateExternalPluginDataV1InstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = args.try_to_vec().unwrap(); - data.append(&mut args); - - solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_ID, - accounts, - data, - } - } -} - -#[derive(BorshDeserialize, BorshSerialize)] -struct AllocateExternalPluginDataV1InstructionData { - discriminator: u8, -} - -impl AllocateExternalPluginDataV1InstructionData { - fn new() -> Self { - Self { discriminator: 28 } - } -} - -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct AllocateExternalPluginDataV1InstructionArgs { - pub key: ExternalPluginKey, - pub target_size: u64, -} - -/// Instruction builder for `AllocateExternalPluginDataV1`. -/// -/// ### Accounts: -/// -/// 0. `[writable]` asset -/// 1. `[writable, optional]` collection -/// 2. `[writable, signer]` payer -/// 3. `[signer, optional]` authority -/// 4. `[optional]` system_program (default to `11111111111111111111111111111111`) -/// 5. `[optional]` log_wrapper -#[derive(Default)] -pub struct AllocateExternalPluginDataV1Builder { - asset: Option, - collection: Option, - payer: Option, - authority: Option, - system_program: Option, - log_wrapper: Option, - key: Option, - target_size: Option, - __remaining_accounts: Vec, -} - -impl AllocateExternalPluginDataV1Builder { - pub fn new() -> Self { - Self::default() - } - /// The address of the asset - #[inline(always)] - pub fn asset(&mut self, asset: solana_program::pubkey::Pubkey) -> &mut Self { - self.asset = Some(asset); - self - } - /// `[optional account]` - /// The collection to which the asset belongs - #[inline(always)] - pub fn collection(&mut self, collection: Option) -> &mut Self { - self.collection = collection; - self - } - /// The account paying for the storage fees - #[inline(always)] - pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { - self.payer = Some(payer); - self - } - /// `[optional account]` - /// The owner or delegate of the asset - #[inline(always)] - pub fn authority(&mut self, authority: Option) -> &mut Self { - self.authority = authority; - self - } - /// `[optional account, default to '11111111111111111111111111111111']` - /// The system program - #[inline(always)] - pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { - self.system_program = Some(system_program); - self - } - /// `[optional account]` - /// The SPL Noop Program - #[inline(always)] - pub fn log_wrapper( - &mut self, - log_wrapper: Option, - ) -> &mut Self { - self.log_wrapper = log_wrapper; - self - } - #[inline(always)] - pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { - self.key = Some(key); - self - } - #[inline(always)] - pub fn target_size(&mut self, target_size: u64) -> &mut Self { - self.target_size = Some(target_size); - self - } - /// Add an aditional account to the instruction. - #[inline(always)] - pub fn add_remaining_account( - &mut self, - account: solana_program::instruction::AccountMeta, - ) -> &mut Self { - self.__remaining_accounts.push(account); - self - } - /// Add additional accounts to the instruction. - #[inline(always)] - pub fn add_remaining_accounts( - &mut self, - accounts: &[solana_program::instruction::AccountMeta], - ) -> &mut Self { - self.__remaining_accounts.extend_from_slice(accounts); - self - } - #[allow(clippy::clone_on_copy)] - pub fn instruction(&self) -> solana_program::instruction::Instruction { - let accounts = AllocateExternalPluginDataV1 { - asset: self.asset.expect("asset is not set"), - collection: self.collection, - payer: self.payer.expect("payer is not set"), - authority: self.authority, - system_program: self - .system_program - .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), - log_wrapper: self.log_wrapper, - }; - let args = AllocateExternalPluginDataV1InstructionArgs { - key: self.key.clone().expect("key is not set"), - target_size: self.target_size.clone().expect("target_size is not set"), - }; - - accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) - } -} - -/// `allocate_external_plugin_data_v1` CPI accounts. -pub struct AllocateExternalPluginDataV1CpiAccounts<'a, 'b> { - /// The address of the asset - pub asset: &'b solana_program::account_info::AccountInfo<'a>, - /// The collection to which the asset belongs - pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The account paying for the storage fees - pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset - pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The system program - pub system_program: &'b solana_program::account_info::AccountInfo<'a>, - /// The SPL Noop Program - pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, -} - -/// `allocate_external_plugin_data_v1` CPI instruction. -pub struct AllocateExternalPluginDataV1Cpi<'a, 'b> { - /// The program to invoke. - pub __program: &'b solana_program::account_info::AccountInfo<'a>, - /// The address of the asset - pub asset: &'b solana_program::account_info::AccountInfo<'a>, - /// The collection to which the asset belongs - pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The account paying for the storage fees - pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset - pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The system program - pub system_program: &'b solana_program::account_info::AccountInfo<'a>, - /// The SPL Noop Program - pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The arguments for the instruction. - pub __args: AllocateExternalPluginDataV1InstructionArgs, -} - -impl<'a, 'b> AllocateExternalPluginDataV1Cpi<'a, 'b> { - pub fn new( - program: &'b solana_program::account_info::AccountInfo<'a>, - accounts: AllocateExternalPluginDataV1CpiAccounts<'a, 'b>, - args: AllocateExternalPluginDataV1InstructionArgs, - ) -> Self { - Self { - __program: program, - asset: accounts.asset, - collection: accounts.collection, - payer: accounts.payer, - authority: accounts.authority, - system_program: accounts.system_program, - log_wrapper: accounts.log_wrapper, - __args: args, - } - } - #[inline(always)] - pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(&[], &[]) - } - #[inline(always)] - pub fn invoke_with_remaining_accounts( - &self, - remaining_accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) - } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) - } - #[allow(clippy::clone_on_copy)] - #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed_with_remaining_accounts( - &self, - signers_seeds: &[&[&[u8]]], - remaining_accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> solana_program::entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); - accounts.push(solana_program::instruction::AccountMeta::new( - *self.asset.key, - false, - )); - if let Some(collection) = self.collection { - accounts.push(solana_program::instruction::AccountMeta::new( - *collection.key, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new( - *self.payer.key, - true, - )); - if let Some(authority) = self.authority { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *authority.key, - true, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.system_program.key, - false, - )); - if let Some(log_wrapper) = self.log_wrapper { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *log_wrapper.key, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - remaining_accounts.iter().for_each(|remaining_account| { - accounts.push(solana_program::instruction::AccountMeta { - pubkey: *remaining_account.0.key, - is_signer: remaining_account.1, - is_writable: remaining_account.2, - }) - }); - let mut data = AllocateExternalPluginDataV1InstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); - data.append(&mut args); - - let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_ID, - accounts, - data, - }; - let mut account_infos = Vec::with_capacity(6 + 1 + remaining_accounts.len()); - account_infos.push(self.__program.clone()); - account_infos.push(self.asset.clone()); - if let Some(collection) = self.collection { - account_infos.push(collection.clone()); - } - account_infos.push(self.payer.clone()); - if let Some(authority) = self.authority { - account_infos.push(authority.clone()); - } - account_infos.push(self.system_program.clone()); - if let Some(log_wrapper) = self.log_wrapper { - account_infos.push(log_wrapper.clone()); - } - remaining_accounts - .iter() - .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); - - if signers_seeds.is_empty() { - solana_program::program::invoke(&instruction, &account_infos) - } else { - solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) - } - } -} - -/// Instruction builder for `AllocateExternalPluginDataV1` via CPI. -/// -/// ### Accounts: -/// -/// 0. `[writable]` asset -/// 1. `[writable, optional]` collection -/// 2. `[writable, signer]` payer -/// 3. `[signer, optional]` authority -/// 4. `[]` system_program -/// 5. `[optional]` log_wrapper -pub struct AllocateExternalPluginDataV1CpiBuilder<'a, 'b> { - instruction: Box>, -} - -impl<'a, 'b> AllocateExternalPluginDataV1CpiBuilder<'a, 'b> { - pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { - let instruction = Box::new(AllocateExternalPluginDataV1CpiBuilderInstruction { - __program: program, - asset: None, - collection: None, - payer: None, - authority: None, - system_program: None, - log_wrapper: None, - key: None, - target_size: None, - __remaining_accounts: Vec::new(), - }); - Self { instruction } - } - /// The address of the asset - #[inline(always)] - pub fn asset(&mut self, asset: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { - self.instruction.asset = Some(asset); - self - } - /// `[optional account]` - /// The collection to which the asset belongs - #[inline(always)] - pub fn collection( - &mut self, - collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.collection = collection; - self - } - /// The account paying for the storage fees - #[inline(always)] - pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { - self.instruction.payer = Some(payer); - self - } - /// `[optional account]` - /// The owner or delegate of the asset - #[inline(always)] - pub fn authority( - &mut self, - authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.authority = authority; - self - } - /// The system program - #[inline(always)] - pub fn system_program( - &mut self, - system_program: &'b solana_program::account_info::AccountInfo<'a>, - ) -> &mut Self { - self.instruction.system_program = Some(system_program); - self - } - /// `[optional account]` - /// The SPL Noop Program - #[inline(always)] - pub fn log_wrapper( - &mut self, - log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.log_wrapper = log_wrapper; - self - } - #[inline(always)] - pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { - self.instruction.key = Some(key); - self - } - #[inline(always)] - pub fn target_size(&mut self, target_size: u64) -> &mut Self { - self.instruction.target_size = Some(target_size); - self - } - /// Add an additional account to the instruction. - #[inline(always)] - pub fn add_remaining_account( - &mut self, - account: &'b solana_program::account_info::AccountInfo<'a>, - is_writable: bool, - is_signer: bool, - ) -> &mut Self { - self.instruction - .__remaining_accounts - .push((account, is_writable, is_signer)); - self - } - /// Add additional accounts to the instruction. - /// - /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, - /// and a `bool` indicating whether the account is a signer or not. - #[inline(always)] - pub fn add_remaining_accounts( - &mut self, - accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> &mut Self { - self.instruction - .__remaining_accounts - .extend_from_slice(accounts); - self - } - #[inline(always)] - pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed(&[]) - } - #[allow(clippy::clone_on_copy)] - #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program::entrypoint::ProgramResult { - let args = AllocateExternalPluginDataV1InstructionArgs { - key: self.instruction.key.clone().expect("key is not set"), - target_size: self - .instruction - .target_size - .clone() - .expect("target_size is not set"), - }; - let instruction = AllocateExternalPluginDataV1Cpi { - __program: self.instruction.__program, - - asset: self.instruction.asset.expect("asset is not set"), - - collection: self.instruction.collection, - - payer: self.instruction.payer.expect("payer is not set"), - - authority: self.instruction.authority, - - system_program: self - .instruction - .system_program - .expect("system_program is not set"), - - log_wrapper: self.instruction.log_wrapper, - __args: args, - }; - instruction.invoke_signed_with_remaining_accounts( - signers_seeds, - &self.instruction.__remaining_accounts, - ) - } -} - -struct AllocateExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { - __program: &'b solana_program::account_info::AccountInfo<'a>, - asset: Option<&'b solana_program::account_info::AccountInfo<'a>>, - collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, - authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, - log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - key: Option, - target_size: Option, - /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. - __remaining_accounts: Vec<( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )>, -} diff --git a/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs index 4602348d..ab7ac97c 100644 --- a/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs @@ -91,7 +91,7 @@ struct ClearCollectionExternalPluginDataV1InstructionData { impl ClearCollectionExternalPluginDataV1InstructionData { fn new() -> Self { - Self { discriminator: 33 } + Self { discriminator: 31 } } } diff --git a/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs index f08144d9..7af98dd5 100644 --- a/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs @@ -102,7 +102,7 @@ struct ClearExternalPluginDataV1InstructionData { impl ClearExternalPluginDataV1InstructionData { fn new() -> Self { - Self { discriminator: 32 } + Self { discriminator: 30 } } } diff --git a/clients/rust/src/generated/instructions/mod.rs b/clients/rust/src/generated/instructions/mod.rs index c53cc1a7..00977669 100644 --- a/clients/rust/src/generated/instructions/mod.rs +++ b/clients/rust/src/generated/instructions/mod.rs @@ -9,8 +9,6 @@ pub(crate) mod r#add_collection_external_plugin_v1; pub(crate) mod r#add_collection_plugin_v1; pub(crate) mod r#add_external_plugin_v1; pub(crate) mod r#add_plugin_v1; -pub(crate) mod r#allocate_collection_external_plugin_data_v1; -pub(crate) mod r#allocate_external_plugin_data_v1; pub(crate) mod r#approve_collection_plugin_authority_v1; pub(crate) mod r#approve_plugin_authority_v1; pub(crate) mod r#burn_collection_v1; @@ -44,8 +42,6 @@ pub use self::r#add_collection_external_plugin_v1::*; pub use self::r#add_collection_plugin_v1::*; pub use self::r#add_external_plugin_v1::*; pub use self::r#add_plugin_v1::*; -pub use self::r#allocate_collection_external_plugin_data_v1::*; -pub use self::r#allocate_external_plugin_data_v1::*; pub use self::r#approve_collection_plugin_authority_v1::*; pub use self::r#approve_plugin_authority_v1::*; pub use self::r#burn_collection_v1::*; diff --git a/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs index c12cd303..77ae6dbd 100644 --- a/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs @@ -91,7 +91,7 @@ struct WriteCollectionExternalPluginDataV1InstructionData { impl WriteCollectionExternalPluginDataV1InstructionData { fn new() -> Self { - Self { discriminator: 31 } + Self { discriminator: 29 } } } diff --git a/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs index 33b9e4b5..c7e8f733 100644 --- a/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs @@ -102,7 +102,7 @@ struct WriteExternalPluginDataV1InstructionData { impl WriteExternalPluginDataV1InstructionData { fn new() -> Self { - Self { discriminator: 30 } + Self { discriminator: 28 } } } diff --git a/idls/mpl_core.json b/idls/mpl_core.json index be38344e..573e1803 100644 --- a/idls/mpl_core.json +++ b/idls/mpl_core.json @@ -1785,133 +1785,6 @@ "value": 27 } }, - { - "name": "AllocateExternalPluginDataV1", - "accounts": [ - { - "name": "asset", - "isMut": true, - "isSigner": false, - "docs": [ - "The address of the asset" - ] - }, - { - "name": "collection", - "isMut": true, - "isSigner": false, - "isOptional": true, - "docs": [ - "The collection to which the asset belongs" - ] - }, - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "The account paying for the storage fees" - ] - }, - { - "name": "authority", - "isMut": false, - "isSigner": true, - "isOptional": true, - "docs": [ - "The owner or delegate of the asset" - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "The system program" - ] - }, - { - "name": "logWrapper", - "isMut": false, - "isSigner": false, - "isOptional": true, - "docs": [ - "The SPL Noop Program" - ] - } - ], - "args": [ - { - "name": "allocateExternalPluginDataV1Args", - "type": { - "defined": "AllocateExternalPluginDataV1Args" - } - } - ], - "discriminant": { - "type": "u8", - "value": 28 - } - }, - { - "name": "AllocateCollectionExternalPluginDataV1", - "accounts": [ - { - "name": "collection", - "isMut": true, - "isSigner": false, - "docs": [ - "The address of the asset" - ] - }, - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "The account paying for the storage fees" - ] - }, - { - "name": "authority", - "isMut": false, - "isSigner": true, - "isOptional": true, - "docs": [ - "The owner or delegate of the asset" - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "The system program" - ] - }, - { - "name": "logWrapper", - "isMut": false, - "isSigner": false, - "isOptional": true, - "docs": [ - "The SPL Noop Program" - ] - } - ], - "args": [ - { - "name": "allocateCollectionExternalPluginDataV1Args", - "type": { - "defined": "AllocateCollectionExternalPluginDataV1Args" - } - } - ], - "discriminant": { - "type": "u8", - "value": 29 - } - }, { "name": "WriteExternalPluginDataV1", "accounts": [ @@ -1977,7 +1850,7 @@ ], "discriminant": { "type": "u8", - "value": 30 + "value": 28 } }, { @@ -2036,7 +1909,7 @@ ], "discriminant": { "type": "u8", - "value": 31 + "value": 29 } }, { @@ -2104,7 +1977,7 @@ ], "discriminant": { "type": "u8", - "value": 32 + "value": 30 } }, { @@ -2163,7 +2036,7 @@ ], "discriminant": { "type": "u8", - "value": 33 + "value": 31 } } ], @@ -2974,42 +2847,6 @@ ] } }, - { - "name": "AllocateExternalPluginDataV1Args", - "type": { - "kind": "struct", - "fields": [ - { - "name": "key", - "type": { - "defined": "ExternalPluginKey" - } - }, - { - "name": "targetSize", - "type": "u64" - } - ] - } - }, - { - "name": "AllocateCollectionExternalPluginDataV1Args", - "type": { - "kind": "struct", - "fields": [ - { - "name": "key", - "type": { - "defined": "ExternalPluginKey" - } - }, - { - "name": "targetSize", - "type": "u64" - } - ] - } - }, { "name": "ApprovePluginAuthorityV1Args", "type": { diff --git a/programs/mpl-core/src/instruction.rs b/programs/mpl-core/src/instruction.rs index 03c17e08..7b620823 100644 --- a/programs/mpl-core/src/instruction.rs +++ b/programs/mpl-core/src/instruction.rs @@ -4,16 +4,15 @@ use shank::{ShankContext, ShankInstruction}; use crate::processor::{ AddCollectionExternalPluginV1Args, AddCollectionPluginV1Args, AddExternalPluginV1Args, - AddPluginV1Args, AllocateCollectionExternalPluginDataV1Args, AllocateExternalPluginDataV1Args, - ApproveCollectionPluginAuthorityV1Args, ApprovePluginAuthorityV1Args, BurnCollectionV1Args, - BurnV1Args, ClearCollectionExternalPluginDataV1Args, ClearExternalPluginDataV1Args, - CompressV1Args, CreateCollectionV1Args, CreateCollectionV2Args, CreateV1Args, CreateV2Args, - DecompressV1Args, RemoveCollectionExternalPluginV1Args, RemoveCollectionPluginV1Args, - RemoveExternalPluginV1Args, RemovePluginV1Args, RevokeCollectionPluginAuthorityV1Args, - RevokePluginAuthorityV1Args, TransferV1Args, UpdateCollectionExternalPluginV1Args, - UpdateCollectionPluginV1Args, UpdateCollectionV1Args, UpdateExternalPluginV1Args, - UpdatePluginV1Args, UpdateV1Args, WriteCollectionExternalPluginDataV1Args, - WriteExternalPluginDataV1Args, + AddPluginV1Args, ApproveCollectionPluginAuthorityV1Args, ApprovePluginAuthorityV1Args, + BurnCollectionV1Args, BurnV1Args, ClearCollectionExternalPluginDataV1Args, + ClearExternalPluginDataV1Args, CompressV1Args, CreateCollectionV1Args, CreateCollectionV2Args, + CreateV1Args, CreateV2Args, DecompressV1Args, RemoveCollectionExternalPluginV1Args, + RemoveCollectionPluginV1Args, RemoveExternalPluginV1Args, RemovePluginV1Args, + RevokeCollectionPluginAuthorityV1Args, RevokePluginAuthorityV1Args, TransferV1Args, + UpdateCollectionExternalPluginV1Args, UpdateCollectionPluginV1Args, UpdateCollectionV1Args, + UpdateExternalPluginV1Args, UpdatePluginV1Args, UpdateV1Args, + WriteCollectionExternalPluginDataV1Args, WriteExternalPluginDataV1Args, }; /// Instructions supported by the mpl-core program. @@ -265,23 +264,6 @@ pub(crate) enum MplAssetInstruction { #[account(4, optional, name="log_wrapper", desc = "The SPL Noop Program")] UpdateCollectionExternalPluginV1(UpdateCollectionExternalPluginV1Args), - /// Add an external plugin to an mpl-core. - #[account(0, writable, name="asset", desc = "The address of the asset")] - #[account(1, optional, writable, name="collection", desc = "The collection to which the asset belongs")] - #[account(2, writable, signer, name="payer", desc = "The account paying for the storage fees")] - #[account(3, optional, signer, name="authority", desc = "The owner or delegate of the asset")] - #[account(4, name="system_program", desc = "The system program")] - #[account(5, optional, name="log_wrapper", desc = "The SPL Noop Program")] - AllocateExternalPluginDataV1(AllocateExternalPluginDataV1Args), - - /// Add an external plugin to an mpl-core. - #[account(0, writable, name="collection", desc = "The address of the asset")] - #[account(1, writable, signer, name="payer", desc = "The account paying for the storage fees")] - #[account(2, optional, signer, name="authority", desc = "The owner or delegate of the asset")] - #[account(3, name="system_program", desc = "The system program")] - #[account(4, optional, name="log_wrapper", desc = "The SPL Noop Program")] - AllocateCollectionExternalPluginDataV1(AllocateCollectionExternalPluginDataV1Args), - /// Add an external plugin to an mpl-core. #[account(0, writable, name="asset", desc = "The address of the asset")] #[account(1, optional, writable, name="collection", desc = "The collection to which the asset belongs")] diff --git a/programs/mpl-core/src/processor/allocate_external_plugin_data.rs b/programs/mpl-core/src/processor/allocate_external_plugin_data.rs deleted file mode 100644 index f0763f4c..00000000 --- a/programs/mpl-core/src/processor/allocate_external_plugin_data.rs +++ /dev/null @@ -1,36 +0,0 @@ -use borsh::{BorshDeserialize, BorshSerialize}; -use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult}; - -use crate::{error::MplCoreError, plugins::ExternalPluginKey}; - -#[repr(C)] -#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] -pub(crate) struct AllocateExternalPluginDataV1Args { - /// External plugin key. - pub key: ExternalPluginKey, - /// External plugin initialization info. - pub target_size: usize, -} - -pub(crate) fn allocate_external_plugin_data<'a>( - _accounts: &'a [AccountInfo<'a>], - _args: AllocateExternalPluginDataV1Args, -) -> ProgramResult { - Err(MplCoreError::NotAvailable.into()) -} - -#[repr(C)] -#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] -pub(crate) struct AllocateCollectionExternalPluginDataV1Args { - /// External plugin key. - pub key: ExternalPluginKey, - /// External plugin initialization info. - pub target_size: usize, -} - -pub(crate) fn allocate_collection_external_plugin_data<'a>( - _accounts: &'a [AccountInfo<'a>], - _args: AllocateCollectionExternalPluginDataV1Args, -) -> ProgramResult { - Err(MplCoreError::NotAvailable.into()) -} diff --git a/programs/mpl-core/src/processor/mod.rs b/programs/mpl-core/src/processor/mod.rs index a63c3857..10947830 100644 --- a/programs/mpl-core/src/processor/mod.rs +++ b/programs/mpl-core/src/processor/mod.rs @@ -1,6 +1,5 @@ mod add_external_plugin; mod add_plugin; -mod allocate_external_plugin_data; mod approve_plugin_authority; mod burn; mod clear_external_plugin_data; @@ -20,7 +19,6 @@ mod write_external_plugin_data; pub(crate) use add_external_plugin::*; pub(crate) use add_plugin::*; -pub(crate) use allocate_external_plugin_data::*; pub(crate) use approve_plugin_authority::*; pub(crate) use burn::*; pub(crate) use clear_external_plugin_data::*; @@ -160,14 +158,6 @@ pub fn process_instruction<'a>( msg!("Instruction: UpdateCollectionExternalPlugin"); update_collection_external_plugin(accounts, args) } - MplAssetInstruction::AllocateExternalPluginDataV1(args) => { - msg!("Instruction: AllocateExternalPluginDataV1"); - allocate_external_plugin_data(accounts, args) - } - MplAssetInstruction::AllocateCollectionExternalPluginDataV1(args) => { - msg!("Instruction: AllocateCollectionExternalPluginDataV1"); - allocate_collection_external_plugin_data(accounts, args) - } MplAssetInstruction::WriteExternalPluginDataV1(args) => { msg!("Instruction: WriteExternalPluginDataV1"); write_external_plugin_data(accounts, args) From 588936513977aedca092b94efa23130f2836fee9 Mon Sep 17 00:00:00 2001 From: blockiosaurus Date: Fri, 19 Apr 2024 13:05:56 -0400 Subject: [PATCH 4/6] Forgot to save. --- programs/mpl-core/src/plugins/data_store.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/programs/mpl-core/src/plugins/data_store.rs b/programs/mpl-core/src/plugins/data_store.rs index ca555ab2..e6ff1e32 100644 --- a/programs/mpl-core/src/plugins/data_store.rs +++ b/programs/mpl-core/src/plugins/data_store.rs @@ -32,6 +32,8 @@ pub struct DataStoreInitInfo { pub init_plugin_authority: Option, /// Schema for the data used by the plugin. pub schema: Option, + /// The maximum size of the data store. + pub max_size: usize, } /// Data store update info. @@ -39,4 +41,6 @@ pub struct DataStoreInitInfo { pub struct DataStoreUpdateInfo { /// Schema for the data used by the plugin. pub schema: Option, + /// The maximum size of the data store. + pub max_size: usize, } From ff61b3b65d80b3fc841f9872bf54ee59226f7444 Mon Sep 17 00:00:00 2001 From: blockiosaurus Date: Fri, 19 Apr 2024 13:39:17 -0400 Subject: [PATCH 5/6] Removing size and clear IX. --- .../clearCollectionExternalPluginDataV1.ts | 167 ----- .../instructions/clearExternalPluginDataV1.ts | 172 ------ .../js/src/generated/instructions/index.ts | 2 - .../writeCollectionExternalPluginDataV1.ts | 4 - .../instructions/writeExternalPluginDataV1.ts | 4 - clients/js/src/generated/types/dataStore.ts | 3 - .../js/src/generated/types/lifecycleHook.ts | 3 - .../generated/types/lifecycleHookInitInfo.ts | 4 - .../types/lifecycleHookUpdateInfo.ts | 4 - ...lear_collection_external_plugin_data_v1.rs | 521 ---------------- .../clear_external_plugin_data_v1.rs | 573 ------------------ .../rust/src/generated/instructions/mod.rs | 4 - ...rite_collection_external_plugin_data_v1.rs | 16 - .../write_external_plugin_data_v1.rs | 16 - .../rust/src/generated/types/data_store.rs | 1 - .../src/generated/types/lifecycle_hook.rs | 1 - .../types/lifecycle_hook_init_info.rs | 1 - .../types/lifecycle_hook_update_info.rs | 1 - idls/mpl_core.json | 179 ------ programs/mpl-core/src/instruction.rs | 30 +- programs/mpl-core/src/plugins/data_store.rs | 6 - .../mpl-core/src/plugins/lifecycle_hook.rs | 6 - .../processor/clear_external_plugin_data.rs | 32 - programs/mpl-core/src/processor/mod.rs | 10 - .../processor/write_external_plugin_data.rs | 4 - 25 files changed, 6 insertions(+), 1758 deletions(-) delete mode 100644 clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts delete mode 100644 clients/js/src/generated/instructions/clearExternalPluginDataV1.ts delete mode 100644 clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs delete mode 100644 clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs delete mode 100644 programs/mpl-core/src/processor/clear_external_plugin_data.rs diff --git a/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts b/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts deleted file mode 100644 index 693b5bba..00000000 --- a/clients/js/src/generated/instructions/clearCollectionExternalPluginDataV1.ts +++ /dev/null @@ -1,167 +0,0 @@ -/** - * This code was AUTOGENERATED using the kinobi library. - * Please DO NOT EDIT THIS FILE, instead use visitors - * to add features, then rerun kinobi to update it. - * - * @see https://github.com/metaplex-foundation/kinobi - */ - -import { - Context, - Pda, - PublicKey, - Signer, - TransactionBuilder, - transactionBuilder, -} from '@metaplex-foundation/umi'; -import { - Serializer, - mapSerializer, - struct, - u8, -} from '@metaplex-foundation/umi/serializers'; -import { - ResolvedAccount, - ResolvedAccountsWithIndices, - getAccountMetasAndSigners, -} from '../shared'; -import { - ExternalPluginKey, - ExternalPluginKeyArgs, - getExternalPluginKeySerializer, -} from '../types'; - -// Accounts. -export type ClearCollectionExternalPluginDataV1InstructionAccounts = { - /** The address of the asset */ - collection: PublicKey | Pda; - /** The account paying for the storage fees */ - payer?: Signer; - /** The owner or delegate of the asset */ - authority?: Signer; - /** The system program */ - systemProgram?: PublicKey | Pda; - /** The SPL Noop Program */ - logWrapper?: PublicKey | Pda; -}; - -// Data. -export type ClearCollectionExternalPluginDataV1InstructionData = { - discriminator: number; - key: ExternalPluginKey; -}; - -export type ClearCollectionExternalPluginDataV1InstructionDataArgs = { - key: ExternalPluginKeyArgs; -}; - -export function getClearCollectionExternalPluginDataV1InstructionDataSerializer(): Serializer< - ClearCollectionExternalPluginDataV1InstructionDataArgs, - ClearCollectionExternalPluginDataV1InstructionData -> { - return mapSerializer< - ClearCollectionExternalPluginDataV1InstructionDataArgs, - any, - ClearCollectionExternalPluginDataV1InstructionData - >( - struct( - [ - ['discriminator', u8()], - ['key', getExternalPluginKeySerializer()], - ], - { description: 'ClearCollectionExternalPluginDataV1InstructionData' } - ), - (value) => ({ ...value, discriminator: 31 }) - ) as Serializer< - ClearCollectionExternalPluginDataV1InstructionDataArgs, - ClearCollectionExternalPluginDataV1InstructionData - >; -} - -// Args. -export type ClearCollectionExternalPluginDataV1InstructionArgs = - ClearCollectionExternalPluginDataV1InstructionDataArgs; - -// Instruction. -export function clearCollectionExternalPluginDataV1( - context: Pick, - input: ClearCollectionExternalPluginDataV1InstructionAccounts & - ClearCollectionExternalPluginDataV1InstructionArgs -): TransactionBuilder { - // Program ID. - const programId = context.programs.getPublicKey( - 'mplCore', - 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' - ); - - // Accounts. - const resolvedAccounts = { - collection: { - index: 0, - isWritable: true as boolean, - value: input.collection ?? null, - }, - payer: { - index: 1, - isWritable: true as boolean, - value: input.payer ?? null, - }, - authority: { - index: 2, - isWritable: false as boolean, - value: input.authority ?? null, - }, - systemProgram: { - index: 3, - isWritable: false as boolean, - value: input.systemProgram ?? null, - }, - logWrapper: { - index: 4, - isWritable: false as boolean, - value: input.logWrapper ?? null, - }, - } satisfies ResolvedAccountsWithIndices; - - // Arguments. - const resolvedArgs: ClearCollectionExternalPluginDataV1InstructionArgs = { - ...input, - }; - - // Default values. - if (!resolvedAccounts.payer.value) { - resolvedAccounts.payer.value = context.payer; - } - if (!resolvedAccounts.systemProgram.value) { - resolvedAccounts.systemProgram.value = context.programs.getPublicKey( - 'splSystem', - '11111111111111111111111111111111' - ); - resolvedAccounts.systemProgram.isWritable = false; - } - - // Accounts in order. - const orderedAccounts: ResolvedAccount[] = Object.values( - resolvedAccounts - ).sort((a, b) => a.index - b.index); - - // Keys and Signers. - const [keys, signers] = getAccountMetasAndSigners( - orderedAccounts, - 'programId', - programId - ); - - // Data. - const data = - getClearCollectionExternalPluginDataV1InstructionDataSerializer().serialize( - resolvedArgs as ClearCollectionExternalPluginDataV1InstructionDataArgs - ); - - // Bytes Created On Chain. - const bytesCreatedOnChain = 0; - - return transactionBuilder([ - { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, - ]); -} diff --git a/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts b/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts deleted file mode 100644 index 3e9bde27..00000000 --- a/clients/js/src/generated/instructions/clearExternalPluginDataV1.ts +++ /dev/null @@ -1,172 +0,0 @@ -/** - * This code was AUTOGENERATED using the kinobi library. - * Please DO NOT EDIT THIS FILE, instead use visitors - * to add features, then rerun kinobi to update it. - * - * @see https://github.com/metaplex-foundation/kinobi - */ - -import { - Context, - Pda, - PublicKey, - Signer, - TransactionBuilder, - transactionBuilder, -} from '@metaplex-foundation/umi'; -import { - Serializer, - mapSerializer, - struct, - u8, -} from '@metaplex-foundation/umi/serializers'; -import { - ResolvedAccount, - ResolvedAccountsWithIndices, - getAccountMetasAndSigners, -} from '../shared'; -import { - ExternalPluginKey, - ExternalPluginKeyArgs, - getExternalPluginKeySerializer, -} from '../types'; - -// Accounts. -export type ClearExternalPluginDataV1InstructionAccounts = { - /** The address of the asset */ - asset: PublicKey | Pda; - /** The collection to which the asset belongs */ - collection?: PublicKey | Pda; - /** The account paying for the storage fees */ - payer?: Signer; - /** The owner or delegate of the asset */ - authority?: Signer; - /** The system program */ - systemProgram?: PublicKey | Pda; - /** The SPL Noop Program */ - logWrapper?: PublicKey | Pda; -}; - -// Data. -export type ClearExternalPluginDataV1InstructionData = { - discriminator: number; - key: ExternalPluginKey; -}; - -export type ClearExternalPluginDataV1InstructionDataArgs = { - key: ExternalPluginKeyArgs; -}; - -export function getClearExternalPluginDataV1InstructionDataSerializer(): Serializer< - ClearExternalPluginDataV1InstructionDataArgs, - ClearExternalPluginDataV1InstructionData -> { - return mapSerializer< - ClearExternalPluginDataV1InstructionDataArgs, - any, - ClearExternalPluginDataV1InstructionData - >( - struct( - [ - ['discriminator', u8()], - ['key', getExternalPluginKeySerializer()], - ], - { description: 'ClearExternalPluginDataV1InstructionData' } - ), - (value) => ({ ...value, discriminator: 30 }) - ) as Serializer< - ClearExternalPluginDataV1InstructionDataArgs, - ClearExternalPluginDataV1InstructionData - >; -} - -// Args. -export type ClearExternalPluginDataV1InstructionArgs = - ClearExternalPluginDataV1InstructionDataArgs; - -// Instruction. -export function clearExternalPluginDataV1( - context: Pick, - input: ClearExternalPluginDataV1InstructionAccounts & - ClearExternalPluginDataV1InstructionArgs -): TransactionBuilder { - // Program ID. - const programId = context.programs.getPublicKey( - 'mplCore', - 'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' - ); - - // Accounts. - const resolvedAccounts = { - asset: { - index: 0, - isWritable: true as boolean, - value: input.asset ?? null, - }, - collection: { - index: 1, - isWritable: true as boolean, - value: input.collection ?? null, - }, - payer: { - index: 2, - isWritable: true as boolean, - value: input.payer ?? null, - }, - authority: { - index: 3, - isWritable: false as boolean, - value: input.authority ?? null, - }, - systemProgram: { - index: 4, - isWritable: false as boolean, - value: input.systemProgram ?? null, - }, - logWrapper: { - index: 5, - isWritable: false as boolean, - value: input.logWrapper ?? null, - }, - } satisfies ResolvedAccountsWithIndices; - - // Arguments. - const resolvedArgs: ClearExternalPluginDataV1InstructionArgs = { ...input }; - - // Default values. - if (!resolvedAccounts.payer.value) { - resolvedAccounts.payer.value = context.payer; - } - if (!resolvedAccounts.systemProgram.value) { - resolvedAccounts.systemProgram.value = context.programs.getPublicKey( - 'splSystem', - '11111111111111111111111111111111' - ); - resolvedAccounts.systemProgram.isWritable = false; - } - - // Accounts in order. - const orderedAccounts: ResolvedAccount[] = Object.values( - resolvedAccounts - ).sort((a, b) => a.index - b.index); - - // Keys and Signers. - const [keys, signers] = getAccountMetasAndSigners( - orderedAccounts, - 'programId', - programId - ); - - // Data. - const data = - getClearExternalPluginDataV1InstructionDataSerializer().serialize( - resolvedArgs as ClearExternalPluginDataV1InstructionDataArgs - ); - - // Bytes Created On Chain. - const bytesCreatedOnChain = 0; - - return transactionBuilder([ - { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, - ]); -} diff --git a/clients/js/src/generated/instructions/index.ts b/clients/js/src/generated/instructions/index.ts index cfad9bf4..7ffc9bb3 100644 --- a/clients/js/src/generated/instructions/index.ts +++ b/clients/js/src/generated/instructions/index.ts @@ -14,8 +14,6 @@ export * from './approveCollectionPluginAuthorityV1'; export * from './approvePluginAuthorityV1'; export * from './burnCollectionV1'; export * from './burnV1'; -export * from './clearCollectionExternalPluginDataV1'; -export * from './clearExternalPluginDataV1'; export * from './collect'; export * from './compressV1'; export * from './createCollectionV1'; diff --git a/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts b/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts index 84943d10..c3fe5128 100644 --- a/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts +++ b/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts @@ -20,7 +20,6 @@ import { mapSerializer, struct, u32, - u64, u8, } from '@metaplex-foundation/umi/serializers'; import { @@ -52,13 +51,11 @@ export type WriteCollectionExternalPluginDataV1InstructionAccounts = { export type WriteCollectionExternalPluginDataV1InstructionData = { discriminator: number; key: ExternalPluginKey; - offset: bigint; data: Uint8Array; }; export type WriteCollectionExternalPluginDataV1InstructionDataArgs = { key: ExternalPluginKeyArgs; - offset: number | bigint; data: Uint8Array; }; @@ -75,7 +72,6 @@ export function getWriteCollectionExternalPluginDataV1InstructionDataSerializer( [ ['discriminator', u8()], ['key', getExternalPluginKeySerializer()], - ['offset', u64()], ['data', bytes({ size: u32() })], ], { description: 'WriteCollectionExternalPluginDataV1InstructionData' } diff --git a/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts b/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts index 4d27021c..27e66fa1 100644 --- a/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts +++ b/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts @@ -20,7 +20,6 @@ import { mapSerializer, struct, u32, - u64, u8, } from '@metaplex-foundation/umi/serializers'; import { @@ -54,13 +53,11 @@ export type WriteExternalPluginDataV1InstructionAccounts = { export type WriteExternalPluginDataV1InstructionData = { discriminator: number; key: ExternalPluginKey; - offset: bigint; data: Uint8Array; }; export type WriteExternalPluginDataV1InstructionDataArgs = { key: ExternalPluginKeyArgs; - offset: number | bigint; data: Uint8Array; }; @@ -77,7 +74,6 @@ export function getWriteExternalPluginDataV1InstructionDataSerializer(): Seriali [ ['discriminator', u8()], ['key', getExternalPluginKeySerializer()], - ['offset', u64()], ['data', bytes({ size: u32() })], ], { description: 'WriteExternalPluginDataV1InstructionData' } diff --git a/clients/js/src/generated/types/dataStore.ts b/clients/js/src/generated/types/dataStore.ts index 0b055c65..7ec1331d 100644 --- a/clients/js/src/generated/types/dataStore.ts +++ b/clients/js/src/generated/types/dataStore.ts @@ -19,7 +19,6 @@ import { export type DataStore = { dataAuthority: PluginAuthority; schema: ExternalPluginSchema; - maxSize: bigint; dataOffset: bigint; dataLen: bigint; }; @@ -27,7 +26,6 @@ export type DataStore = { export type DataStoreArgs = { dataAuthority: PluginAuthorityArgs; schema: ExternalPluginSchemaArgs; - maxSize: number | bigint; dataOffset: number | bigint; dataLen: number | bigint; }; @@ -37,7 +35,6 @@ export function getDataStoreSerializer(): Serializer { [ ['dataAuthority', getPluginAuthoritySerializer()], ['schema', getExternalPluginSchemaSerializer()], - ['maxSize', u64()], ['dataOffset', u64()], ['dataLen', u64()], ], diff --git a/clients/js/src/generated/types/lifecycleHook.ts b/clients/js/src/generated/types/lifecycleHook.ts index 03f9305a..3689a806 100644 --- a/clients/js/src/generated/types/lifecycleHook.ts +++ b/clients/js/src/generated/types/lifecycleHook.ts @@ -32,7 +32,6 @@ export type LifecycleHook = { extraAccounts: Option>; dataAuthority: Option; schema: ExternalPluginSchema; - maxSize: bigint; dataOffset: bigint; dataLen: bigint; }; @@ -42,7 +41,6 @@ export type LifecycleHookArgs = { extraAccounts: OptionOrNullable>; dataAuthority: OptionOrNullable; schema: ExternalPluginSchemaArgs; - maxSize: number | bigint; dataOffset: number | bigint; dataLen: number | bigint; }; @@ -57,7 +55,6 @@ export function getLifecycleHookSerializer(): Serializer< ['extraAccounts', option(array(getExtraAccountSerializer()))], ['dataAuthority', option(getPluginAuthoritySerializer())], ['schema', getExternalPluginSchemaSerializer()], - ['maxSize', u64()], ['dataOffset', u64()], ['dataLen', u64()], ], diff --git a/clients/js/src/generated/types/lifecycleHookInitInfo.ts b/clients/js/src/generated/types/lifecycleHookInitInfo.ts index 4e98224e..25b54483 100644 --- a/clients/js/src/generated/types/lifecycleHookInitInfo.ts +++ b/clients/js/src/generated/types/lifecycleHookInitInfo.ts @@ -14,7 +14,6 @@ import { publicKey as publicKeySerializer, struct, tuple, - u64, } from '@metaplex-foundation/umi/serializers'; import { ExternalCheckResult, @@ -41,7 +40,6 @@ export type LifecycleHookInitInfo = { extraAccounts: Option>; dataAuthority: Option; schema: Option; - maxSize: bigint; }; export type LifecycleHookInitInfoArgs = { @@ -53,7 +51,6 @@ export type LifecycleHookInitInfoArgs = { extraAccounts: OptionOrNullable>; dataAuthority: OptionOrNullable; schema: OptionOrNullable; - maxSize: number | bigint; }; export function getLifecycleHookInitInfoSerializer(): Serializer< @@ -78,7 +75,6 @@ export function getLifecycleHookInitInfoSerializer(): Serializer< ['extraAccounts', option(array(getExtraAccountSerializer()))], ['dataAuthority', option(getPluginAuthoritySerializer())], ['schema', option(getExternalPluginSchemaSerializer())], - ['maxSize', u64()], ], { description: 'LifecycleHookInitInfo' } ) as Serializer; diff --git a/clients/js/src/generated/types/lifecycleHookUpdateInfo.ts b/clients/js/src/generated/types/lifecycleHookUpdateInfo.ts index 54f4be3c..c1d0f456 100644 --- a/clients/js/src/generated/types/lifecycleHookUpdateInfo.ts +++ b/clients/js/src/generated/types/lifecycleHookUpdateInfo.ts @@ -13,7 +13,6 @@ import { option, struct, tuple, - u64, } from '@metaplex-foundation/umi/serializers'; import { ExternalCheckResult, @@ -34,7 +33,6 @@ export type LifecycleHookUpdateInfo = { lifecycleChecks: Option>; extraAccounts: Option>; schema: Option; - maxSize: bigint; }; export type LifecycleHookUpdateInfoArgs = { @@ -43,7 +41,6 @@ export type LifecycleHookUpdateInfoArgs = { >; extraAccounts: OptionOrNullable>; schema: OptionOrNullable; - maxSize: number | bigint; }; export function getLifecycleHookUpdateInfoSerializer(): Serializer< @@ -65,7 +62,6 @@ export function getLifecycleHookUpdateInfoSerializer(): Serializer< ], ['extraAccounts', option(array(getExtraAccountSerializer()))], ['schema', option(getExternalPluginSchemaSerializer())], - ['maxSize', u64()], ], { description: 'LifecycleHookUpdateInfo' } ) as Serializer; diff --git a/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs deleted file mode 100644 index ab7ac97c..00000000 --- a/clients/rust/src/generated/instructions/clear_collection_external_plugin_data_v1.rs +++ /dev/null @@ -1,521 +0,0 @@ -//! This code was AUTOGENERATED using the kinobi library. -//! Please DO NOT EDIT THIS FILE, instead use visitors -//! to add features, then rerun kinobi to update it. -//! -//! [https://github.com/metaplex-foundation/kinobi] -//! - -use crate::generated::types::ExternalPluginKey; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; - -/// Accounts. -pub struct ClearCollectionExternalPluginDataV1 { - /// The address of the asset - pub collection: solana_program::pubkey::Pubkey, - /// The account paying for the storage fees - pub payer: solana_program::pubkey::Pubkey, - /// The owner or delegate of the asset - pub authority: Option, - /// The system program - pub system_program: solana_program::pubkey::Pubkey, - /// The SPL Noop Program - pub log_wrapper: Option, -} - -impl ClearCollectionExternalPluginDataV1 { - pub fn instruction( - &self, - args: ClearCollectionExternalPluginDataV1InstructionArgs, - ) -> solana_program::instruction::Instruction { - self.instruction_with_remaining_accounts(args, &[]) - } - #[allow(clippy::vec_init_then_push)] - pub fn instruction_with_remaining_accounts( - &self, - args: ClearCollectionExternalPluginDataV1InstructionArgs, - remaining_accounts: &[solana_program::instruction::AccountMeta], - ) -> solana_program::instruction::Instruction { - let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); - accounts.push(solana_program::instruction::AccountMeta::new( - self.collection, - false, - )); - accounts.push(solana_program::instruction::AccountMeta::new( - self.payer, true, - )); - if let Some(authority) = self.authority { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - authority, true, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.system_program, - false, - )); - if let Some(log_wrapper) = self.log_wrapper { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - log_wrapper, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.extend_from_slice(remaining_accounts); - let mut data = ClearCollectionExternalPluginDataV1InstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = args.try_to_vec().unwrap(); - data.append(&mut args); - - solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_ID, - accounts, - data, - } - } -} - -#[derive(BorshDeserialize, BorshSerialize)] -struct ClearCollectionExternalPluginDataV1InstructionData { - discriminator: u8, -} - -impl ClearCollectionExternalPluginDataV1InstructionData { - fn new() -> Self { - Self { discriminator: 31 } - } -} - -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ClearCollectionExternalPluginDataV1InstructionArgs { - pub key: ExternalPluginKey, -} - -/// Instruction builder for `ClearCollectionExternalPluginDataV1`. -/// -/// ### Accounts: -/// -/// 0. `[writable]` collection -/// 1. `[writable, signer]` payer -/// 2. `[signer, optional]` authority -/// 3. `[optional]` system_program (default to `11111111111111111111111111111111`) -/// 4. `[optional]` log_wrapper -#[derive(Default)] -pub struct ClearCollectionExternalPluginDataV1Builder { - collection: Option, - payer: Option, - authority: Option, - system_program: Option, - log_wrapper: Option, - key: Option, - __remaining_accounts: Vec, -} - -impl ClearCollectionExternalPluginDataV1Builder { - pub fn new() -> Self { - Self::default() - } - /// The address of the asset - #[inline(always)] - pub fn collection(&mut self, collection: solana_program::pubkey::Pubkey) -> &mut Self { - self.collection = Some(collection); - self - } - /// The account paying for the storage fees - #[inline(always)] - pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { - self.payer = Some(payer); - self - } - /// `[optional account]` - /// The owner or delegate of the asset - #[inline(always)] - pub fn authority(&mut self, authority: Option) -> &mut Self { - self.authority = authority; - self - } - /// `[optional account, default to '11111111111111111111111111111111']` - /// The system program - #[inline(always)] - pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { - self.system_program = Some(system_program); - self - } - /// `[optional account]` - /// The SPL Noop Program - #[inline(always)] - pub fn log_wrapper( - &mut self, - log_wrapper: Option, - ) -> &mut Self { - self.log_wrapper = log_wrapper; - self - } - #[inline(always)] - pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { - self.key = Some(key); - self - } - /// Add an aditional account to the instruction. - #[inline(always)] - pub fn add_remaining_account( - &mut self, - account: solana_program::instruction::AccountMeta, - ) -> &mut Self { - self.__remaining_accounts.push(account); - self - } - /// Add additional accounts to the instruction. - #[inline(always)] - pub fn add_remaining_accounts( - &mut self, - accounts: &[solana_program::instruction::AccountMeta], - ) -> &mut Self { - self.__remaining_accounts.extend_from_slice(accounts); - self - } - #[allow(clippy::clone_on_copy)] - pub fn instruction(&self) -> solana_program::instruction::Instruction { - let accounts = ClearCollectionExternalPluginDataV1 { - collection: self.collection.expect("collection is not set"), - payer: self.payer.expect("payer is not set"), - authority: self.authority, - system_program: self - .system_program - .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), - log_wrapper: self.log_wrapper, - }; - let args = ClearCollectionExternalPluginDataV1InstructionArgs { - key: self.key.clone().expect("key is not set"), - }; - - accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) - } -} - -/// `clear_collection_external_plugin_data_v1` CPI accounts. -pub struct ClearCollectionExternalPluginDataV1CpiAccounts<'a, 'b> { - /// The address of the asset - pub collection: &'b solana_program::account_info::AccountInfo<'a>, - /// The account paying for the storage fees - pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset - pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The system program - pub system_program: &'b solana_program::account_info::AccountInfo<'a>, - /// The SPL Noop Program - pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, -} - -/// `clear_collection_external_plugin_data_v1` CPI instruction. -pub struct ClearCollectionExternalPluginDataV1Cpi<'a, 'b> { - /// The program to invoke. - pub __program: &'b solana_program::account_info::AccountInfo<'a>, - /// The address of the asset - pub collection: &'b solana_program::account_info::AccountInfo<'a>, - /// The account paying for the storage fees - pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset - pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The system program - pub system_program: &'b solana_program::account_info::AccountInfo<'a>, - /// The SPL Noop Program - pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The arguments for the instruction. - pub __args: ClearCollectionExternalPluginDataV1InstructionArgs, -} - -impl<'a, 'b> ClearCollectionExternalPluginDataV1Cpi<'a, 'b> { - pub fn new( - program: &'b solana_program::account_info::AccountInfo<'a>, - accounts: ClearCollectionExternalPluginDataV1CpiAccounts<'a, 'b>, - args: ClearCollectionExternalPluginDataV1InstructionArgs, - ) -> Self { - Self { - __program: program, - collection: accounts.collection, - payer: accounts.payer, - authority: accounts.authority, - system_program: accounts.system_program, - log_wrapper: accounts.log_wrapper, - __args: args, - } - } - #[inline(always)] - pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(&[], &[]) - } - #[inline(always)] - pub fn invoke_with_remaining_accounts( - &self, - remaining_accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) - } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) - } - #[allow(clippy::clone_on_copy)] - #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed_with_remaining_accounts( - &self, - signers_seeds: &[&[&[u8]]], - remaining_accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> solana_program::entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(5 + remaining_accounts.len()); - accounts.push(solana_program::instruction::AccountMeta::new( - *self.collection.key, - false, - )); - accounts.push(solana_program::instruction::AccountMeta::new( - *self.payer.key, - true, - )); - if let Some(authority) = self.authority { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *authority.key, - true, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.system_program.key, - false, - )); - if let Some(log_wrapper) = self.log_wrapper { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *log_wrapper.key, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - remaining_accounts.iter().for_each(|remaining_account| { - accounts.push(solana_program::instruction::AccountMeta { - pubkey: *remaining_account.0.key, - is_signer: remaining_account.1, - is_writable: remaining_account.2, - }) - }); - let mut data = ClearCollectionExternalPluginDataV1InstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); - data.append(&mut args); - - let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_ID, - accounts, - data, - }; - let mut account_infos = Vec::with_capacity(5 + 1 + remaining_accounts.len()); - account_infos.push(self.__program.clone()); - account_infos.push(self.collection.clone()); - account_infos.push(self.payer.clone()); - if let Some(authority) = self.authority { - account_infos.push(authority.clone()); - } - account_infos.push(self.system_program.clone()); - if let Some(log_wrapper) = self.log_wrapper { - account_infos.push(log_wrapper.clone()); - } - remaining_accounts - .iter() - .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); - - if signers_seeds.is_empty() { - solana_program::program::invoke(&instruction, &account_infos) - } else { - solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) - } - } -} - -/// Instruction builder for `ClearCollectionExternalPluginDataV1` via CPI. -/// -/// ### Accounts: -/// -/// 0. `[writable]` collection -/// 1. `[writable, signer]` payer -/// 2. `[signer, optional]` authority -/// 3. `[]` system_program -/// 4. `[optional]` log_wrapper -pub struct ClearCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { - instruction: Box>, -} - -impl<'a, 'b> ClearCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { - pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { - let instruction = Box::new(ClearCollectionExternalPluginDataV1CpiBuilderInstruction { - __program: program, - collection: None, - payer: None, - authority: None, - system_program: None, - log_wrapper: None, - key: None, - __remaining_accounts: Vec::new(), - }); - Self { instruction } - } - /// The address of the asset - #[inline(always)] - pub fn collection( - &mut self, - collection: &'b solana_program::account_info::AccountInfo<'a>, - ) -> &mut Self { - self.instruction.collection = Some(collection); - self - } - /// The account paying for the storage fees - #[inline(always)] - pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { - self.instruction.payer = Some(payer); - self - } - /// `[optional account]` - /// The owner or delegate of the asset - #[inline(always)] - pub fn authority( - &mut self, - authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.authority = authority; - self - } - /// The system program - #[inline(always)] - pub fn system_program( - &mut self, - system_program: &'b solana_program::account_info::AccountInfo<'a>, - ) -> &mut Self { - self.instruction.system_program = Some(system_program); - self - } - /// `[optional account]` - /// The SPL Noop Program - #[inline(always)] - pub fn log_wrapper( - &mut self, - log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.log_wrapper = log_wrapper; - self - } - #[inline(always)] - pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { - self.instruction.key = Some(key); - self - } - /// Add an additional account to the instruction. - #[inline(always)] - pub fn add_remaining_account( - &mut self, - account: &'b solana_program::account_info::AccountInfo<'a>, - is_writable: bool, - is_signer: bool, - ) -> &mut Self { - self.instruction - .__remaining_accounts - .push((account, is_writable, is_signer)); - self - } - /// Add additional accounts to the instruction. - /// - /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, - /// and a `bool` indicating whether the account is a signer or not. - #[inline(always)] - pub fn add_remaining_accounts( - &mut self, - accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> &mut Self { - self.instruction - .__remaining_accounts - .extend_from_slice(accounts); - self - } - #[inline(always)] - pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed(&[]) - } - #[allow(clippy::clone_on_copy)] - #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program::entrypoint::ProgramResult { - let args = ClearCollectionExternalPluginDataV1InstructionArgs { - key: self.instruction.key.clone().expect("key is not set"), - }; - let instruction = ClearCollectionExternalPluginDataV1Cpi { - __program: self.instruction.__program, - - collection: self.instruction.collection.expect("collection is not set"), - - payer: self.instruction.payer.expect("payer is not set"), - - authority: self.instruction.authority, - - system_program: self - .instruction - .system_program - .expect("system_program is not set"), - - log_wrapper: self.instruction.log_wrapper, - __args: args, - }; - instruction.invoke_signed_with_remaining_accounts( - signers_seeds, - &self.instruction.__remaining_accounts, - ) - } -} - -struct ClearCollectionExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { - __program: &'b solana_program::account_info::AccountInfo<'a>, - collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, - authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, - log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - key: Option, - /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. - __remaining_accounts: Vec<( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )>, -} diff --git a/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs deleted file mode 100644 index 7af98dd5..00000000 --- a/clients/rust/src/generated/instructions/clear_external_plugin_data_v1.rs +++ /dev/null @@ -1,573 +0,0 @@ -//! This code was AUTOGENERATED using the kinobi library. -//! Please DO NOT EDIT THIS FILE, instead use visitors -//! to add features, then rerun kinobi to update it. -//! -//! [https://github.com/metaplex-foundation/kinobi] -//! - -use crate::generated::types::ExternalPluginKey; -use borsh::BorshDeserialize; -use borsh::BorshSerialize; - -/// Accounts. -pub struct ClearExternalPluginDataV1 { - /// The address of the asset - pub asset: solana_program::pubkey::Pubkey, - /// The collection to which the asset belongs - pub collection: Option, - /// The account paying for the storage fees - pub payer: solana_program::pubkey::Pubkey, - /// The owner or delegate of the asset - pub authority: Option, - /// The system program - pub system_program: solana_program::pubkey::Pubkey, - /// The SPL Noop Program - pub log_wrapper: Option, -} - -impl ClearExternalPluginDataV1 { - pub fn instruction( - &self, - args: ClearExternalPluginDataV1InstructionArgs, - ) -> solana_program::instruction::Instruction { - self.instruction_with_remaining_accounts(args, &[]) - } - #[allow(clippy::vec_init_then_push)] - pub fn instruction_with_remaining_accounts( - &self, - args: ClearExternalPluginDataV1InstructionArgs, - remaining_accounts: &[solana_program::instruction::AccountMeta], - ) -> solana_program::instruction::Instruction { - let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); - accounts.push(solana_program::instruction::AccountMeta::new( - self.asset, false, - )); - if let Some(collection) = self.collection { - accounts.push(solana_program::instruction::AccountMeta::new( - collection, false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new( - self.payer, true, - )); - if let Some(authority) = self.authority { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - authority, true, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - self.system_program, - false, - )); - if let Some(log_wrapper) = self.log_wrapper { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - log_wrapper, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.extend_from_slice(remaining_accounts); - let mut data = ClearExternalPluginDataV1InstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = args.try_to_vec().unwrap(); - data.append(&mut args); - - solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_ID, - accounts, - data, - } - } -} - -#[derive(BorshDeserialize, BorshSerialize)] -struct ClearExternalPluginDataV1InstructionData { - discriminator: u8, -} - -impl ClearExternalPluginDataV1InstructionData { - fn new() -> Self { - Self { discriminator: 30 } - } -} - -#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ClearExternalPluginDataV1InstructionArgs { - pub key: ExternalPluginKey, -} - -/// Instruction builder for `ClearExternalPluginDataV1`. -/// -/// ### Accounts: -/// -/// 0. `[writable]` asset -/// 1. `[writable, optional]` collection -/// 2. `[writable, signer]` payer -/// 3. `[signer, optional]` authority -/// 4. `[optional]` system_program (default to `11111111111111111111111111111111`) -/// 5. `[optional]` log_wrapper -#[derive(Default)] -pub struct ClearExternalPluginDataV1Builder { - asset: Option, - collection: Option, - payer: Option, - authority: Option, - system_program: Option, - log_wrapper: Option, - key: Option, - __remaining_accounts: Vec, -} - -impl ClearExternalPluginDataV1Builder { - pub fn new() -> Self { - Self::default() - } - /// The address of the asset - #[inline(always)] - pub fn asset(&mut self, asset: solana_program::pubkey::Pubkey) -> &mut Self { - self.asset = Some(asset); - self - } - /// `[optional account]` - /// The collection to which the asset belongs - #[inline(always)] - pub fn collection(&mut self, collection: Option) -> &mut Self { - self.collection = collection; - self - } - /// The account paying for the storage fees - #[inline(always)] - pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { - self.payer = Some(payer); - self - } - /// `[optional account]` - /// The owner or delegate of the asset - #[inline(always)] - pub fn authority(&mut self, authority: Option) -> &mut Self { - self.authority = authority; - self - } - /// `[optional account, default to '11111111111111111111111111111111']` - /// The system program - #[inline(always)] - pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { - self.system_program = Some(system_program); - self - } - /// `[optional account]` - /// The SPL Noop Program - #[inline(always)] - pub fn log_wrapper( - &mut self, - log_wrapper: Option, - ) -> &mut Self { - self.log_wrapper = log_wrapper; - self - } - #[inline(always)] - pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { - self.key = Some(key); - self - } - /// Add an aditional account to the instruction. - #[inline(always)] - pub fn add_remaining_account( - &mut self, - account: solana_program::instruction::AccountMeta, - ) -> &mut Self { - self.__remaining_accounts.push(account); - self - } - /// Add additional accounts to the instruction. - #[inline(always)] - pub fn add_remaining_accounts( - &mut self, - accounts: &[solana_program::instruction::AccountMeta], - ) -> &mut Self { - self.__remaining_accounts.extend_from_slice(accounts); - self - } - #[allow(clippy::clone_on_copy)] - pub fn instruction(&self) -> solana_program::instruction::Instruction { - let accounts = ClearExternalPluginDataV1 { - asset: self.asset.expect("asset is not set"), - collection: self.collection, - payer: self.payer.expect("payer is not set"), - authority: self.authority, - system_program: self - .system_program - .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), - log_wrapper: self.log_wrapper, - }; - let args = ClearExternalPluginDataV1InstructionArgs { - key: self.key.clone().expect("key is not set"), - }; - - accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) - } -} - -/// `clear_external_plugin_data_v1` CPI accounts. -pub struct ClearExternalPluginDataV1CpiAccounts<'a, 'b> { - /// The address of the asset - pub asset: &'b solana_program::account_info::AccountInfo<'a>, - /// The collection to which the asset belongs - pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The account paying for the storage fees - pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset - pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The system program - pub system_program: &'b solana_program::account_info::AccountInfo<'a>, - /// The SPL Noop Program - pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, -} - -/// `clear_external_plugin_data_v1` CPI instruction. -pub struct ClearExternalPluginDataV1Cpi<'a, 'b> { - /// The program to invoke. - pub __program: &'b solana_program::account_info::AccountInfo<'a>, - /// The address of the asset - pub asset: &'b solana_program::account_info::AccountInfo<'a>, - /// The collection to which the asset belongs - pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The account paying for the storage fees - pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset - pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The system program - pub system_program: &'b solana_program::account_info::AccountInfo<'a>, - /// The SPL Noop Program - pub log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - /// The arguments for the instruction. - pub __args: ClearExternalPluginDataV1InstructionArgs, -} - -impl<'a, 'b> ClearExternalPluginDataV1Cpi<'a, 'b> { - pub fn new( - program: &'b solana_program::account_info::AccountInfo<'a>, - accounts: ClearExternalPluginDataV1CpiAccounts<'a, 'b>, - args: ClearExternalPluginDataV1InstructionArgs, - ) -> Self { - Self { - __program: program, - asset: accounts.asset, - collection: accounts.collection, - payer: accounts.payer, - authority: accounts.authority, - system_program: accounts.system_program, - log_wrapper: accounts.log_wrapper, - __args: args, - } - } - #[inline(always)] - pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(&[], &[]) - } - #[inline(always)] - pub fn invoke_with_remaining_accounts( - &self, - remaining_accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) - } - #[inline(always)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) - } - #[allow(clippy::clone_on_copy)] - #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed_with_remaining_accounts( - &self, - signers_seeds: &[&[&[u8]]], - remaining_accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> solana_program::entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); - accounts.push(solana_program::instruction::AccountMeta::new( - *self.asset.key, - false, - )); - if let Some(collection) = self.collection { - accounts.push(solana_program::instruction::AccountMeta::new( - *collection.key, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new( - *self.payer.key, - true, - )); - if let Some(authority) = self.authority { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *authority.key, - true, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *self.system_program.key, - false, - )); - if let Some(log_wrapper) = self.log_wrapper { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - *log_wrapper.key, - false, - )); - } else { - accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_ID, - false, - )); - } - remaining_accounts.iter().for_each(|remaining_account| { - accounts.push(solana_program::instruction::AccountMeta { - pubkey: *remaining_account.0.key, - is_signer: remaining_account.1, - is_writable: remaining_account.2, - }) - }); - let mut data = ClearExternalPluginDataV1InstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); - data.append(&mut args); - - let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_ID, - accounts, - data, - }; - let mut account_infos = Vec::with_capacity(6 + 1 + remaining_accounts.len()); - account_infos.push(self.__program.clone()); - account_infos.push(self.asset.clone()); - if let Some(collection) = self.collection { - account_infos.push(collection.clone()); - } - account_infos.push(self.payer.clone()); - if let Some(authority) = self.authority { - account_infos.push(authority.clone()); - } - account_infos.push(self.system_program.clone()); - if let Some(log_wrapper) = self.log_wrapper { - account_infos.push(log_wrapper.clone()); - } - remaining_accounts - .iter() - .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); - - if signers_seeds.is_empty() { - solana_program::program::invoke(&instruction, &account_infos) - } else { - solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) - } - } -} - -/// Instruction builder for `ClearExternalPluginDataV1` via CPI. -/// -/// ### Accounts: -/// -/// 0. `[writable]` asset -/// 1. `[writable, optional]` collection -/// 2. `[writable, signer]` payer -/// 3. `[signer, optional]` authority -/// 4. `[]` system_program -/// 5. `[optional]` log_wrapper -pub struct ClearExternalPluginDataV1CpiBuilder<'a, 'b> { - instruction: Box>, -} - -impl<'a, 'b> ClearExternalPluginDataV1CpiBuilder<'a, 'b> { - pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { - let instruction = Box::new(ClearExternalPluginDataV1CpiBuilderInstruction { - __program: program, - asset: None, - collection: None, - payer: None, - authority: None, - system_program: None, - log_wrapper: None, - key: None, - __remaining_accounts: Vec::new(), - }); - Self { instruction } - } - /// The address of the asset - #[inline(always)] - pub fn asset(&mut self, asset: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { - self.instruction.asset = Some(asset); - self - } - /// `[optional account]` - /// The collection to which the asset belongs - #[inline(always)] - pub fn collection( - &mut self, - collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.collection = collection; - self - } - /// The account paying for the storage fees - #[inline(always)] - pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { - self.instruction.payer = Some(payer); - self - } - /// `[optional account]` - /// The owner or delegate of the asset - #[inline(always)] - pub fn authority( - &mut self, - authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.authority = authority; - self - } - /// The system program - #[inline(always)] - pub fn system_program( - &mut self, - system_program: &'b solana_program::account_info::AccountInfo<'a>, - ) -> &mut Self { - self.instruction.system_program = Some(system_program); - self - } - /// `[optional account]` - /// The SPL Noop Program - #[inline(always)] - pub fn log_wrapper( - &mut self, - log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - ) -> &mut Self { - self.instruction.log_wrapper = log_wrapper; - self - } - #[inline(always)] - pub fn key(&mut self, key: ExternalPluginKey) -> &mut Self { - self.instruction.key = Some(key); - self - } - /// Add an additional account to the instruction. - #[inline(always)] - pub fn add_remaining_account( - &mut self, - account: &'b solana_program::account_info::AccountInfo<'a>, - is_writable: bool, - is_signer: bool, - ) -> &mut Self { - self.instruction - .__remaining_accounts - .push((account, is_writable, is_signer)); - self - } - /// Add additional accounts to the instruction. - /// - /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, - /// and a `bool` indicating whether the account is a signer or not. - #[inline(always)] - pub fn add_remaining_accounts( - &mut self, - accounts: &[( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )], - ) -> &mut Self { - self.instruction - .__remaining_accounts - .extend_from_slice(accounts); - self - } - #[inline(always)] - pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { - self.invoke_signed(&[]) - } - #[allow(clippy::clone_on_copy)] - #[allow(clippy::vec_init_then_push)] - pub fn invoke_signed( - &self, - signers_seeds: &[&[&[u8]]], - ) -> solana_program::entrypoint::ProgramResult { - let args = ClearExternalPluginDataV1InstructionArgs { - key: self.instruction.key.clone().expect("key is not set"), - }; - let instruction = ClearExternalPluginDataV1Cpi { - __program: self.instruction.__program, - - asset: self.instruction.asset.expect("asset is not set"), - - collection: self.instruction.collection, - - payer: self.instruction.payer.expect("payer is not set"), - - authority: self.instruction.authority, - - system_program: self - .instruction - .system_program - .expect("system_program is not set"), - - log_wrapper: self.instruction.log_wrapper, - __args: args, - }; - instruction.invoke_signed_with_remaining_accounts( - signers_seeds, - &self.instruction.__remaining_accounts, - ) - } -} - -struct ClearExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { - __program: &'b solana_program::account_info::AccountInfo<'a>, - asset: Option<&'b solana_program::account_info::AccountInfo<'a>>, - collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, - payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, - authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, - system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, - log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, - key: Option, - /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. - __remaining_accounts: Vec<( - &'b solana_program::account_info::AccountInfo<'a>, - bool, - bool, - )>, -} diff --git a/clients/rust/src/generated/instructions/mod.rs b/clients/rust/src/generated/instructions/mod.rs index 00977669..8f936d43 100644 --- a/clients/rust/src/generated/instructions/mod.rs +++ b/clients/rust/src/generated/instructions/mod.rs @@ -13,8 +13,6 @@ pub(crate) mod r#approve_collection_plugin_authority_v1; pub(crate) mod r#approve_plugin_authority_v1; pub(crate) mod r#burn_collection_v1; pub(crate) mod r#burn_v1; -pub(crate) mod r#clear_collection_external_plugin_data_v1; -pub(crate) mod r#clear_external_plugin_data_v1; pub(crate) mod r#collect; pub(crate) mod r#compress_v1; pub(crate) mod r#create_collection_v1; @@ -46,8 +44,6 @@ pub use self::r#approve_collection_plugin_authority_v1::*; pub use self::r#approve_plugin_authority_v1::*; pub use self::r#burn_collection_v1::*; pub use self::r#burn_v1::*; -pub use self::r#clear_collection_external_plugin_data_v1::*; -pub use self::r#clear_external_plugin_data_v1::*; pub use self::r#collect::*; pub use self::r#compress_v1::*; pub use self::r#create_collection_v1::*; diff --git a/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs index 77ae6dbd..94d87acd 100644 --- a/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs @@ -99,7 +99,6 @@ impl WriteCollectionExternalPluginDataV1InstructionData { #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct WriteCollectionExternalPluginDataV1InstructionArgs { pub key: ExternalPluginKey, - pub offset: u64, pub data: Vec, } @@ -120,7 +119,6 @@ pub struct WriteCollectionExternalPluginDataV1Builder { system_program: Option, log_wrapper: Option, key: Option, - offset: Option, data: Option>, __remaining_accounts: Vec, } @@ -171,11 +169,6 @@ impl WriteCollectionExternalPluginDataV1Builder { self } #[inline(always)] - pub fn offset(&mut self, offset: u64) -> &mut Self { - self.offset = Some(offset); - self - } - #[inline(always)] pub fn data(&mut self, data: Vec) -> &mut Self { self.data = Some(data); self @@ -211,7 +204,6 @@ impl WriteCollectionExternalPluginDataV1Builder { }; let args = WriteCollectionExternalPluginDataV1InstructionArgs { key: self.key.clone().expect("key is not set"), - offset: self.offset.clone().expect("offset is not set"), data: self.data.clone().expect("data is not set"), }; @@ -399,7 +391,6 @@ impl<'a, 'b> WriteCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { system_program: None, log_wrapper: None, key: None, - offset: None, data: None, __remaining_accounts: Vec::new(), }); @@ -455,11 +446,6 @@ impl<'a, 'b> WriteCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { self } #[inline(always)] - pub fn offset(&mut self, offset: u64) -> &mut Self { - self.instruction.offset = Some(offset); - self - } - #[inline(always)] pub fn data(&mut self, data: Vec) -> &mut Self { self.instruction.data = Some(data); self @@ -507,7 +493,6 @@ impl<'a, 'b> WriteCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { ) -> solana_program::entrypoint::ProgramResult { let args = WriteCollectionExternalPluginDataV1InstructionArgs { key: self.instruction.key.clone().expect("key is not set"), - offset: self.instruction.offset.clone().expect("offset is not set"), data: self.instruction.data.clone().expect("data is not set"), }; let instruction = WriteCollectionExternalPluginDataV1Cpi { @@ -542,7 +527,6 @@ struct WriteCollectionExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, key: Option, - offset: Option, data: Option>, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. __remaining_accounts: Vec<( diff --git a/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs index c7e8f733..00d56340 100644 --- a/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs @@ -110,7 +110,6 @@ impl WriteExternalPluginDataV1InstructionData { #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct WriteExternalPluginDataV1InstructionArgs { pub key: ExternalPluginKey, - pub offset: u64, pub data: Vec, } @@ -133,7 +132,6 @@ pub struct WriteExternalPluginDataV1Builder { system_program: Option, log_wrapper: Option, key: Option, - offset: Option, data: Option>, __remaining_accounts: Vec, } @@ -191,11 +189,6 @@ impl WriteExternalPluginDataV1Builder { self } #[inline(always)] - pub fn offset(&mut self, offset: u64) -> &mut Self { - self.offset = Some(offset); - self - } - #[inline(always)] pub fn data(&mut self, data: Vec) -> &mut Self { self.data = Some(data); self @@ -232,7 +225,6 @@ impl WriteExternalPluginDataV1Builder { }; let args = WriteExternalPluginDataV1InstructionArgs { key: self.key.clone().expect("key is not set"), - offset: self.offset.clone().expect("offset is not set"), data: self.data.clone().expect("data is not set"), }; @@ -441,7 +433,6 @@ impl<'a, 'b> WriteExternalPluginDataV1CpiBuilder<'a, 'b> { system_program: None, log_wrapper: None, key: None, - offset: None, data: None, __remaining_accounts: Vec::new(), }); @@ -504,11 +495,6 @@ impl<'a, 'b> WriteExternalPluginDataV1CpiBuilder<'a, 'b> { self } #[inline(always)] - pub fn offset(&mut self, offset: u64) -> &mut Self { - self.instruction.offset = Some(offset); - self - } - #[inline(always)] pub fn data(&mut self, data: Vec) -> &mut Self { self.instruction.data = Some(data); self @@ -556,7 +542,6 @@ impl<'a, 'b> WriteExternalPluginDataV1CpiBuilder<'a, 'b> { ) -> solana_program::entrypoint::ProgramResult { let args = WriteExternalPluginDataV1InstructionArgs { key: self.instruction.key.clone().expect("key is not set"), - offset: self.instruction.offset.clone().expect("offset is not set"), data: self.instruction.data.clone().expect("data is not set"), }; let instruction = WriteExternalPluginDataV1Cpi { @@ -594,7 +579,6 @@ struct WriteExternalPluginDataV1CpiBuilderInstruction<'a, 'b> { system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, key: Option, - offset: Option, data: Option>, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. __remaining_accounts: Vec<( diff --git a/clients/rust/src/generated/types/data_store.rs b/clients/rust/src/generated/types/data_store.rs index caccabe3..427be30b 100644 --- a/clients/rust/src/generated/types/data_store.rs +++ b/clients/rust/src/generated/types/data_store.rs @@ -15,7 +15,6 @@ use borsh::BorshSerialize; pub struct DataStore { pub data_authority: PluginAuthority, pub schema: ExternalPluginSchema, - pub max_size: u64, pub data_offset: u64, pub data_len: u64, } diff --git a/clients/rust/src/generated/types/lifecycle_hook.rs b/clients/rust/src/generated/types/lifecycle_hook.rs index 541a829b..44f9c95f 100644 --- a/clients/rust/src/generated/types/lifecycle_hook.rs +++ b/clients/rust/src/generated/types/lifecycle_hook.rs @@ -23,7 +23,6 @@ pub struct LifecycleHook { pub extra_accounts: Option>, pub data_authority: Option, pub schema: ExternalPluginSchema, - pub max_size: u64, pub data_offset: u64, pub data_len: u64, } diff --git a/clients/rust/src/generated/types/lifecycle_hook_init_info.rs b/clients/rust/src/generated/types/lifecycle_hook_init_info.rs index b1c3dd46..4a032a1f 100644 --- a/clients/rust/src/generated/types/lifecycle_hook_init_info.rs +++ b/clients/rust/src/generated/types/lifecycle_hook_init_info.rs @@ -27,5 +27,4 @@ pub struct LifecycleHookInitInfo { pub extra_accounts: Option>, pub data_authority: Option, pub schema: Option, - pub max_size: u64, } diff --git a/clients/rust/src/generated/types/lifecycle_hook_update_info.rs b/clients/rust/src/generated/types/lifecycle_hook_update_info.rs index 686b198e..0613f475 100644 --- a/clients/rust/src/generated/types/lifecycle_hook_update_info.rs +++ b/clients/rust/src/generated/types/lifecycle_hook_update_info.rs @@ -18,5 +18,4 @@ pub struct LifecycleHookUpdateInfo { pub lifecycle_checks: Option>, pub extra_accounts: Option>, pub schema: Option, - pub max_size: u64, } diff --git a/idls/mpl_core.json b/idls/mpl_core.json index 573e1803..e202d22e 100644 --- a/idls/mpl_core.json +++ b/idls/mpl_core.json @@ -1911,133 +1911,6 @@ "type": "u8", "value": 29 } - }, - { - "name": "ClearExternalPluginDataV1", - "accounts": [ - { - "name": "asset", - "isMut": true, - "isSigner": false, - "docs": [ - "The address of the asset" - ] - }, - { - "name": "collection", - "isMut": true, - "isSigner": false, - "isOptional": true, - "docs": [ - "The collection to which the asset belongs" - ] - }, - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "The account paying for the storage fees" - ] - }, - { - "name": "authority", - "isMut": false, - "isSigner": true, - "isOptional": true, - "docs": [ - "The owner or delegate of the asset" - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "The system program" - ] - }, - { - "name": "logWrapper", - "isMut": false, - "isSigner": false, - "isOptional": true, - "docs": [ - "The SPL Noop Program" - ] - } - ], - "args": [ - { - "name": "clearExternalPluginDataV1Args", - "type": { - "defined": "ClearExternalPluginDataV1Args" - } - } - ], - "discriminant": { - "type": "u8", - "value": 30 - } - }, - { - "name": "ClearCollectionExternalPluginDataV1", - "accounts": [ - { - "name": "collection", - "isMut": true, - "isSigner": false, - "docs": [ - "The address of the asset" - ] - }, - { - "name": "payer", - "isMut": true, - "isSigner": true, - "docs": [ - "The account paying for the storage fees" - ] - }, - { - "name": "authority", - "isMut": false, - "isSigner": true, - "isOptional": true, - "docs": [ - "The owner or delegate of the asset" - ] - }, - { - "name": "systemProgram", - "isMut": false, - "isSigner": false, - "docs": [ - "The system program" - ] - }, - { - "name": "logWrapper", - "isMut": false, - "isSigner": false, - "isOptional": true, - "docs": [ - "The SPL Noop Program" - ] - } - ], - "args": [ - { - "name": "clearCollectionExternalPluginDataV1Args", - "type": { - "defined": "ClearCollectionExternalPluginDataV1Args" - } - } - ], - "discriminant": { - "type": "u8", - "value": 31 - } } ], "accounts": [ @@ -2264,10 +2137,6 @@ "defined": "ExternalPluginSchema" } }, - { - "name": "maxSize", - "type": "u64" - }, { "name": "dataOffset", "type": "u64" @@ -2394,10 +2263,6 @@ "defined": "ExternalPluginSchema" } }, - { - "name": "maxSize", - "type": "u64" - }, { "name": "dataOffset", "type": "u64" @@ -2468,10 +2333,6 @@ "defined": "ExternalPluginSchema" } } - }, - { - "name": "maxSize", - "type": "u64" } ] } @@ -2515,10 +2376,6 @@ "defined": "ExternalPluginSchema" } } - }, - { - "name": "maxSize", - "type": "u64" } ] } @@ -2919,34 +2776,6 @@ ] } }, - { - "name": "ClearExternalPluginDataV1Args", - "type": { - "kind": "struct", - "fields": [ - { - "name": "key", - "type": { - "defined": "ExternalPluginKey" - } - } - ] - } - }, - { - "name": "ClearCollectionExternalPluginDataV1Args", - "type": { - "kind": "struct", - "fields": [ - { - "name": "key", - "type": { - "defined": "ExternalPluginKey" - } - } - ] - } - }, { "name": "CompressV1Args", "type": { @@ -3331,10 +3160,6 @@ "defined": "ExternalPluginKey" } }, - { - "name": "offset", - "type": "u64" - }, { "name": "data", "type": "bytes" @@ -3353,10 +3178,6 @@ "defined": "ExternalPluginKey" } }, - { - "name": "offset", - "type": "u64" - }, { "name": "data", "type": "bytes" diff --git a/programs/mpl-core/src/instruction.rs b/programs/mpl-core/src/instruction.rs index 7b620823..48bb9926 100644 --- a/programs/mpl-core/src/instruction.rs +++ b/programs/mpl-core/src/instruction.rs @@ -5,13 +5,12 @@ use shank::{ShankContext, ShankInstruction}; use crate::processor::{ AddCollectionExternalPluginV1Args, AddCollectionPluginV1Args, AddExternalPluginV1Args, AddPluginV1Args, ApproveCollectionPluginAuthorityV1Args, ApprovePluginAuthorityV1Args, - BurnCollectionV1Args, BurnV1Args, ClearCollectionExternalPluginDataV1Args, - ClearExternalPluginDataV1Args, CompressV1Args, CreateCollectionV1Args, CreateCollectionV2Args, - CreateV1Args, CreateV2Args, DecompressV1Args, RemoveCollectionExternalPluginV1Args, - RemoveCollectionPluginV1Args, RemoveExternalPluginV1Args, RemovePluginV1Args, - RevokeCollectionPluginAuthorityV1Args, RevokePluginAuthorityV1Args, TransferV1Args, - UpdateCollectionExternalPluginV1Args, UpdateCollectionPluginV1Args, UpdateCollectionV1Args, - UpdateExternalPluginV1Args, UpdatePluginV1Args, UpdateV1Args, + BurnCollectionV1Args, BurnV1Args, CompressV1Args, CreateCollectionV1Args, + CreateCollectionV2Args, CreateV1Args, CreateV2Args, DecompressV1Args, + RemoveCollectionExternalPluginV1Args, RemoveCollectionPluginV1Args, RemoveExternalPluginV1Args, + RemovePluginV1Args, RevokeCollectionPluginAuthorityV1Args, RevokePluginAuthorityV1Args, + TransferV1Args, UpdateCollectionExternalPluginV1Args, UpdateCollectionPluginV1Args, + UpdateCollectionV1Args, UpdateExternalPluginV1Args, UpdatePluginV1Args, UpdateV1Args, WriteCollectionExternalPluginDataV1Args, WriteExternalPluginDataV1Args, }; @@ -280,21 +279,4 @@ pub(crate) enum MplAssetInstruction { #[account(3, name="system_program", desc = "The system program")] #[account(4, optional, name="log_wrapper", desc = "The SPL Noop Program")] WriteCollectionExternalPluginDataV1(WriteCollectionExternalPluginDataV1Args), - - /// Add an external plugin to an mpl-core. - #[account(0, writable, name="asset", desc = "The address of the asset")] - #[account(1, optional, writable, name="collection", desc = "The collection to which the asset belongs")] - #[account(2, writable, signer, name="payer", desc = "The account paying for the storage fees")] - #[account(3, optional, signer, name="authority", desc = "The owner or delegate of the asset")] - #[account(4, name="system_program", desc = "The system program")] - #[account(5, optional, name="log_wrapper", desc = "The SPL Noop Program")] - ClearExternalPluginDataV1(ClearExternalPluginDataV1Args), - - /// Add an external plugin to an mpl-core. - #[account(0, writable, name="collection", desc = "The address of the asset")] - #[account(1, writable, signer, name="payer", desc = "The account paying for the storage fees")] - #[account(2, optional, signer, name="authority", desc = "The owner or delegate of the asset")] - #[account(3, name="system_program", desc = "The system program")] - #[account(4, optional, name="log_wrapper", desc = "The SPL Noop Program")] - ClearCollectionExternalPluginDataV1(ClearCollectionExternalPluginDataV1Args), } diff --git a/programs/mpl-core/src/plugins/data_store.rs b/programs/mpl-core/src/plugins/data_store.rs index e6ff1e32..01b4edf1 100644 --- a/programs/mpl-core/src/plugins/data_store.rs +++ b/programs/mpl-core/src/plugins/data_store.rs @@ -14,8 +14,6 @@ pub struct DataStore { pub data_authority: Authority, /// Schema for the data used by the plugin. pub schema: ExternalPluginSchema, - /// The maximum size of the data store. - pub max_size: usize, /// The offset to the plugin data in the account. pub data_offset: usize, /// The length of the plugin data. @@ -32,8 +30,6 @@ pub struct DataStoreInitInfo { pub init_plugin_authority: Option, /// Schema for the data used by the plugin. pub schema: Option, - /// The maximum size of the data store. - pub max_size: usize, } /// Data store update info. @@ -41,6 +37,4 @@ pub struct DataStoreInitInfo { pub struct DataStoreUpdateInfo { /// Schema for the data used by the plugin. pub schema: Option, - /// The maximum size of the data store. - pub max_size: usize, } diff --git a/programs/mpl-core/src/plugins/lifecycle_hook.rs b/programs/mpl-core/src/plugins/lifecycle_hook.rs index 65777ac6..8e35986f 100644 --- a/programs/mpl-core/src/plugins/lifecycle_hook.rs +++ b/programs/mpl-core/src/plugins/lifecycle_hook.rs @@ -23,8 +23,6 @@ pub struct LifecycleHook { pub data_authority: Option, /// Schema for the data used by the plugin. pub schema: ExternalPluginSchema, - /// The maximum size of the lifecycle hook data. - pub max_size: usize, /// The offset to the plugin data in the account. pub data_offset: usize, /// The length of the plugin data. @@ -48,8 +46,6 @@ pub struct LifecycleHookInitInfo { pub data_authority: Option, /// Schema for the data used by the plugin. pub schema: Option, - /// The maximum size of the lifecycle hook data. - pub max_size: usize, } /// Lifecycle hook update info. @@ -61,6 +57,4 @@ pub struct LifecycleHookUpdateInfo { pub extra_accounts: Option>, /// Schema for the data used by the plugin. pub schema: Option, - /// The maximum size of the lifecycle hook data. - pub max_size: usize, } diff --git a/programs/mpl-core/src/processor/clear_external_plugin_data.rs b/programs/mpl-core/src/processor/clear_external_plugin_data.rs deleted file mode 100644 index da5cf51a..00000000 --- a/programs/mpl-core/src/processor/clear_external_plugin_data.rs +++ /dev/null @@ -1,32 +0,0 @@ -use borsh::{BorshDeserialize, BorshSerialize}; -use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult}; - -use crate::{error::MplCoreError, plugins::ExternalPluginKey}; - -#[repr(C)] -#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] -pub(crate) struct ClearExternalPluginDataV1Args { - /// External plugin key. - pub key: ExternalPluginKey, -} - -pub(crate) fn clear_external_plugin_data<'a>( - _accounts: &'a [AccountInfo<'a>], - _args: ClearExternalPluginDataV1Args, -) -> ProgramResult { - Err(MplCoreError::NotAvailable.into()) -} - -#[repr(C)] -#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Debug, Clone)] -pub(crate) struct ClearCollectionExternalPluginDataV1Args { - /// External plugin key. - pub key: ExternalPluginKey, -} - -pub(crate) fn clear_collection_external_plugin_data<'a>( - _accounts: &'a [AccountInfo<'a>], - _args: ClearCollectionExternalPluginDataV1Args, -) -> ProgramResult { - Err(MplCoreError::NotAvailable.into()) -} diff --git a/programs/mpl-core/src/processor/mod.rs b/programs/mpl-core/src/processor/mod.rs index 10947830..bae3dae3 100644 --- a/programs/mpl-core/src/processor/mod.rs +++ b/programs/mpl-core/src/processor/mod.rs @@ -2,7 +2,6 @@ mod add_external_plugin; mod add_plugin; mod approve_plugin_authority; mod burn; -mod clear_external_plugin_data; mod collect; mod compress; mod create; @@ -21,7 +20,6 @@ pub(crate) use add_external_plugin::*; pub(crate) use add_plugin::*; pub(crate) use approve_plugin_authority::*; pub(crate) use burn::*; -pub(crate) use clear_external_plugin_data::*; pub(crate) use collect::*; pub(crate) use compress::*; pub(crate) use create::*; @@ -166,13 +164,5 @@ pub fn process_instruction<'a>( msg!("Instruction: WriteCollectionExternalPluginDataV1"); write_collection_external_plugin_data(accounts, args) } - MplAssetInstruction::ClearExternalPluginDataV1(args) => { - msg!("Instruction: ClearExternalPluginDataV1"); - clear_external_plugin_data(accounts, args) - } - MplAssetInstruction::ClearCollectionExternalPluginDataV1(args) => { - msg!("Instruction: ClearCollectionExternalPluginDataV1"); - clear_collection_external_plugin_data(accounts, args) - } } } diff --git a/programs/mpl-core/src/processor/write_external_plugin_data.rs b/programs/mpl-core/src/processor/write_external_plugin_data.rs index 137597c7..081c30ca 100644 --- a/programs/mpl-core/src/processor/write_external_plugin_data.rs +++ b/programs/mpl-core/src/processor/write_external_plugin_data.rs @@ -8,8 +8,6 @@ use crate::{error::MplCoreError, plugins::ExternalPluginKey}; pub(crate) struct WriteExternalPluginDataV1Args { /// External plugin key. pub key: ExternalPluginKey, - /// The offset of the data to write. - pub offset: usize, /// The data to write. pub data: Vec, } @@ -26,8 +24,6 @@ pub(crate) fn write_external_plugin_data<'a>( pub(crate) struct WriteCollectionExternalPluginDataV1Args { /// External plugin key. pub key: ExternalPluginKey, - /// The offset of the data to write. - pub offset: usize, /// The data to write. pub data: Vec, } From 2cf63e8c3f11c9ab6f15e12bcd372d545d5321da Mon Sep 17 00:00:00 2001 From: blockiosaurus Date: Fri, 19 Apr 2024 13:56:37 -0400 Subject: [PATCH 6/6] Updating based on feedback. --- .../writeCollectionExternalPluginDataV1.ts | 2 +- .../instructions/writeExternalPluginDataV1.ts | 2 +- .../write_collection_external_plugin_data_v1.rs | 10 +++++----- .../instructions/write_external_plugin_data_v1.rs | 10 +++++----- idls/mpl_core.json | 4 ++-- programs/mpl-core/src/instruction.rs | 4 ++-- programs/mpl-core/src/plugins/lifecycle_hook.rs | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts b/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts index c3fe5128..8e2bad38 100644 --- a/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts +++ b/clients/js/src/generated/instructions/writeCollectionExternalPluginDataV1.ts @@ -39,7 +39,7 @@ export type WriteCollectionExternalPluginDataV1InstructionAccounts = { collection: PublicKey | Pda; /** The account paying for the storage fees */ payer?: Signer; - /** The owner or delegate of the asset */ + /** The Data Authority of the External Plugin */ authority?: Signer; /** The system program */ systemProgram?: PublicKey | Pda; diff --git a/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts b/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts index 27e66fa1..ba8781a1 100644 --- a/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts +++ b/clients/js/src/generated/instructions/writeExternalPluginDataV1.ts @@ -41,7 +41,7 @@ export type WriteExternalPluginDataV1InstructionAccounts = { collection?: PublicKey | Pda; /** The account paying for the storage fees */ payer?: Signer; - /** The owner or delegate of the asset */ + /** The Data Authority of the External Plugin */ authority?: Signer; /** The system program */ systemProgram?: PublicKey | Pda; diff --git a/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs index 94d87acd..5dcee063 100644 --- a/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/write_collection_external_plugin_data_v1.rs @@ -15,7 +15,7 @@ pub struct WriteCollectionExternalPluginDataV1 { pub collection: solana_program::pubkey::Pubkey, /// The account paying for the storage fees pub payer: solana_program::pubkey::Pubkey, - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin pub authority: Option, /// The system program pub system_program: solana_program::pubkey::Pubkey, @@ -140,7 +140,7 @@ impl WriteCollectionExternalPluginDataV1Builder { self } /// `[optional account]` - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin #[inline(always)] pub fn authority(&mut self, authority: Option) -> &mut Self { self.authority = authority; @@ -217,7 +217,7 @@ pub struct WriteCollectionExternalPluginDataV1CpiAccounts<'a, 'b> { pub collection: &'b solana_program::account_info::AccountInfo<'a>, /// The account paying for the storage fees pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// The system program pub system_program: &'b solana_program::account_info::AccountInfo<'a>, @@ -233,7 +233,7 @@ pub struct WriteCollectionExternalPluginDataV1Cpi<'a, 'b> { pub collection: &'b solana_program::account_info::AccountInfo<'a>, /// The account paying for the storage fees pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// The system program pub system_program: &'b solana_program::account_info::AccountInfo<'a>, @@ -412,7 +412,7 @@ impl<'a, 'b> WriteCollectionExternalPluginDataV1CpiBuilder<'a, 'b> { self } /// `[optional account]` - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin #[inline(always)] pub fn authority( &mut self, diff --git a/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs index 00d56340..541d9b25 100644 --- a/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs +++ b/clients/rust/src/generated/instructions/write_external_plugin_data_v1.rs @@ -17,7 +17,7 @@ pub struct WriteExternalPluginDataV1 { pub collection: Option, /// The account paying for the storage fees pub payer: solana_program::pubkey::Pubkey, - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin pub authority: Option, /// The system program pub system_program: solana_program::pubkey::Pubkey, @@ -160,7 +160,7 @@ impl WriteExternalPluginDataV1Builder { self } /// `[optional account]` - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin #[inline(always)] pub fn authority(&mut self, authority: Option) -> &mut Self { self.authority = authority; @@ -240,7 +240,7 @@ pub struct WriteExternalPluginDataV1CpiAccounts<'a, 'b> { pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// The account paying for the storage fees pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// The system program pub system_program: &'b solana_program::account_info::AccountInfo<'a>, @@ -258,7 +258,7 @@ pub struct WriteExternalPluginDataV1Cpi<'a, 'b> { pub collection: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// The account paying for the storage fees pub payer: &'b solana_program::account_info::AccountInfo<'a>, - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, /// The system program pub system_program: &'b solana_program::account_info::AccountInfo<'a>, @@ -461,7 +461,7 @@ impl<'a, 'b> WriteExternalPluginDataV1CpiBuilder<'a, 'b> { self } /// `[optional account]` - /// The owner or delegate of the asset + /// The Data Authority of the External Plugin #[inline(always)] pub fn authority( &mut self, diff --git a/idls/mpl_core.json b/idls/mpl_core.json index e202d22e..b5d4a870 100644 --- a/idls/mpl_core.json +++ b/idls/mpl_core.json @@ -1819,7 +1819,7 @@ "isSigner": true, "isOptional": true, "docs": [ - "The owner or delegate of the asset" + "The Data Authority of the External Plugin" ] }, { @@ -1878,7 +1878,7 @@ "isSigner": true, "isOptional": true, "docs": [ - "The owner or delegate of the asset" + "The Data Authority of the External Plugin" ] }, { diff --git a/programs/mpl-core/src/instruction.rs b/programs/mpl-core/src/instruction.rs index 48bb9926..4ab37ac1 100644 --- a/programs/mpl-core/src/instruction.rs +++ b/programs/mpl-core/src/instruction.rs @@ -267,7 +267,7 @@ pub(crate) enum MplAssetInstruction { #[account(0, writable, name="asset", desc = "The address of the asset")] #[account(1, optional, writable, name="collection", desc = "The collection to which the asset belongs")] #[account(2, writable, signer, name="payer", desc = "The account paying for the storage fees")] - #[account(3, optional, signer, name="authority", desc = "The owner or delegate of the asset")] + #[account(3, optional, signer, name="authority", desc = "The Data Authority of the External Plugin")] #[account(4, name="system_program", desc = "The system program")] #[account(5, optional, name="log_wrapper", desc = "The SPL Noop Program")] WriteExternalPluginDataV1(WriteExternalPluginDataV1Args), @@ -275,7 +275,7 @@ pub(crate) enum MplAssetInstruction { /// Add an external plugin to an mpl-core. #[account(0, writable, name="collection", desc = "The address of the asset")] #[account(1, writable, signer, name="payer", desc = "The account paying for the storage fees")] - #[account(2, optional, signer, name="authority", desc = "The owner or delegate of the asset")] + #[account(2, optional, signer, name="authority", desc = "The Data Authority of the External Plugin")] #[account(3, name="system_program", desc = "The system program")] #[account(4, optional, name="log_wrapper", desc = "The SPL Noop Program")] WriteCollectionExternalPluginDataV1(WriteCollectionExternalPluginDataV1Args), diff --git a/programs/mpl-core/src/plugins/lifecycle_hook.rs b/programs/mpl-core/src/plugins/lifecycle_hook.rs index 8e35986f..2adddba6 100644 --- a/programs/mpl-core/src/plugins/lifecycle_hook.rs +++ b/programs/mpl-core/src/plugins/lifecycle_hook.rs @@ -17,7 +17,7 @@ pub struct LifecycleHook { pub hooked_program: Pubkey, /// The extra accounts to use for the lifecycle hook. pub extra_accounts: Option>, - /// Data authority who can update the Lifecycle Hook data. This can be for the purposes. + /// The authority of who can update the Lifecycle Hook data. This can be for the purposes /// of initialization of data, or schema migration. This field cannot be changed after /// the plugin is added. pub data_authority: Option, @@ -40,7 +40,7 @@ pub struct LifecycleHookInitInfo { pub lifecycle_checks: Option>, /// The extra accounts to use for the lifecycle hook. pub extra_accounts: Option>, - /// Data authority who can update the Lifecycle Hook data. This can be for the purposes. + /// The authority of who can update the Lifecycle Hook data. This can be for the purposes /// of initialization of data, or schema migration. This field cannot be changed after /// the plugin is added. pub data_authority: Option,