Skip to content

Add BubblegumV2 plugin and UpdateCollectionInfo instruction #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 13, 2025
2 changes: 1 addition & 1 deletion .github/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ RUST_VERSION=1.75.0
SOLANA_VERSION=1.17.25
COMMIT_USER_NAME=github-actions
[email protected]
DEPLOY_SOLANA_VERSION=1.18.14
DEPLOY_SOLANA_VERSION=1.18.19
17 changes: 16 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clients/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metaplex-foundation/mpl-core",
"version": "1.2.0",
"version": "1.4.0",
"description": "Digital Assets",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
13 changes: 13 additions & 0 deletions clients/js/src/generated/errors/mplCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,19 @@ export class InvalidExecutePdaError extends ProgramError {
codeToErrorMap.set(0x31, InvalidExecutePdaError);
nameToErrorMap.set('InvalidExecutePda', InvalidExecutePdaError);

/** BlockedByBubblegumV2: Bubblegum V2 Plugin limits other plugins */
export class BlockedByBubblegumV2Error extends ProgramError {
override readonly name: string = 'BlockedByBubblegumV2';

readonly code: number = 0x32; // 50

constructor(program: Program, cause?: Error) {
super('Bubblegum V2 Plugin limits other plugins', program, cause);
}
}
codeToErrorMap.set(0x32, BlockedByBubblegumV2Error);
nameToErrorMap.set('BlockedByBubblegumV2', BlockedByBubblegumV2Error);

/**
* Attempts to resolve a custom program error from the provided error code.
* @category Errors
Expand Down
1 change: 1 addition & 0 deletions clients/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export * from './revokeCollectionPluginAuthorityV1';
export * from './revokePluginAuthorityV1';
export * from './transferV1';
export * from './updateCollectionExternalPluginAdapterV1';
export * from './updateCollectionInfoV1';
export * from './updateCollectionPluginV1';
export * from './updateCollectionV1';
export * from './updateExternalPluginAdapterV1';
Expand Down
131 changes: 131 additions & 0 deletions clients/js/src/generated/instructions/updateCollectionInfoV1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/**
* 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,
u32,
u8,
} from '@metaplex-foundation/umi/serializers';
import {
ResolvedAccount,
ResolvedAccountsWithIndices,
getAccountMetasAndSigners,
} from '../shared';
import { UpdateType, UpdateTypeArgs, getUpdateTypeSerializer } from '../types';

// Accounts.
export type UpdateCollectionInfoV1InstructionAccounts = {
/** The address of the asset */
collection: PublicKey | Pda;
/** Bubblegum PDA signer */
bubblegumSigner: Signer;
};

// Data.
export type UpdateCollectionInfoV1InstructionData = {
discriminator: number;
updateType: UpdateType;
amount: number;
};

export type UpdateCollectionInfoV1InstructionDataArgs = {
updateType: UpdateTypeArgs;
amount: number;
};

export function getUpdateCollectionInfoV1InstructionDataSerializer(): Serializer<
UpdateCollectionInfoV1InstructionDataArgs,
UpdateCollectionInfoV1InstructionData
> {
return mapSerializer<
UpdateCollectionInfoV1InstructionDataArgs,
any,
UpdateCollectionInfoV1InstructionData
>(
struct<UpdateCollectionInfoV1InstructionData>(
[
['discriminator', u8()],
['updateType', getUpdateTypeSerializer()],
['amount', u32()],
],
{ description: 'UpdateCollectionInfoV1InstructionData' }
),
(value) => ({ ...value, discriminator: 32 })
) as Serializer<
UpdateCollectionInfoV1InstructionDataArgs,
UpdateCollectionInfoV1InstructionData
>;
}

// Args.
export type UpdateCollectionInfoV1InstructionArgs =
UpdateCollectionInfoV1InstructionDataArgs;

// Instruction.
export function updateCollectionInfoV1(
context: Pick<Context, 'programs'>,
input: UpdateCollectionInfoV1InstructionAccounts &
UpdateCollectionInfoV1InstructionArgs
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCore',
'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d'
);

// Accounts.
const resolvedAccounts = {
collection: {
index: 0,
isWritable: true as boolean,
value: input.collection ?? null,
},
bubblegumSigner: {
index: 1,
isWritable: false as boolean,
value: input.bubblegumSigner ?? null,
},
} satisfies ResolvedAccountsWithIndices;

// Arguments.
const resolvedArgs: UpdateCollectionInfoV1InstructionArgs = { ...input };

// 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 = getUpdateCollectionInfoV1InstructionDataSerializer().serialize(
resolvedArgs as UpdateCollectionInfoV1InstructionDataArgs
);

// Bytes Created On Chain.
const bytesCreatedOnChain = 0;

return transactionBuilder([
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
]);
}
23 changes: 23 additions & 0 deletions clients/js/src/generated/types/bubblegumV2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
*
* @see https://github.com/metaplex-foundation/kinobi
*/

import { Serializer, struct } from '@metaplex-foundation/umi/serializers';

export type BubblegumV2 = {};

export type BubblegumV2Args = BubblegumV2;

export function getBubblegumV2Serializer(): Serializer<
BubblegumV2Args,
BubblegumV2
> {
return struct<BubblegumV2>([], { description: 'BubblegumV2' }) as Serializer<
BubblegumV2Args,
BubblegumV2
>;
}
2 changes: 2 additions & 0 deletions clients/js/src/generated/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export * from './baseRuleSet';
export * from './baseSeed';
export * from './baseUpdateAuthority';
export * from './baseValidationResultsOffset';
export * from './bubblegumV2';
export * from './burnDelegate';
export * from './compressionProof';
export * from './creator';
Expand Down Expand Up @@ -68,6 +69,7 @@ export * from './pluginType';
export * from './registryRecord';
export * from './transferDelegate';
export * from './updateDelegate';
export * from './updateType';
export * from './validationResult';
export * from './verifiedCreators';
export * from './verifiedCreatorsSignature';
19 changes: 17 additions & 2 deletions clients/js/src/generated/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
BaseMasterEditionArgs,
BaseRoyalties,
BaseRoyaltiesArgs,
BubblegumV2,
BubblegumV2Args,
BurnDelegate,
BurnDelegateArgs,
Edition,
Expand All @@ -50,6 +52,7 @@ import {
getAutographSerializer,
getBaseMasterEditionSerializer,
getBaseRoyaltiesSerializer,
getBubblegumV2Serializer,
getBurnDelegateSerializer,
getEditionSerializer,
getFreezeDelegateSerializer,
Expand Down Expand Up @@ -77,7 +80,8 @@ export type Plugin =
| { __kind: 'AddBlocker'; fields: [AddBlocker] }
| { __kind: 'ImmutableMetadata'; fields: [ImmutableMetadata] }
| { __kind: 'VerifiedCreators'; fields: [VerifiedCreators] }
| { __kind: 'Autograph'; fields: [Autograph] };
| { __kind: 'Autograph'; fields: [Autograph] }
| { __kind: 'BubblegumV2'; fields: [BubblegumV2] };

export type PluginArgs =
| { __kind: 'Royalties'; fields: [BaseRoyaltiesArgs] }
Expand All @@ -97,7 +101,8 @@ export type PluginArgs =
| { __kind: 'AddBlocker'; fields: [AddBlockerArgs] }
| { __kind: 'ImmutableMetadata'; fields: [ImmutableMetadataArgs] }
| { __kind: 'VerifiedCreators'; fields: [VerifiedCreatorsArgs] }
| { __kind: 'Autograph'; fields: [AutographArgs] };
| { __kind: 'Autograph'; fields: [AutographArgs] }
| { __kind: 'BubblegumV2'; fields: [BubblegumV2Args] };

export function getPluginSerializer(): Serializer<PluginArgs, Plugin> {
return dataEnum<Plugin>(
Expand Down Expand Up @@ -192,6 +197,12 @@ export function getPluginSerializer(): Serializer<PluginArgs, Plugin> {
['fields', tuple([getAutographSerializer()])],
]),
],
[
'BubblegumV2',
struct<GetDataEnumKindContent<Plugin, 'BubblegumV2'>>([
['fields', tuple([getBubblegumV2Serializer()])],
]),
],
],
{ description: 'Plugin' }
) as Serializer<PluginArgs, Plugin>;
Expand Down Expand Up @@ -261,6 +272,10 @@ export function plugin(
kind: 'Autograph',
data: GetDataEnumKindContent<PluginArgs, 'Autograph'>['fields']
): GetDataEnumKind<PluginArgs, 'Autograph'>;
export function plugin(
kind: 'BubblegumV2',
data: GetDataEnumKindContent<PluginArgs, 'BubblegumV2'>['fields']
): GetDataEnumKind<PluginArgs, 'BubblegumV2'>;
export function plugin<K extends PluginArgs['__kind']>(
kind: K,
data?: any
Expand Down
1 change: 1 addition & 0 deletions clients/js/src/generated/types/pluginType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export enum PluginType {
ImmutableMetadata,
VerifiedCreators,
Autograph,
BubblegumV2,
}

export type PluginTypeArgs = PluginType;
Expand Down
26 changes: 26 additions & 0 deletions clients/js/src/generated/types/updateType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
*
* @see https://github.com/metaplex-foundation/kinobi
*/

import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers';

export enum UpdateType {
Mint,
Add,
Remove,
}

export type UpdateTypeArgs = UpdateType;

export function getUpdateTypeSerializer(): Serializer<
UpdateTypeArgs,
UpdateType
> {
return scalarEnum<UpdateType>(UpdateType, {
description: 'UpdateType',
}) as Serializer<UpdateTypeArgs, UpdateType>;
}
11 changes: 10 additions & 1 deletion clients/js/src/plugins/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
VerifiedCreatorsArgs,
Autograph,
VerifiedCreators,
BubblegumV2,
} from '../generated';
import { RoyaltiesArgs, RoyaltiesPlugin } from './royalties';
import { PluginAuthority } from './pluginAuthority';
Expand Down Expand Up @@ -88,6 +89,9 @@ export type CreatePluginArgs =
}
| {
type: 'AddBlocker';
}
| {
type: 'BubblegumV2';
};

export type AuthorityArgsV2 = {
Expand All @@ -106,7 +110,10 @@ export type CreateOnlyPluginArgsV2 =
}
| ({
type: 'Edition';
} & EditionArgs);
} & EditionArgs)
| {
type: 'BubblegumV2';
};

export type OwnerManagedPluginArgsV2 =
| ({
Expand Down Expand Up @@ -181,6 +188,7 @@ export type AddBlockerPlugin = BasePlugin & AddBlocker;
export type ImmutableMetadataPlugin = BasePlugin & ImmutableMetadata;
export type VerifiedCreatorsPlugin = BasePlugin & VerifiedCreators;
export type AutographPlugin = BasePlugin & Autograph;
export type BubblegumV2Plugin = BasePlugin & BubblegumV2;

export type CommonPluginsList = {
attributes?: AttributesPlugin;
Expand All @@ -204,6 +212,7 @@ export type AssetPluginsList = {

export type CollectionPluginsList = {
masterEdition?: MasterEditionPlugin;
bubblegumV2?: BubblegumV2Plugin;
} & CommonPluginsList;

export type PluginsList = AssetPluginsList & CollectionPluginsList;
Loading
Loading