diff --git a/clients/js/src/generated/errors/mplBubblegum.ts b/clients/js/src/generated/errors/mplBubblegum.ts index 87e50c90..d7d32990 100644 --- a/clients/js/src/generated/errors/mplBubblegum.ts +++ b/clients/js/src/generated/errors/mplBubblegum.ts @@ -604,6 +604,154 @@ export class InvalidCanopySizeError extends ProgramError { codeToErrorMap.set(0x1799, InvalidCanopySizeError); nameToErrorMap.set('InvalidCanopySize', InvalidCanopySizeError); +/** NotEnoughStakeForOperation: Not enough tokens staked to call this instruction */ +export class NotEnoughStakeForOperationError extends ProgramError { + readonly name: string = 'NotEnoughStakeForOperation'; + + readonly code: number = 0x179a; // 6042 + + constructor(program: Program, cause?: Error) { + super('Not enough tokens staked to call this instruction', program, cause); + } +} +codeToErrorMap.set(0x179a, NotEnoughStakeForOperationError); +nameToErrorMap.set( + 'NotEnoughStakeForOperation', + NotEnoughStakeForOperationError +); + +/** StakingRegistrarMismatch: Staking registrar mismatch */ +export class StakingRegistrarMismatchError extends ProgramError { + readonly name: string = 'StakingRegistrarMismatch'; + + readonly code: number = 0x179b; // 6043 + + constructor(program: Program, cause?: Error) { + super('Staking registrar mismatch', program, cause); + } +} +codeToErrorMap.set(0x179b, StakingRegistrarMismatchError); +nameToErrorMap.set('StakingRegistrarMismatch', StakingRegistrarMismatchError); + +/** StakingVoterMismatch: Staking voter mismatch */ +export class StakingVoterMismatchError extends ProgramError { + readonly name: string = 'StakingVoterMismatch'; + + readonly code: number = 0x179c; // 6044 + + constructor(program: Program, cause?: Error) { + super('Staking voter mismatch', program, cause); + } +} +codeToErrorMap.set(0x179c, StakingVoterMismatchError); +nameToErrorMap.set('StakingVoterMismatch', StakingVoterMismatchError); + +/** FeeReceiverMismatch: Fee receiver mismatch */ +export class FeeReceiverMismatchError extends ProgramError { + readonly name: string = 'FeeReceiverMismatch'; + + readonly code: number = 0x179d; // 6045 + + constructor(program: Program, cause?: Error) { + super('Fee receiver mismatch', program, cause); + } +} +codeToErrorMap.set(0x179d, FeeReceiverMismatchError); +nameToErrorMap.set('FeeReceiverMismatch', FeeReceiverMismatchError); + +/** StakingRegistrarRealmMismatch: Staking registrar realm mismatch */ +export class StakingRegistrarRealmMismatchError extends ProgramError { + readonly name: string = 'StakingRegistrarRealmMismatch'; + + readonly code: number = 0x179e; // 6046 + + constructor(program: Program, cause?: Error) { + super('Staking registrar realm mismatch', program, cause); + } +} +codeToErrorMap.set(0x179e, StakingRegistrarRealmMismatchError); +nameToErrorMap.set( + 'StakingRegistrarRealmMismatch', + StakingRegistrarRealmMismatchError +); + +/** StakingRegistrarDiscriminatorMismatch: Staking registrar discriminator mismatch */ +export class StakingRegistrarDiscriminatorMismatchError extends ProgramError { + readonly name: string = 'StakingRegistrarDiscriminatorMismatch'; + + readonly code: number = 0x179f; // 6047 + + constructor(program: Program, cause?: Error) { + super('Staking registrar discriminator mismatch', program, cause); + } +} +codeToErrorMap.set(0x179f, StakingRegistrarDiscriminatorMismatchError); +nameToErrorMap.set( + 'StakingRegistrarDiscriminatorMismatch', + StakingRegistrarDiscriminatorMismatchError +); + +/** StakingVoterDiscriminatorMismatch: Staking voter discriminator mismatch */ +export class StakingVoterDiscriminatorMismatchError extends ProgramError { + readonly name: string = 'StakingVoterDiscriminatorMismatch'; + + readonly code: number = 0x17a0; // 6048 + + constructor(program: Program, cause?: Error) { + super('Staking voter discriminator mismatch', program, cause); + } +} +codeToErrorMap.set(0x17a0, StakingVoterDiscriminatorMismatchError); +nameToErrorMap.set( + 'StakingVoterDiscriminatorMismatch', + StakingVoterDiscriminatorMismatchError +); + +/** StakingVoterRegistrarMismatch: Staking voter registrar mismatch */ +export class StakingVoterRegistrarMismatchError extends ProgramError { + readonly name: string = 'StakingVoterRegistrarMismatch'; + + readonly code: number = 0x17a1; // 6049 + + constructor(program: Program, cause?: Error) { + super('Staking voter registrar mismatch', program, cause); + } +} +codeToErrorMap.set(0x17a1, StakingVoterRegistrarMismatchError); +nameToErrorMap.set( + 'StakingVoterRegistrarMismatch', + StakingVoterRegistrarMismatchError +); + +/** StakingVoterAuthorityMismatch: Staking voter authority mismatch */ +export class StakingVoterAuthorityMismatchError extends ProgramError { + readonly name: string = 'StakingVoterAuthorityMismatch'; + + readonly code: number = 0x17a2; // 6050 + + constructor(program: Program, cause?: Error) { + super('Staking voter authority mismatch', program, cause); + } +} +codeToErrorMap.set(0x17a2, StakingVoterAuthorityMismatchError); +nameToErrorMap.set( + 'StakingVoterAuthorityMismatch', + StakingVoterAuthorityMismatchError +); + +/** MiningOwnerMismatch: Invalid mining owner */ +export class MiningOwnerMismatchError extends ProgramError { + readonly name: string = 'MiningOwnerMismatch'; + + readonly code: number = 0x17a3; // 6051 + + constructor(program: Program, cause?: Error) { + super('Invalid mining owner', program, cause); + } +} +codeToErrorMap.set(0x17a3, MiningOwnerMismatchError); +nameToErrorMap.set('MiningOwnerMismatch', MiningOwnerMismatchError); + /** * Attempts to resolve a custom program error from the provided error code. * @category Errors diff --git a/clients/js/src/generated/errors/splAccountCompression.ts b/clients/js/src/generated/errors/splAccountCompression.ts index 08409465..88e1ecfd 100644 --- a/clients/js/src/generated/errors/splAccountCompression.ts +++ b/clients/js/src/generated/errors/splAccountCompression.ts @@ -155,6 +155,86 @@ export class LeafIndexOutOfBoundsError extends ProgramError { codeToErrorMap.set(0x1778, LeafIndexOutOfBoundsError); nameToErrorMap.set('LeafIndexOutOfBounds', LeafIndexOutOfBoundsError); +/** CanopyNotAllocated: Tree was initialized without allocating space for the canopy */ +export class CanopyNotAllocatedError extends ProgramError { + readonly name: string = 'CanopyNotAllocated'; + + readonly code: number = 0x1779; // 6009 + + constructor(program: Program, cause?: Error) { + super( + 'Tree was initialized without allocating space for the canopy', + program, + cause + ); + } +} +codeToErrorMap.set(0x1779, CanopyNotAllocatedError); +nameToErrorMap.set('CanopyNotAllocated', CanopyNotAllocatedError); + +/** TreeAlreadyInitialized: Tree was already initialized */ +export class TreeAlreadyInitializedError extends ProgramError { + readonly name: string = 'TreeAlreadyInitialized'; + + readonly code: number = 0x177a; // 6010 + + constructor(program: Program, cause?: Error) { + super('Tree was already initialized', program, cause); + } +} +codeToErrorMap.set(0x177a, TreeAlreadyInitializedError); +nameToErrorMap.set('TreeAlreadyInitialized', TreeAlreadyInitializedError); + +/** BatchNotInitialized: Tree header was not initialized for batch processing */ +export class BatchNotInitializedError extends ProgramError { + readonly name: string = 'BatchNotInitialized'; + + readonly code: number = 0x177b; // 6011 + + constructor(program: Program, cause?: Error) { + super( + 'Tree header was not initialized for batch processing', + program, + cause + ); + } +} +codeToErrorMap.set(0x177b, BatchNotInitializedError); +nameToErrorMap.set('BatchNotInitialized', BatchNotInitializedError); + +/** CanopyRootMismatch: Canopy root does not match the root of the tree */ +export class CanopyRootMismatchError extends ProgramError { + readonly name: string = 'CanopyRootMismatch'; + + readonly code: number = 0x177c; // 6012 + + constructor(program: Program, cause?: Error) { + super('Canopy root does not match the root of the tree', program, cause); + } +} +codeToErrorMap.set(0x177c, CanopyRootMismatchError); +nameToErrorMap.set('CanopyRootMismatch', CanopyRootMismatchError); + +/** CanopyRightmostLeafMismatch: Canopy contains nodes to the right of the rightmost leaf of the tree */ +export class CanopyRightmostLeafMismatchError extends ProgramError { + readonly name: string = 'CanopyRightmostLeafMismatch'; + + readonly code: number = 0x177d; // 6013 + + constructor(program: Program, cause?: Error) { + super( + 'Canopy contains nodes to the right of the rightmost leaf of the tree', + program, + cause + ); + } +} +codeToErrorMap.set(0x177d, CanopyRightmostLeafMismatchError); +nameToErrorMap.set( + 'CanopyRightmostLeafMismatch', + CanopyRightmostLeafMismatchError +); + /** * Attempts to resolve a custom program error from the provided error code. * @category Errors diff --git a/clients/js/src/generated/instructions/addCanopy.ts b/clients/js/src/generated/instructions/addCanopy.ts new file mode 100644 index 00000000..ac90d93b --- /dev/null +++ b/clients/js/src/generated/instructions/addCanopy.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, + array, + bytes, + mapSerializer, + struct, + u32, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { findTreeConfigPda } from '../accounts'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + expectPublicKey, + getAccountMetasAndSigners, +} from '../shared'; + +// Accounts. +export type AddCanopyInstructionAccounts = { + treeConfig?: PublicKey | Pda; + merkleTree: PublicKey | Pda; + treeCreatorOrDelegate?: Signer; + logWrapper?: PublicKey | Pda; + compressionProgram?: PublicKey | Pda; + systemProgram?: PublicKey | Pda; +}; + +// Data. +export type AddCanopyInstructionData = { + discriminator: Array; + startIndex: number; + canopyNodes: Array; +}; + +export type AddCanopyInstructionDataArgs = { + startIndex: number; + canopyNodes: Array; +}; + +export function getAddCanopyInstructionDataSerializer(): Serializer< + AddCanopyInstructionDataArgs, + AddCanopyInstructionData +> { + return mapSerializer< + AddCanopyInstructionDataArgs, + any, + AddCanopyInstructionData + >( + struct( + [ + ['discriminator', array(u8(), { size: 8 })], + ['startIndex', u32()], + ['canopyNodes', array(bytes({ size: 32 }))], + ], + { description: 'AddCanopyInstructionData' } + ), + (value) => ({ + ...value, + discriminator: [247, 118, 145, 92, 84, 66, 207, 25], + }) + ) as Serializer; +} + +// Args. +export type AddCanopyInstructionArgs = AddCanopyInstructionDataArgs; + +// Instruction. +export function addCanopy( + context: Pick, + input: AddCanopyInstructionAccounts & AddCanopyInstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplBubblegum', + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' + ); + + // Accounts. + const resolvedAccounts: ResolvedAccountsWithIndices = { + treeConfig: { + index: 0, + isWritable: false, + value: input.treeConfig ?? null, + }, + merkleTree: { index: 1, isWritable: true, value: input.merkleTree ?? null }, + treeCreatorOrDelegate: { + index: 2, + isWritable: false, + value: input.treeCreatorOrDelegate ?? null, + }, + logWrapper: { + index: 3, + isWritable: false, + value: input.logWrapper ?? null, + }, + compressionProgram: { + index: 4, + isWritable: false, + value: input.compressionProgram ?? null, + }, + systemProgram: { + index: 5, + isWritable: false, + value: input.systemProgram ?? null, + }, + }; + + // Arguments. + const resolvedArgs: AddCanopyInstructionArgs = { ...input }; + + // Default values. + if (!resolvedAccounts.treeConfig.value) { + resolvedAccounts.treeConfig.value = findTreeConfigPda(context, { + merkleTree: expectPublicKey(resolvedAccounts.merkleTree.value), + }); + } + if (!resolvedAccounts.treeCreatorOrDelegate.value) { + resolvedAccounts.treeCreatorOrDelegate.value = context.identity; + } + if (!resolvedAccounts.logWrapper.value) { + resolvedAccounts.logWrapper.value = context.programs.getPublicKey( + 'splNoop', + 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV' + ); + resolvedAccounts.logWrapper.isWritable = false; + } + if (!resolvedAccounts.compressionProgram.value) { + resolvedAccounts.compressionProgram.value = context.programs.getPublicKey( + 'splAccountCompression', + 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK' + ); + resolvedAccounts.compressionProgram.isWritable = false; + } + 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 = getAddCanopyInstructionDataSerializer().serialize( + resolvedArgs as AddCanopyInstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/appendCanopyNodes.ts b/clients/js/src/generated/instructions/appendCanopyNodes.ts new file mode 100644 index 00000000..7ae0e274 --- /dev/null +++ b/clients/js/src/generated/instructions/appendCanopyNodes.ts @@ -0,0 +1,137 @@ +/** + * 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, + array, + bytes, + mapSerializer, + struct, + u32, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + getAccountMetasAndSigners, +} from '../shared'; + +// Accounts. +export type AppendCanopyNodesInstructionAccounts = { + merkleTree: PublicKey | Pda; + /** + * Authority that controls write-access to the tree + * Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + */ + + authority?: Signer; + /** Program used to emit changelogs as cpi instruction data. */ + noop: PublicKey | Pda; +}; + +// Data. +export type AppendCanopyNodesInstructionData = { + discriminator: Array; + startIndex: number; + canopyNodes: Array; +}; + +export type AppendCanopyNodesInstructionDataArgs = { + startIndex: number; + canopyNodes: Array; +}; + +export function getAppendCanopyNodesInstructionDataSerializer(): Serializer< + AppendCanopyNodesInstructionDataArgs, + AppendCanopyNodesInstructionData +> { + return mapSerializer< + AppendCanopyNodesInstructionDataArgs, + any, + AppendCanopyNodesInstructionData + >( + struct( + [ + ['discriminator', array(u8(), { size: 8 })], + ['startIndex', u32()], + ['canopyNodes', array(bytes({ size: 32 }))], + ], + { description: 'AppendCanopyNodesInstructionData' } + ), + (value) => ({ + ...value, + discriminator: [139, 155, 238, 167, 11, 243, 132, 205], + }) + ) as Serializer< + AppendCanopyNodesInstructionDataArgs, + AppendCanopyNodesInstructionData + >; +} + +// Args. +export type AppendCanopyNodesInstructionArgs = + AppendCanopyNodesInstructionDataArgs; + +// Instruction. +export function appendCanopyNodes( + context: Pick, + input: AppendCanopyNodesInstructionAccounts & AppendCanopyNodesInstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'splAccountCompression', + 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK' + ); + + // Accounts. + const resolvedAccounts: ResolvedAccountsWithIndices = { + merkleTree: { index: 0, isWritable: true, value: input.merkleTree ?? null }, + authority: { index: 1, isWritable: false, value: input.authority ?? null }, + noop: { index: 2, isWritable: false, value: input.noop ?? null }, + }; + + // Arguments. + const resolvedArgs: AppendCanopyNodesInstructionArgs = { ...input }; + + // Default values. + if (!resolvedAccounts.authority.value) { + resolvedAccounts.authority.value = context.identity; + } + + // 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 = getAppendCanopyNodesInstructionDataSerializer().serialize( + resolvedArgs as AppendCanopyNodesInstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/finalizeTreeWithRoot.ts b/clients/js/src/generated/instructions/finalizeTreeWithRoot.ts new file mode 100644 index 00000000..81544aa1 --- /dev/null +++ b/clients/js/src/generated/instructions/finalizeTreeWithRoot.ts @@ -0,0 +1,211 @@ +/** + * 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, + array, + bytes, + mapSerializer, + string, + struct, + u32, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { findTreeConfigPda } from '../accounts'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + expectPublicKey, + getAccountMetasAndSigners, +} from '../shared'; + +// Accounts. +export type FinalizeTreeWithRootInstructionAccounts = { + treeConfig?: PublicKey | Pda; + merkleTree: PublicKey | Pda; + payer?: Signer; + treeCreatorOrDelegate?: Signer; + staker: Signer; + registrar: PublicKey | Pda; + voter: PublicKey | Pda; + mining: PublicKey | Pda; + feeReceiver: PublicKey | Pda; + logWrapper?: PublicKey | Pda; + compressionProgram?: PublicKey | Pda; + systemProgram?: PublicKey | Pda; +}; + +// Data. +export type FinalizeTreeWithRootInstructionData = { + discriminator: Array; + root: Uint8Array; + rightmostLeaf: Uint8Array; + rightmostIndex: number; + metadataUrl: string; + metadataHash: string; +}; + +export type FinalizeTreeWithRootInstructionDataArgs = { + root: Uint8Array; + rightmostLeaf: Uint8Array; + rightmostIndex: number; + metadataUrl: string; + metadataHash: string; +}; + +export function getFinalizeTreeWithRootInstructionDataSerializer(): Serializer< + FinalizeTreeWithRootInstructionDataArgs, + FinalizeTreeWithRootInstructionData +> { + return mapSerializer< + FinalizeTreeWithRootInstructionDataArgs, + any, + FinalizeTreeWithRootInstructionData + >( + struct( + [ + ['discriminator', array(u8(), { size: 8 })], + ['root', bytes({ size: 32 })], + ['rightmostLeaf', bytes({ size: 32 })], + ['rightmostIndex', u32()], + ['metadataUrl', string()], + ['metadataHash', string()], + ], + { description: 'FinalizeTreeWithRootInstructionData' } + ), + (value) => ({ + ...value, + discriminator: [77, 73, 220, 153, 126, 225, 64, 204], + }) + ) as Serializer< + FinalizeTreeWithRootInstructionDataArgs, + FinalizeTreeWithRootInstructionData + >; +} + +// Args. +export type FinalizeTreeWithRootInstructionArgs = + FinalizeTreeWithRootInstructionDataArgs; + +// Instruction. +export function finalizeTreeWithRoot( + context: Pick, + input: FinalizeTreeWithRootInstructionAccounts & + FinalizeTreeWithRootInstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplBubblegum', + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' + ); + + // Accounts. + const resolvedAccounts: ResolvedAccountsWithIndices = { + treeConfig: { index: 0, isWritable: true, value: input.treeConfig ?? null }, + merkleTree: { index: 1, isWritable: true, value: input.merkleTree ?? null }, + payer: { index: 2, isWritable: true, value: input.payer ?? null }, + treeCreatorOrDelegate: { + index: 3, + isWritable: false, + value: input.treeCreatorOrDelegate ?? null, + }, + staker: { index: 4, isWritable: false, value: input.staker ?? null }, + registrar: { index: 5, isWritable: false, value: input.registrar ?? null }, + voter: { index: 6, isWritable: false, value: input.voter ?? null }, + mining: { index: 7, isWritable: false, value: input.mining ?? null }, + feeReceiver: { + index: 8, + isWritable: true, + value: input.feeReceiver ?? null, + }, + logWrapper: { + index: 9, + isWritable: false, + value: input.logWrapper ?? null, + }, + compressionProgram: { + index: 10, + isWritable: false, + value: input.compressionProgram ?? null, + }, + systemProgram: { + index: 11, + isWritable: false, + value: input.systemProgram ?? null, + }, + }; + + // Arguments. + const resolvedArgs: FinalizeTreeWithRootInstructionArgs = { ...input }; + + // Default values. + if (!resolvedAccounts.treeConfig.value) { + resolvedAccounts.treeConfig.value = findTreeConfigPda(context, { + merkleTree: expectPublicKey(resolvedAccounts.merkleTree.value), + }); + } + if (!resolvedAccounts.payer.value) { + resolvedAccounts.payer.value = context.payer; + } + if (!resolvedAccounts.treeCreatorOrDelegate.value) { + resolvedAccounts.treeCreatorOrDelegate.value = context.identity; + } + if (!resolvedAccounts.logWrapper.value) { + resolvedAccounts.logWrapper.value = context.programs.getPublicKey( + 'splNoop', + 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV' + ); + resolvedAccounts.logWrapper.isWritable = false; + } + if (!resolvedAccounts.compressionProgram.value) { + resolvedAccounts.compressionProgram.value = context.programs.getPublicKey( + 'splAccountCompression', + 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK' + ); + resolvedAccounts.compressionProgram.isWritable = false; + } + 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 = getFinalizeTreeWithRootInstructionDataSerializer().serialize( + resolvedArgs as FinalizeTreeWithRootInstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/finalizeTreeWithRootAndCollection.ts b/clients/js/src/generated/instructions/finalizeTreeWithRootAndCollection.ts new file mode 100644 index 00000000..cbc983c6 --- /dev/null +++ b/clients/js/src/generated/instructions/finalizeTreeWithRootAndCollection.ts @@ -0,0 +1,266 @@ +/** + * 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 { + findMasterEditionPda, + findMetadataPda, +} from '@metaplex-foundation/mpl-token-metadata'; +import { + Context, + Pda, + PublicKey, + Signer, + TransactionBuilder, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + array, + bytes, + mapSerializer, + string, + struct, + u32, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { findTreeConfigPda } from '../accounts'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + expectPublicKey, + getAccountMetasAndSigners, +} from '../shared'; + +// Accounts. +export type FinalizeTreeWithRootAndCollectionInstructionAccounts = { + treeConfig?: PublicKey | Pda; + merkleTree: PublicKey | Pda; + payer?: Signer; + treeCreatorOrDelegate?: Signer; + staker: Signer; + collectionAuthority?: Signer; + registrar: PublicKey | Pda; + voter: PublicKey | Pda; + mining: PublicKey | Pda; + feeReceiver: PublicKey | Pda; + /** + * If there is no collecton authority record PDA then + * this must be the Bubblegum program address. + */ + + collectionAuthorityRecordPda?: PublicKey | Pda; + collectionMint: PublicKey | Pda; + collectionMetadata?: PublicKey | Pda; + collectionEdition?: PublicKey | Pda; + logWrapper?: PublicKey | Pda; + compressionProgram?: PublicKey | Pda; + systemProgram?: PublicKey | Pda; +}; + +// Data. +export type FinalizeTreeWithRootAndCollectionInstructionData = { + discriminator: Array; + root: Uint8Array; + rightmostLeaf: Uint8Array; + rightmostIndex: number; + metadataUrl: string; + metadataHash: string; +}; + +export type FinalizeTreeWithRootAndCollectionInstructionDataArgs = { + root: Uint8Array; + rightmostLeaf: Uint8Array; + rightmostIndex: number; + metadataUrl: string; + metadataHash: string; +}; + +export function getFinalizeTreeWithRootAndCollectionInstructionDataSerializer(): Serializer< + FinalizeTreeWithRootAndCollectionInstructionDataArgs, + FinalizeTreeWithRootAndCollectionInstructionData +> { + return mapSerializer< + FinalizeTreeWithRootAndCollectionInstructionDataArgs, + any, + FinalizeTreeWithRootAndCollectionInstructionData + >( + struct( + [ + ['discriminator', array(u8(), { size: 8 })], + ['root', bytes({ size: 32 })], + ['rightmostLeaf', bytes({ size: 32 })], + ['rightmostIndex', u32()], + ['metadataUrl', string()], + ['metadataHash', string()], + ], + { description: 'FinalizeTreeWithRootAndCollectionInstructionData' } + ), + (value) => ({ + ...value, + discriminator: [194, 98, 45, 168, 183, 72, 67, 155], + }) + ) as Serializer< + FinalizeTreeWithRootAndCollectionInstructionDataArgs, + FinalizeTreeWithRootAndCollectionInstructionData + >; +} + +// Args. +export type FinalizeTreeWithRootAndCollectionInstructionArgs = + FinalizeTreeWithRootAndCollectionInstructionDataArgs; + +// Instruction. +export function finalizeTreeWithRootAndCollection( + context: Pick, + input: FinalizeTreeWithRootAndCollectionInstructionAccounts & + FinalizeTreeWithRootAndCollectionInstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplBubblegum', + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' + ); + + // Accounts. + const resolvedAccounts: ResolvedAccountsWithIndices = { + treeConfig: { index: 0, isWritable: true, value: input.treeConfig ?? null }, + merkleTree: { index: 1, isWritable: true, value: input.merkleTree ?? null }, + payer: { index: 2, isWritable: true, value: input.payer ?? null }, + treeCreatorOrDelegate: { + index: 3, + isWritable: false, + value: input.treeCreatorOrDelegate ?? null, + }, + staker: { index: 4, isWritable: false, value: input.staker ?? null }, + collectionAuthority: { + index: 5, + isWritable: false, + value: input.collectionAuthority ?? null, + }, + registrar: { index: 6, isWritable: false, value: input.registrar ?? null }, + voter: { index: 7, isWritable: false, value: input.voter ?? null }, + mining: { index: 8, isWritable: false, value: input.mining ?? null }, + feeReceiver: { + index: 9, + isWritable: true, + value: input.feeReceiver ?? null, + }, + collectionAuthorityRecordPda: { + index: 10, + isWritable: false, + value: input.collectionAuthorityRecordPda ?? null, + }, + collectionMint: { + index: 11, + isWritable: false, + value: input.collectionMint ?? null, + }, + collectionMetadata: { + index: 12, + isWritable: true, + value: input.collectionMetadata ?? null, + }, + collectionEdition: { + index: 13, + isWritable: false, + value: input.collectionEdition ?? null, + }, + logWrapper: { + index: 14, + isWritable: false, + value: input.logWrapper ?? null, + }, + compressionProgram: { + index: 15, + isWritable: false, + value: input.compressionProgram ?? null, + }, + systemProgram: { + index: 16, + isWritable: false, + value: input.systemProgram ?? null, + }, + }; + + // Arguments. + const resolvedArgs: FinalizeTreeWithRootAndCollectionInstructionArgs = { + ...input, + }; + + // Default values. + if (!resolvedAccounts.treeConfig.value) { + resolvedAccounts.treeConfig.value = findTreeConfigPda(context, { + merkleTree: expectPublicKey(resolvedAccounts.merkleTree.value), + }); + } + if (!resolvedAccounts.payer.value) { + resolvedAccounts.payer.value = context.payer; + } + if (!resolvedAccounts.treeCreatorOrDelegate.value) { + resolvedAccounts.treeCreatorOrDelegate.value = context.identity; + } + if (!resolvedAccounts.collectionAuthority.value) { + resolvedAccounts.collectionAuthority.value = context.identity; + } + if (!resolvedAccounts.collectionMetadata.value) { + resolvedAccounts.collectionMetadata.value = findMetadataPda(context, { + mint: expectPublicKey(resolvedAccounts.collectionMint.value), + }); + } + if (!resolvedAccounts.collectionEdition.value) { + resolvedAccounts.collectionEdition.value = findMasterEditionPda(context, { + mint: expectPublicKey(resolvedAccounts.collectionMint.value), + }); + } + if (!resolvedAccounts.logWrapper.value) { + resolvedAccounts.logWrapper.value = context.programs.getPublicKey( + 'splNoop', + 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV' + ); + resolvedAccounts.logWrapper.isWritable = false; + } + if (!resolvedAccounts.compressionProgram.value) { + resolvedAccounts.compressionProgram.value = context.programs.getPublicKey( + 'splAccountCompression', + 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK' + ); + resolvedAccounts.compressionProgram.isWritable = false; + } + 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 = + getFinalizeTreeWithRootAndCollectionInstructionDataSerializer().serialize( + resolvedArgs as FinalizeTreeWithRootAndCollectionInstructionDataArgs + ); + + // 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 9f12dae8..153551b2 100644 --- a/clients/js/src/generated/instructions/index.ts +++ b/clients/js/src/generated/instructions/index.ts @@ -6,13 +6,20 @@ * @see https://github.com/metaplex-foundation/kinobi */ +export * from './addCanopy'; +export * from './appendCanopyNodes'; export * from './burn'; export * from './cancelRedeem'; export * from './createTreeConfig'; export * from './decompressV1'; export * from './delegate'; +export * from './finalizeTreeWithRoot'; +export * from './finalizeTreeWithRootAndCollection'; +export * from './initPreparedTreeWithRoot'; export * from './mintToCollectionV1'; export * from './mintV1'; +export * from './prepareBatchMerkleTree'; +export * from './prepareTree'; export * from './redeem'; export * from './setAndVerifyCollection'; export * from './setDecompressibleState'; diff --git a/clients/js/src/generated/instructions/initPreparedTreeWithRoot.ts b/clients/js/src/generated/instructions/initPreparedTreeWithRoot.ts new file mode 100644 index 00000000..b86baf27 --- /dev/null +++ b/clients/js/src/generated/instructions/initPreparedTreeWithRoot.ts @@ -0,0 +1,141 @@ +/** + * 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, + array, + bytes, + mapSerializer, + struct, + u32, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + getAccountMetasAndSigners, +} from '../shared'; + +// Accounts. +export type InitPreparedTreeWithRootInstructionAccounts = { + merkleTree: PublicKey | Pda; + /** + * Authority that controls write-access to the tree + * Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + */ + + authority?: Signer; + /** Program used to emit changelogs as cpi instruction data. */ + noop: PublicKey | Pda; +}; + +// Data. +export type InitPreparedTreeWithRootInstructionData = { + discriminator: Array; + root: Uint8Array; + rightmostLeaf: Uint8Array; + rightmostIndex: number; +}; + +export type InitPreparedTreeWithRootInstructionDataArgs = { + root: Uint8Array; + rightmostLeaf: Uint8Array; + rightmostIndex: number; +}; + +export function getInitPreparedTreeWithRootInstructionDataSerializer(): Serializer< + InitPreparedTreeWithRootInstructionDataArgs, + InitPreparedTreeWithRootInstructionData +> { + return mapSerializer< + InitPreparedTreeWithRootInstructionDataArgs, + any, + InitPreparedTreeWithRootInstructionData + >( + struct( + [ + ['discriminator', array(u8(), { size: 8 })], + ['root', bytes({ size: 32 })], + ['rightmostLeaf', bytes({ size: 32 })], + ['rightmostIndex', u32()], + ], + { description: 'InitPreparedTreeWithRootInstructionData' } + ), + (value) => ({ + ...value, + discriminator: [218, 248, 192, 55, 91, 205, 122, 10], + }) + ) as Serializer< + InitPreparedTreeWithRootInstructionDataArgs, + InitPreparedTreeWithRootInstructionData + >; +} + +// Args. +export type InitPreparedTreeWithRootInstructionArgs = + InitPreparedTreeWithRootInstructionDataArgs; + +// Instruction. +export function initPreparedTreeWithRoot( + context: Pick, + input: InitPreparedTreeWithRootInstructionAccounts & + InitPreparedTreeWithRootInstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'splAccountCompression', + 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK' + ); + + // Accounts. + const resolvedAccounts: ResolvedAccountsWithIndices = { + merkleTree: { index: 0, isWritable: true, value: input.merkleTree ?? null }, + authority: { index: 1, isWritable: false, value: input.authority ?? null }, + noop: { index: 2, isWritable: false, value: input.noop ?? null }, + }; + + // Arguments. + const resolvedArgs: InitPreparedTreeWithRootInstructionArgs = { ...input }; + + // Default values. + if (!resolvedAccounts.authority.value) { + resolvedAccounts.authority.value = context.identity; + } + + // 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 = getInitPreparedTreeWithRootInstructionDataSerializer().serialize( + resolvedArgs as InitPreparedTreeWithRootInstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/prepareBatchMerkleTree.ts b/clients/js/src/generated/instructions/prepareBatchMerkleTree.ts new file mode 100644 index 00000000..6696a0c5 --- /dev/null +++ b/clients/js/src/generated/instructions/prepareBatchMerkleTree.ts @@ -0,0 +1,137 @@ +/** + * 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, + array, + mapSerializer, + struct, + u32, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + getAccountMetasAndSigners, +} from '../shared'; + +// Accounts. +export type PrepareBatchMerkleTreeInstructionAccounts = { + merkleTree: PublicKey | Pda; + /** + * Authority that controls write-access to the tree + * Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + */ + + authority?: Signer; + /** Program used to emit changelogs as cpi instruction data. */ + noop: PublicKey | Pda; +}; + +// Data. +export type PrepareBatchMerkleTreeInstructionData = { + discriminator: Array; + maxDepth: number; + maxBufferSize: number; +}; + +export type PrepareBatchMerkleTreeInstructionDataArgs = { + maxDepth: number; + maxBufferSize: number; +}; + +export function getPrepareBatchMerkleTreeInstructionDataSerializer(): Serializer< + PrepareBatchMerkleTreeInstructionDataArgs, + PrepareBatchMerkleTreeInstructionData +> { + return mapSerializer< + PrepareBatchMerkleTreeInstructionDataArgs, + any, + PrepareBatchMerkleTreeInstructionData + >( + struct( + [ + ['discriminator', array(u8(), { size: 8 })], + ['maxDepth', u32()], + ['maxBufferSize', u32()], + ], + { description: 'PrepareBatchMerkleTreeInstructionData' } + ), + (value) => ({ + ...value, + discriminator: [230, 124, 120, 196, 249, 134, 199, 128], + }) + ) as Serializer< + PrepareBatchMerkleTreeInstructionDataArgs, + PrepareBatchMerkleTreeInstructionData + >; +} + +// Args. +export type PrepareBatchMerkleTreeInstructionArgs = + PrepareBatchMerkleTreeInstructionDataArgs; + +// Instruction. +export function prepareBatchMerkleTree( + context: Pick, + input: PrepareBatchMerkleTreeInstructionAccounts & + PrepareBatchMerkleTreeInstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'splAccountCompression', + 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK' + ); + + // Accounts. + const resolvedAccounts: ResolvedAccountsWithIndices = { + merkleTree: { index: 0, isWritable: true, value: input.merkleTree ?? null }, + authority: { index: 1, isWritable: false, value: input.authority ?? null }, + noop: { index: 2, isWritable: false, value: input.noop ?? null }, + }; + + // Arguments. + const resolvedArgs: PrepareBatchMerkleTreeInstructionArgs = { ...input }; + + // Default values. + if (!resolvedAccounts.authority.value) { + resolvedAccounts.authority.value = context.identity; + } + + // 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 = getPrepareBatchMerkleTreeInstructionDataSerializer().serialize( + resolvedArgs as PrepareBatchMerkleTreeInstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/instructions/prepareTree.ts b/clients/js/src/generated/instructions/prepareTree.ts new file mode 100644 index 00000000..a019c409 --- /dev/null +++ b/clients/js/src/generated/instructions/prepareTree.ts @@ -0,0 +1,185 @@ +/** + * 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, + Option, + OptionOrNullable, + Pda, + PublicKey, + Signer, + TransactionBuilder, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + array, + bool, + mapSerializer, + option, + struct, + u32, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { findTreeConfigPda } from '../accounts'; +import { + ResolvedAccount, + ResolvedAccountsWithIndices, + expectPublicKey, + getAccountMetasAndSigners, +} from '../shared'; + +// Accounts. +export type PrepareTreeInstructionAccounts = { + treeConfig?: PublicKey | Pda; + merkleTree: PublicKey | Pda; + payer?: Signer; + treeCreator?: Signer; + logWrapper?: PublicKey | Pda; + compressionProgram?: PublicKey | Pda; + systemProgram?: PublicKey | Pda; +}; + +// Data. +export type PrepareTreeInstructionData = { + discriminator: Array; + maxDepth: number; + maxBufferSize: number; + public: Option; +}; + +export type PrepareTreeInstructionDataArgs = { + maxDepth: number; + maxBufferSize: number; + public: OptionOrNullable; +}; + +export function getPrepareTreeInstructionDataSerializer(): Serializer< + PrepareTreeInstructionDataArgs, + PrepareTreeInstructionData +> { + return mapSerializer< + PrepareTreeInstructionDataArgs, + any, + PrepareTreeInstructionData + >( + struct( + [ + ['discriminator', array(u8(), { size: 8 })], + ['maxDepth', u32()], + ['maxBufferSize', u32()], + ['public', option(bool())], + ], + { description: 'PrepareTreeInstructionData' } + ), + (value) => ({ ...value, discriminator: [41, 56, 189, 77, 58, 12, 142, 71] }) + ) as Serializer; +} + +// Args. +export type PrepareTreeInstructionArgs = PrepareTreeInstructionDataArgs; + +// Instruction. +export function prepareTree( + context: Pick, + input: PrepareTreeInstructionAccounts & PrepareTreeInstructionArgs +): TransactionBuilder { + // Program ID. + const programId = context.programs.getPublicKey( + 'mplBubblegum', + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' + ); + + // Accounts. + const resolvedAccounts: ResolvedAccountsWithIndices = { + treeConfig: { index: 0, isWritable: true, value: input.treeConfig ?? null }, + merkleTree: { index: 1, isWritable: true, value: input.merkleTree ?? null }, + payer: { index: 2, isWritable: true, value: input.payer ?? null }, + treeCreator: { + index: 3, + isWritable: false, + value: input.treeCreator ?? null, + }, + logWrapper: { + index: 4, + isWritable: false, + value: input.logWrapper ?? null, + }, + compressionProgram: { + index: 5, + isWritable: false, + value: input.compressionProgram ?? null, + }, + systemProgram: { + index: 6, + isWritable: false, + value: input.systemProgram ?? null, + }, + }; + + // Arguments. + const resolvedArgs: PrepareTreeInstructionArgs = { ...input }; + + // Default values. + if (!resolvedAccounts.treeConfig.value) { + resolvedAccounts.treeConfig.value = findTreeConfigPda(context, { + merkleTree: expectPublicKey(resolvedAccounts.merkleTree.value), + }); + } + if (!resolvedAccounts.payer.value) { + resolvedAccounts.payer.value = context.payer; + } + if (!resolvedAccounts.treeCreator.value) { + resolvedAccounts.treeCreator.value = context.identity; + } + if (!resolvedAccounts.logWrapper.value) { + resolvedAccounts.logWrapper.value = context.programs.getPublicKey( + 'splNoop', + 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV' + ); + resolvedAccounts.logWrapper.isWritable = false; + } + if (!resolvedAccounts.compressionProgram.value) { + resolvedAccounts.compressionProgram.value = context.programs.getPublicKey( + 'splAccountCompression', + 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK' + ); + resolvedAccounts.compressionProgram.isWritable = false; + } + 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 = getPrepareTreeInstructionDataSerializer().serialize( + resolvedArgs as PrepareTreeInstructionDataArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/types/concurrentMerkleTreeHeaderData.ts b/clients/js/src/generated/types/concurrentMerkleTreeHeaderData.ts index 5de85eee..10faa9d4 100644 --- a/clients/js/src/generated/types/concurrentMerkleTreeHeaderData.ts +++ b/clients/js/src/generated/types/concurrentMerkleTreeHeaderData.ts @@ -12,6 +12,7 @@ import { GetDataEnumKindContent, Serializer, array, + bool, dataEnum, publicKey as publicKeySerializer, struct, @@ -43,6 +44,12 @@ export type ConcurrentMerkleTreeHeaderData = { * Provides a lower-bound on what slot to start (re-)building a tree from. */ creationSlot: bigint; + /** + * A flag indicating whether the tree has been initialized with a root. + * This field was added together with the `finalize_tree_with_root` instruction. + * It takes 1 byte of space taken from the previous padding for existing accounts. + */ + isBatchInitialized: boolean; /** * Needs padding for the account to be 8-byte aligned * 8-byte alignment is necessary to zero-copy the SPL ConcurrentMerkleTree @@ -73,6 +80,12 @@ export type ConcurrentMerkleTreeHeaderDataArgs = { * Provides a lower-bound on what slot to start (re-)building a tree from. */ creationSlot: number | bigint; + /** + * A flag indicating whether the tree has been initialized with a root. + * This field was added together with the `finalize_tree_with_root` instruction. + * It takes 1 byte of space taken from the previous padding for existing accounts. + */ + isBatchInitialized: boolean; /** * Needs padding for the account to be 8-byte aligned * 8-byte alignment is necessary to zero-copy the SPL ConcurrentMerkleTree @@ -93,7 +106,8 @@ export function getConcurrentMerkleTreeHeaderDataSerializer(): Serializer< ['maxDepth', u32()], ['authority', publicKeySerializer()], ['creationSlot', u64()], - ['padding', array(u8(), { size: 6 })], + ['isBatchInitialized', bool()], + ['padding', array(u8(), { size: 5 })], ]), ], ], diff --git a/clients/rust/Cargo.lock b/clients/rust/Cargo.lock index aa09d395..f8278c8d 100644 --- a/clients/rust/Cargo.lock +++ b/clients/rust/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -27,12 +27,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "aead" version = "0.4.3" @@ -249,7 +243,7 @@ dependencies = [ "borsh 0.10.3", "bytemuck", "getrandom 0.2.15", - "solana-program 1.18.23", + "solana-program", "thiserror", ] @@ -297,9 +291,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" [[package]] name = "aquamarine" @@ -356,7 +350,7 @@ dependencies = [ "derivative", "digest 0.10.7", "itertools", - "num-bigint 0.4.6", + "num-bigint 0.4.5", "num-traits", "paste", "rustc_version", @@ -379,7 +373,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ - "num-bigint 0.4.6", + "num-bigint 0.4.5", "num-traits", "proc-macro2", "quote", @@ -408,7 +402,7 @@ dependencies = [ "ark-serialize-derive", "ark-std", "digest 0.10.7", - "num-bigint 0.4.6", + "num-bigint 0.4.5", ] [[package]] @@ -434,15 +428,15 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.8" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" -version = "0.7.6" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "ascii" @@ -508,9 +502,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.12" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fec134f64e2bc57411226dfc4e52dec859ddfc7e711fc5e07b612584f000e4aa" +checksum = "9c90a406b4495d129f00461241616194cb8a032c8d1c53c657f0961d5f8e0498" dependencies = [ "brotli", "flate2", @@ -531,13 +525,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -559,15 +553,15 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", ] @@ -619,9 +613,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -696,11 +690,11 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "dbe5b10e214954177fb1dc9fbd20a1a2608fe99e6c832033bdc7cea287a20d77" dependencies = [ - "borsh-derive 1.5.1", + "borsh-derive 1.5.0", "cfg_aliases", ] @@ -732,15 +726,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "d7a8646f94ab393e43e8b35a2558b1624bed28b97ee09c5d15456e3c9463f46d" dependencies = [ "once_cell", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", "syn_derive", ] @@ -801,9 +795,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "4.0.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +checksum = "e6221fe77a248b9117d431ad93761222e1cf8ff282d9d1d5d9f53d6299a1cf76" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -842,22 +836,22 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.7.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" +checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -868,9 +862,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "bzip2" @@ -905,13 +899,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.15" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" dependencies = [ "jobserver", "libc", - "shlex", + "once_cell", ] [[package]] @@ -922,9 +916,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cfg_aliases" -version = "0.2.1" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" @@ -938,7 +932,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.6", + "windows-targets 0.52.5", ] [[package]] @@ -1062,9 +1056,9 @@ checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" [[package]] name = "constant_time_eq" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "core-foundation" @@ -1078,33 +1072,33 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.7" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ "crossbeam-utils", ] @@ -1130,9 +1124,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crunchy" @@ -1185,9 +1179,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.10" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ "darling_core", "darling_macro", @@ -1195,27 +1189,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.10" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", - "syn 2.0.76", + "strsim 0.10.0", + "syn 2.0.63", ] [[package]] name = "darling_macro" -version = "0.20.10" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1256,7 +1250,7 @@ dependencies = [ "asn1-rs", "displaydoc", "nom", - "num-bigint 0.4.6", + "num-bigint 0.4.5", "num-traits", "rusticata-macros", ] @@ -1337,13 +1331,13 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1366,7 +1360,7 @@ checksum = "a6cbae11b3de8fce2a456e8ea3dada226b35fe791f0dc1d360c0941f0bb681f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1430,9 +1424,9 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "encode_unicode" @@ -1466,7 +1460,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1475,11 +1469,11 @@ version = "3.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" dependencies = [ - "num-bigint 0.4.6", + "num-bigint 0.4.5", "num-traits", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1519,9 +1513,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "fastrand" -version = "2.1.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "feature-probe" @@ -1531,24 +1525,24 @@ checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" [[package]] name = "filetime" -version = "0.2.25" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "libredox", - "windows-sys 0.59.0", + "redox_syscall 0.4.1", + "windows-sys 0.52.0", ] [[package]] name = "flate2" -version = "1.0.33" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "miniz_oxide", ] [[package]] @@ -1637,7 +1631,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1719,9 +1713,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "goblin" @@ -1746,7 +1740,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.5.0", + "indexmap 2.2.6", "slab", "tokio", "tokio-util 0.7.11", @@ -1891,9 +1885,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" @@ -1909,9 +1903,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -2002,18 +1996,18 @@ dependencies = [ [[package]] name = "include_dir" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" +checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" dependencies = [ "include_dir_macros", ] [[package]] name = "include_dir_macros" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" +checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" dependencies = [ "proc-macro2", "quote", @@ -2021,9 +2015,9 @@ dependencies = [ [[package]] name = "index_list" -version = "0.2.13" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e6ba961c14e98151cd6416dd3685efe786a94c38bc1a535c06ceff0a1600813" +checksum = "70891286cb8e844fdfcf1178b47569699f9e20b5ecc4b45a6240a64771444638" [[package]] name = "indexmap" @@ -2038,9 +2032,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -2062,9 +2056,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.13" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", ] @@ -2092,18 +2086,18 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.32" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -2144,26 +2138,15 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.5.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "libredox" -version = "0.1.3" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.6.0", - "libc", - "redox_syscall", -] +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libsecp256k1" @@ -2221,15 +2204,15 @@ checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" dependencies = [ "ark-bn254", "ark-ff", - "num-bigint 0.4.6", + "num-bigint 0.4.5", "thiserror", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -2243,9 +2226,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lru" @@ -2258,9 +2241,9 @@ dependencies = [ [[package]] name = "lz4" -version = "1.26.0" +version = "1.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958b4caa893816eea05507c20cfe47574a43d9a697138a7872990bba8a0ece68" +checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1" dependencies = [ "libc", "lz4-sys", @@ -2268,9 +2251,9 @@ dependencies = [ [[package]] name = "lz4-sys" -version = "1.10.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868" +checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" dependencies = [ "cc", "libc", @@ -2278,9 +2261,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memmap2" @@ -2335,32 +2318,22 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - [[package]] name = "mio" -version = "1.0.2" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ - "hermit-abi 0.3.9", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -2413,7 +2386,7 @@ dependencies = [ [[package]] name = "mpl-bubblegum" -version = "1.4.0" +version = "1.5.0" dependencies = [ "assert_matches", "borsh 0.10.3", @@ -2422,13 +2395,13 @@ dependencies = [ "num-derive 0.3.3", "num-traits", "serde", - "serde_with 3.9.0", - "solana-program 1.18.23", + "serde_with 3.8.1", + "solana-program", "solana-program-test", "solana-sdk", "spl-account-compression", "spl-associated-token-account", - "spl-concurrent-merkle-tree", + "spl-concurrent-merkle-tree 0.3.0", "spl-merkle-tree-reference", "spl-noop", "spl-token", @@ -2491,9 +2464,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.6" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ "num-integer", "num-traits", @@ -2534,7 +2507,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -2599,11 +2572,11 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ - "num_enum_derive 0.7.3", + "num_enum_derive 0.7.2", ] [[package]] @@ -2615,19 +2588,19 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] name = "num_enum_derive" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -2638,9 +2611,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.36.4" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -2722,9 +2695,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.3" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", "parking_lot_core", @@ -2738,9 +2711,9 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.1", "smallvec", - "windows-targets 0.52.6", + "windows-targets 0.52.5", ] [[package]] @@ -2808,7 +2781,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -2860,9 +2833,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.7.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" [[package]] name = "powerfmt" @@ -2872,12 +2845,9 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "predicates" @@ -2895,15 +2865,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.8" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" +checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" [[package]] name = "predicates-tree" -version = "1.0.11" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" +checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" dependencies = [ "predicates-core", "termtree", @@ -2930,11 +2900,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit 0.22.20", + "toml_edit 0.21.1", ] [[package]] @@ -2963,9 +2933,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -2987,7 +2957,7 @@ checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -3040,9 +3010,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -3161,18 +3131,27 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags 2.6.0", + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags 2.5.0", ] [[package]] name = "regex" -version = "1.10.6" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -3182,9 +3161,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -3193,9 +3172,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" @@ -3305,9 +3284,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" -version = "0.4.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ "semver", ] @@ -3323,11 +3302,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.35" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -3379,9 +3358,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" [[package]] name = "ryu" @@ -3430,7 +3409,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -3445,11 +3424,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "core-foundation", "core-foundation-sys", "libc", @@ -3458,9 +3437,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", @@ -3483,41 +3462,40 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.209" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.15" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", - "memchr", "ryu", "serde", ] @@ -3546,19 +3524,19 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.9.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.5.0", + "indexmap 2.2.6", "serde", "serde_derive", "serde_json", - "serde_with_macros 3.9.0", + "serde_with_macros 3.8.1", "time", ] @@ -3571,19 +3549,19 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] name = "serde_with_macros" -version = "3.9.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -3658,12 +3636,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -3722,9 +3694,9 @@ dependencies = [ [[package]] name = "solana-account-decoder" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e54ec43b0262c19a3c87bf2dbd52c6bc6d4f9307246fe4b666fd87f06305e5" +checksum = "0f31c3dc9c7ebfaff452f063b406bbf64d326d71120996f4d3fdeee7ae7f1b6e" dependencies = [ "Inflector", "base64 0.21.7", @@ -3747,9 +3719,9 @@ dependencies = [ [[package]] name = "solana-accounts-db" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da22e7afc30fa3d6367f4a5230c843ec2bfd27456b9f3b7ec144c112eaca303a" +checksum = "085985c66a70f31d55abe3ea8955d424351e1c10f53d1b508627b571e3badb58" dependencies = [ "arrayref", "bincode", @@ -3773,7 +3745,7 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_cpus", - "num_enum 0.7.3", + "num_enum 0.7.2", "ouroboros", "percentage", "qualifier_attr", @@ -3808,9 +3780,9 @@ dependencies = [ [[package]] name = "solana-address-lookup-table-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2601a7879e6db5f9af09801f2c99032a204849643832dae4a96495b86e789b0e" +checksum = "7f839249b791c98ed1d0d6e0d21932a962d6567963d34d3a6cbad52b55624131" dependencies = [ "bincode", "bytemuck", @@ -3821,7 +3793,7 @@ dependencies = [ "serde", "solana-frozen-abi", "solana-frozen-abi-macro", - "solana-program 1.18.23", + "solana-program", "solana-program-runtime", "solana-sdk", "thiserror", @@ -3829,14 +3801,14 @@ dependencies = [ [[package]] name = "solana-banks-client" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48b38e77fde55eaa036666461c61df36238416908c5a4737b59cd1b6165736dc" +checksum = "c3b520d4a39dc146d64a8326be372aeb482819c7b4f657408d3f956cca3d3ee2" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.0", "futures", "solana-banks-interface", - "solana-program 1.18.23", + "solana-program", "solana-sdk", "tarpc", "thiserror", @@ -3846,9 +3818,9 @@ dependencies = [ [[package]] name = "solana-banks-interface" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cb66654fa16a519efe8bb54eacfd0e9a3862f916d925cd24b63041b113c8a1" +checksum = "31a79263dbd1122ff4addbc956d01ad6e5c23585b951900871e0cb23615b8b22" dependencies = [ "serde", "solana-sdk", @@ -3857,9 +3829,9 @@ dependencies = [ [[package]] name = "solana-banks-server" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "964127e858fb510ff017981acab11ac376ecfee3b10c03c379ff084a52e14969" +checksum = "d5c39a8d83676027a6b23502636c5f198072d39ce27642d326e9d2239f1436b8" dependencies = [ "bincode", "crossbeam-channel", @@ -3877,9 +3849,9 @@ dependencies = [ [[package]] name = "solana-bpf-loader-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da1c1bf12ec90f8a67706e6e5ffc91e2198b85a07bd12c56c44967d13bba7e7f" +checksum = "fcc06ca3f5b6a2979fcc679f98765c51e103a9f24c68f8d07af9ad58cb988a3a" dependencies = [ "bincode", "byteorder", @@ -3896,16 +3868,16 @@ dependencies = [ [[package]] name = "solana-bucket-map" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71ed4b533159ec832f534a5b4efb10946d392b15efc88ca2107bdbb39b5d0646" +checksum = "7c1f27fbbf17492f46335907b525ac7b1b9d3e2bcb21e029f12a90930842c414" dependencies = [ "bv", "bytemuck", "log", "memmap2", "modular-bitfield", - "num_enum 0.7.3", + "num_enum 0.7.2", "rand 0.8.5", "solana-measure", "solana-sdk", @@ -3914,9 +3886,9 @@ dependencies = [ [[package]] name = "solana-clap-utils" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "117bf11e4d15b529dd9dfa2680abaf8bd3c1d8f7cb0586a5accdac5a2ecc7cc5" +checksum = "21ffc5c1aa04a6ce12f4cccd2a26b78dfa1db2d559554b4b2cfffc1059e95764" dependencies = [ "chrono", "clap 2.34.0", @@ -3931,16 +3903,16 @@ dependencies = [ [[package]] name = "solana-client" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1501330d85c1a790f45f11330616bd6f0b9acd2193477268a65a38ce3b7cfdd0" +checksum = "fad2cc8cf76432aa7df46ffc50cd9c97a087b899de57a67d08a4a909bcf85496" dependencies = [ "async-trait", "bincode", "dashmap", "futures", "futures-util", - "indexmap 2.5.0", + "indexmap 2.2.6", "indicatif", "log", "quinn", @@ -3964,9 +3936,9 @@ dependencies = [ [[package]] name = "solana-compute-budget-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a43d1ca229c5f761b9be38bd7dbc7c034cfb214dcbfef9691314ae4c778451c" +checksum = "84226e74aeba7384a03c2dddd01e0dcd660bc2c1ea361f97e1de27e2b46bed44" dependencies = [ "solana-program-runtime", "solana-sdk", @@ -3974,9 +3946,9 @@ dependencies = [ [[package]] name = "solana-config-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00d0d031f3d97e3f59305c4aabf9da7359fad86dbaeb43b61a1ea13224e0b8a" +checksum = "d12f4c7ca44f55afb012dfadd21a352cb818a225f4e6d7fe3db5c3fcb1e28ca1" dependencies = [ "bincode", "chrono", @@ -3988,15 +3960,15 @@ dependencies = [ [[package]] name = "solana-connection-cache" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fa9ff6c33772441670e446b1d43e787aa315e95f2f9c14e3e9508b814bc8e5" +checksum = "b4fea76dc27635837568c533c7fadebe4fbf86fbdbf561937347357d41434b85" dependencies = [ "async-trait", "bincode", "crossbeam-channel", "futures-util", - "indexmap 2.5.0", + "indexmap 2.2.6", "log", "rand 0.8.5", "rayon", @@ -4010,9 +3982,9 @@ dependencies = [ [[package]] name = "solana-cost-model" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "992d3d9e5cd8df6a393d66c2d52ba18afd3988f142a44f1ff26541fb3c0dd5b7" +checksum = "b08fd2e03894f21f8f6df4c454a56185dc112dec8f6953c00bb25446dd4d9c8a" dependencies = [ "lazy_static", "log", @@ -4034,9 +4006,9 @@ dependencies = [ [[package]] name = "solana-frozen-abi" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bfcde2fc6946c99c7e3400fadd04d1628d675bfd66cb34d461c0f3224bd27d1" +checksum = "9843fe4a4e4d541bd056465257704d8d53b50ed59328dcb5f37821ae0f843676" dependencies = [ "block-buffer 0.10.4", "bs58 0.4.0", @@ -4059,21 +4031,21 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5024d241425f4e99f112ee03bfa89e526c86c7ca9bd7e13448a7f2dffb7e060" +checksum = "3f24edb8172842544ace0ccb9547353cc55fe4a6d3b2786e209939d3a8bf271d" dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] name = "solana-loader-v4-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5607358636671522978533b77ff409b634b2ea53d94fd32dec4b4bcf7fe5c7e" +checksum = "f63ef21a0a7215853f4de4bd90ab1ca544114ab10065376d959945c4a2621074" dependencies = [ "log", "solana-measure", @@ -4084,9 +4056,9 @@ dependencies = [ [[package]] name = "solana-logger" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10948c30d138d6fbfc2ae78a4882be5a9ebffa4bb1239c4efc386104ebc35b7f" +checksum = "0a9c97300d5fd98fd490819186debfda9d47b1a5c82b5ffdb76e2ea6bad055c4" dependencies = [ "env_logger", "lazy_static", @@ -4095,9 +4067,9 @@ dependencies = [ [[package]] name = "solana-measure" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379355a731abf50bb5ef1e4afba02ac8c835c25bb18e32229bb481657d5c9eca" +checksum = "e9bf69dbc3d69406b67d3d263c8a5aa0d8501051d75aa842f47502652060596d" dependencies = [ "log", "solana-sdk", @@ -4105,9 +4077,9 @@ dependencies = [ [[package]] name = "solana-metrics" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a6f767cf39d69104bff52602f3141d6abfbdd55b4eb310f8fbbbf862b27e6f" +checksum = "35a2112662341adaf1b8fbd4a8d819bc24ae5d1d59655e0561161c5c816894b9" dependencies = [ "crossbeam-channel", "gethostname", @@ -4120,9 +4092,9 @@ dependencies = [ [[package]] name = "solana-net-utils" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c81ade42b553c7de08fb97cf3cfe44545f59a247e90042a67d224d62a8a189d7" +checksum = "ecc90c80c6f0a9b428464f0147f6407cae4a16aa5483d6b7ea37fd2976c76edc" dependencies = [ "bincode", "clap 3.2.25", @@ -4148,9 +4120,9 @@ checksum = "8b8a731ed60e89177c8a7ab05fe0f1511cedd3e70e773f288f9de33a9cfdc21e" [[package]] name = "solana-perf" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecdf31e535743515d31392f210d132463300b5d3de7c3e26f6b344b6c941c42" +checksum = "2485083355b1c22256d57270e5b915db23cc0e2f0165027ffc52c7f815015137" dependencies = [ "ahash 0.8.11", "bincode", @@ -4177,9 +4149,9 @@ dependencies = [ [[package]] name = "solana-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76056fecde0fe0ece8b457b719729c17173333471c72ad41969982975a10d6e0" +checksum = "9de9a1634b9d30ca0e5c2d53806c030a5d9c07dfcc4505ebeb218206514d17b8" dependencies = [ "ark-bn254", "ark-ec", @@ -4187,11 +4159,11 @@ dependencies = [ "ark-serialize", "base64 0.21.7", "bincode", - "bitflags 2.6.0", + "bitflags 2.5.0", "blake3", "borsh 0.10.3", "borsh 0.9.3", - "borsh 1.5.1", + "borsh 1.5.0", "bs58 0.4.0", "bv", "bytemuck", @@ -4208,7 +4180,7 @@ dependencies = [ "light-poseidon", "log", "memoffset 0.9.1", - "num-bigint 0.4.6", + "num-bigint 0.4.5", "num-derive 0.4.2", "num-traits", "parking_lot", @@ -4223,64 +4195,18 @@ dependencies = [ "sha3 0.10.8", "solana-frozen-abi", "solana-frozen-abi-macro", - "solana-sdk-macro 1.18.23", + "solana-sdk-macro", "thiserror", "tiny-bip39", "wasm-bindgen", "zeroize", ] -[[package]] -name = "solana-program" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d899c2a1d37290dcfeeb9d1c0032915a29bd48f35759f19ff1e0f6b096eca0b" -dependencies = [ - "ark-bn254", - "ark-ec", - "ark-ff", - "ark-serialize", - "base64 0.22.1", - "bincode", - "bitflags 2.6.0", - "blake3", - "borsh 0.10.3", - "borsh 1.5.1", - "bs58 0.5.1", - "bv", - "bytemuck", - "bytemuck_derive", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.2.15", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "memoffset 0.9.1", - "num-bigint 0.4.6", - "num-derive 0.4.2", - "num-traits", - "parking_lot", - "rand 0.8.5", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2 0.10.8", - "sha3 0.10.8", - "solana-sdk-macro 2.0.8", - "thiserror", - "wasm-bindgen", -] - [[package]] name = "solana-program-runtime" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e566a9e61ecdc250824314864654dd370abf561fa8328f6e08b3bc96ccc5b80d" +checksum = "078fbc30339aff91d84ef5fc49ad75818419fedc543da22617d2f36a93d56bff" dependencies = [ "base64 0.21.7", "bincode", @@ -4306,9 +4232,9 @@ dependencies = [ [[package]] name = "solana-program-test" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b841ea7e55ee7b7e2cac034fd008c7d8cabd8b474958d4f64fcfaf76220846f5" +checksum = "71661f6294e651d6aee508c3194d26f8bcf95ced2bbafd1666c487bb292580eb" dependencies = [ "assert_matches", "async-trait", @@ -4336,9 +4262,9 @@ dependencies = [ [[package]] name = "solana-pubsub-client" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d997840e6d033edc4fca8f06b920726dc18d3a5bbc1e538b2154cc3b71acd1" +checksum = "11e9e2ccf38a591001488200ee22675e15214d1fbeb1d23013a7a8798c78aca4" dependencies = [ "crossbeam-channel", "futures-util", @@ -4361,9 +4287,9 @@ dependencies = [ [[package]] name = "solana-quic-client" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e689a97cefa6a005cd305210234f3dc78aacc934c0f76d210a264fae36ee432" +checksum = "6043950cfe26f79e0c35dc7f894a0cc0a3d2786255ef6fe745aa92b20ad6c2f9" dependencies = [ "async-mutex", "async-trait", @@ -4388,9 +4314,9 @@ dependencies = [ [[package]] name = "solana-rayon-threadlimit" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf70f0441603e553fc3db30c1eec9f10cecc27849e7dc74d5f692d5a41a56ca" +checksum = "ba82ca1adb9f096d38415ef7ecc3279b8ca2599f3ae5de986c98bb331dec81b1" dependencies = [ "lazy_static", "num_cpus", @@ -4398,9 +4324,9 @@ dependencies = [ [[package]] name = "solana-remote-wallet" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9651b3f2c3df39a1a6fc87fe792bdb3ec3d84a8169c0a57c86335b48d6cb1491" +checksum = "868d095412afbdde6c8f02dcb26c61c7f7ac5332425eb1be682ca9c7d02abd3d" dependencies = [ "console", "dialoguer", @@ -4417,9 +4343,9 @@ dependencies = [ [[package]] name = "solana-rpc-client" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d753d116aacc43ef64a2bc8d25f8b20af47c366b29aa859186124e226d6e3819" +checksum = "3ed5aca9e30731a03608f595ff34198793b2de957ad7b5ae224388ea447522b3" dependencies = [ "async-trait", "base64 0.21.7", @@ -4443,9 +4369,9 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617df2c53f948c821cefca6824e376aac04ff0d844bb27f4d3ada9e211bcffe7" +checksum = "91ae63c92a83d40721aad647d07e40d63dd0612b4f787f64bf270877a4464c0e" dependencies = [ "base64 0.21.7", "bs58 0.4.0", @@ -4465,9 +4391,9 @@ dependencies = [ [[package]] name = "solana-rpc-client-nonce-utils" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2d34cf36289cc35a0b18cd518a256312090368a37f40b448520e260923558a9" +checksum = "39b025b6fed986086e236bbb8cd4b559b1dd2d549338bb7e808ef44505f6f816" dependencies = [ "clap 2.34.0", "solana-clap-utils", @@ -4478,9 +4404,9 @@ dependencies = [ [[package]] name = "solana-runtime" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18dca69c7d3127d7b35014e703675a5665ed5680f6e1892acd24d612da059be9" +checksum = "9bf35a99ff547508a70ffd70de3b35ab4fa677f8b91f6745f90bf6ea9b2a8a67" dependencies = [ "aquamarine", "arrayref", @@ -4509,7 +4435,7 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_cpus", - "num_enum 0.7.3", + "num_enum 0.7.2", "ouroboros", "percentage", "qualifier_attr", @@ -4555,15 +4481,15 @@ dependencies = [ [[package]] name = "solana-sdk" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b3f2080eddef6552fde7f149c429cf05b9bb0605a068b0d28e19d793e24df4" +checksum = "323d21f0cb307e28ccfbcb3a24a5ae230abc8176bfb82492df6773deb79b62de" dependencies = [ "assert_matches", "base64 0.21.7", "bincode", - "bitflags 2.6.0", - "borsh 1.5.1", + "bitflags 2.5.0", + "borsh 1.5.0", "bs58 0.4.0", "bytemuck", "byteorder", @@ -4582,7 +4508,7 @@ dependencies = [ "memmap2", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.3", + "num_enum 0.7.2", "pbkdf2 0.11.0", "qstring", "qualifier_attr", @@ -4601,8 +4527,8 @@ dependencies = [ "solana-frozen-abi", "solana-frozen-abi-macro", "solana-logger", - "solana-program 1.18.23", - "solana-sdk-macro 1.18.23", + "solana-program", + "solana-sdk-macro", "thiserror", "uriparse", "wasm-bindgen", @@ -4610,28 +4536,15 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a8613ca80150f7e277e773620ba65d2c5fcc3a08eb8026627d601421ab43aef" +checksum = "ff6d088aff04f5ad17f6f4a1a84a7a6aef633d48e8ed6c12154fcbb5dfde07bd" dependencies = [ "bs58 0.4.0", "proc-macro2", "quote", "rustversion", - "syn 2.0.76", -] - -[[package]] -name = "solana-sdk-macro" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23198ed620c4a61c97fe49bd907fc965659aea9a5ed0ea0cf90084eecc72a3c1" -dependencies = [ - "bs58 0.5.1", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -4642,9 +4555,9 @@ checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" [[package]] name = "solana-send-transaction-service" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff268c2c8a9490acfe40daeb650067e053684167c371d6d02a3bc3ad701d4c1f" +checksum = "1c14685b33d7d1a2972f5c6e356b82b5762cedc9a8307ad17b9ec839286e4ad0" dependencies = [ "crossbeam-channel", "log", @@ -4658,9 +4571,9 @@ dependencies = [ [[package]] name = "solana-stake-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22aaa33150c76b5c2d11b31b8e7fceb9c147ecf40ae9050af34c619a5bf4ff3f" +checksum = "58b1744e5fb5a71cc7a9ef2eaaaa6c2a9112cf1856d4877c4c20c5cd151cfb86" dependencies = [ "bincode", "log", @@ -4673,16 +4586,16 @@ dependencies = [ [[package]] name = "solana-streamer" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "979d470dd7c589679a2e036078921989a2563f333b73b31e2fdceb09a6d55a29" +checksum = "ce37f6de2695d5def82e3cc965f6d97d38e32c87b3b9dee525468ae6d6d3050d" dependencies = [ "async-channel", "bytes", "crossbeam-channel", "futures-util", "histogram", - "indexmap 2.5.0", + "indexmap 2.2.6", "itertools", "libc", "log", @@ -4706,9 +4619,9 @@ dependencies = [ [[package]] name = "solana-system-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "873b17e54d30a7834e5b2224351fb277e0608e40261e9a408d3706737d2a61f8" +checksum = "4b22323cae3acc40bc5ac6f733b713e38747b879cffe020dac1ef859d87f8da4" dependencies = [ "bincode", "log", @@ -4720,9 +4633,9 @@ dependencies = [ [[package]] name = "solana-thin-client" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "851b9ae239d098c766aee3558330cc16edd0524c9cf3f9cf7c64f53b1024d507" +checksum = "833f35f6d7b24436643b87a19f7adbdd105750d49d556f4c9b0cba5e367c2ff7" dependencies = [ "bincode", "log", @@ -4735,14 +4648,14 @@ dependencies = [ [[package]] name = "solana-tpu-client" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a7a7e5a522fe5333fcb47e02fb7da73ff614d917754167937b5523c383ce161" +checksum = "1006c69665839d00182d5fe260fb61e939c7a7877fbf67cdd812f07957a1b773" dependencies = [ "async-trait", "bincode", "futures-util", - "indexmap 2.5.0", + "indexmap 2.2.6", "indicatif", "log", "rayon", @@ -4759,9 +4672,9 @@ dependencies = [ [[package]] name = "solana-transaction-status" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51be349fb9301d2a0fdd0b9ba5341e5f72bf4900ca4c0ede04748bc9038d15e8" +checksum = "d08bc13fa4f5ddf945253ac957b8b924c6181f9a80283e47e9922c07e73a845c" dependencies = [ "Inflector", "base64 0.21.7", @@ -4784,9 +4697,9 @@ dependencies = [ [[package]] name = "solana-udp-client" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3274b4bfccd57ecffcf4037cd09fc61777633e0d0c5f8b76abcaa10ee83f3ae5" +checksum = "8db0bcf3c61965df993c08118245cf79fc5e1994566bbf62585aaf6bfd578b26" dependencies = [ "async-trait", "solana-connection-cache", @@ -4799,9 +4712,9 @@ dependencies = [ [[package]] name = "solana-version" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf45873439f73420f60a5e0f87b529923c3489d24a228d5eb8f5ce6955bdc1b" +checksum = "180809ce9ca2dfc5a0bf62738c4ce22fe3f459cfde6589546922387a004fde82" dependencies = [ "log", "rustc_version", @@ -4815,9 +4728,9 @@ dependencies = [ [[package]] name = "solana-vote" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54cb2827041a2acb79e3855e7310466d9bef71650e2304994076b209eaf4d9f" +checksum = "63f32ca0c27ebe5f0c50df270f9041750c02fdd93800c55b6b5bcbd0506408d6" dependencies = [ "crossbeam-channel", "itertools", @@ -4834,9 +4747,9 @@ dependencies = [ [[package]] name = "solana-vote-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7c7525bda137bbb9bc0dc967a4ffca82786147eb2d1efbf76a8dc52978f0b8" +checksum = "4f40d6a334adbe76160c8b4e2579bb7c71452794d5f06b72b0458f7cc088fa19" dependencies = [ "bincode", "log", @@ -4848,7 +4761,7 @@ dependencies = [ "solana-frozen-abi", "solana-frozen-abi-macro", "solana-metrics", - "solana-program 1.18.23", + "solana-program", "solana-program-runtime", "solana-sdk", "thiserror", @@ -4856,9 +4769,9 @@ dependencies = [ [[package]] name = "solana-zk-token-proof-program" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce8bf8a6d43db385a2beb324110282ae8140a4a040d39f3a0870c43df24c5055" +checksum = "4526932336b0a6535ec4f90016c630246db83bad4d7fd2d4c8b3d5e211580fcd" dependencies = [ "bytemuck", "num-derive 0.4.2", @@ -4870,9 +4783,9 @@ dependencies = [ [[package]] name = "solana-zk-token-sdk" -version = "1.18.23" +version = "1.18.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39a57b2f269f24088b6b8e426de05e5c1faa6b5d6f26175c06eb80df96ec685e" +checksum = "c7ea6cfb74066a35ea9ad53b1108bb26f35752569bcfb3d9203f58a7bf57fac5" dependencies = [ "aes-gcm-siv", "base64 0.21.7", @@ -4890,7 +4803,7 @@ dependencies = [ "serde", "serde_json", "sha3 0.9.1", - "solana-program 1.18.23", + "solana-program", "solana-sdk", "subtle", "thiserror", @@ -4899,9 +4812,9 @@ dependencies = [ [[package]] name = "solana_rbpf" -version = "0.8.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da5d083187e3b3f453e140f292c09186881da8a02a7b5e27f645ee26de3d9cc5" +checksum = "3d457cc2ba742c120492a64b7fa60e22c575e891f6b55039f4d736568fb112a3" dependencies = [ "byteorder", "combine", @@ -4940,14 +4853,14 @@ dependencies = [ [[package]] name = "spl-account-compression" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602499d5fe3b60280239c4656a361b283c8c5f73f769c6cf41d2e8a151ce72db" +checksum = "31f461e20e8efb539d7f3f30cd82931ee128651c6366abe326f083b07253a1d6" dependencies = [ "anchor-lang", "bytemuck", - "solana-program 2.0.8", - "spl-concurrent-merkle-tree", + "solana-program", + "spl-concurrent-merkle-tree 0.4.0", "spl-noop", ] @@ -4961,7 +4874,7 @@ dependencies = [ "borsh 0.10.3", "num-derive 0.4.2", "num-traits", - "solana-program 1.18.23", + "solana-program", "spl-token", "spl-token-2022", "thiserror", @@ -4974,7 +4887,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7f5f45b971d82cbb0416fdffad3c9098f259545d54072e83a0a482f60f8f689" dependencies = [ "bytemuck", - "solana-program 2.0.8", + "solana-program", + "thiserror", +] + +[[package]] +name = "spl-concurrent-merkle-tree" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85d1bbb97252d8a1b90d3d56425038928382a306b71dbba4c836973c94b33f96" +dependencies = [ + "bytemuck", + "solana-program", "thiserror", ] @@ -4985,7 +4909,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" dependencies = [ "bytemuck", - "solana-program 1.18.23", + "solana-program", "spl-discriminator-derive", ] @@ -4997,7 +4921,7 @@ checksum = "07fd7858fc4ff8fb0e34090e41d7eb06a823e1057945c26d480bfc21d2338a93" dependencies = [ "quote", "spl-discriminator-syn", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5009,7 +4933,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.76", + "syn 2.0.63", "thiserror", ] @@ -5019,7 +4943,7 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f180b03318c3dbab3ef4e1e4d46d5211ae3c780940dd0a28695aba4b59a75a" dependencies = [ - "solana-program 1.18.23", + "solana-program", ] [[package]] @@ -5028,7 +4952,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28437c617c7f0db6b7229a489239f3ea6160499542d9367fbca2fc5ec7744abb" dependencies = [ - "solana-program 1.18.23", + "solana-program", "thiserror", ] @@ -5038,7 +4962,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dd67ea3d0070a12ff141f5da46f9695f49384a03bce1203a5608f5739437950" dependencies = [ - "solana-program 1.18.23", + "solana-program", ] [[package]] @@ -5049,7 +4973,7 @@ checksum = "2881dddfca792737c0706fa0175345ab282b1b0879c7d877bad129645737c079" dependencies = [ "borsh 0.10.3", "bytemuck", - "solana-program 1.18.23", + "solana-program", "solana-zk-token-sdk", "spl-program-error", ] @@ -5062,7 +4986,7 @@ checksum = "249e0318493b6bcf27ae9902600566c689b7dfba9f1bdff5893e92253374e78c" dependencies = [ "num-derive 0.4.2", "num-traits", - "solana-program 1.18.23", + "solana-program", "spl-program-error-derive", "thiserror", ] @@ -5076,17 +5000,17 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] name = "spl-tlv-account-resolution" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615d381f48ddd2bb3c57c7f7fb207591a2a05054639b18a62e785117dd7a8683" +checksum = "56f335787add7fa711819f9e7c573f8145a5358a709446fe2d24bf2a88117c90" dependencies = [ "bytemuck", - "solana-program 1.18.23", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error", @@ -5104,7 +5028,7 @@ dependencies = [ "num-derive 0.3.3", "num-traits", "num_enum 0.6.1", - "solana-program 1.18.23", + "solana-program", "thiserror", ] @@ -5118,8 +5042,8 @@ dependencies = [ "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.3", - "solana-program 1.18.23", + "num_enum 0.7.2", + "solana-program", "solana-security-txt", "solana-zk-token-sdk", "spl-memo", @@ -5139,7 +5063,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b889509d49fa74a4a033ca5dae6c2307e9e918122d97e58562f5c4ffa795c75d" dependencies = [ "bytemuck", - "solana-program 1.18.23", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error", @@ -5152,7 +5076,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c16ce3ba6979645fb7627aa1e435576172dd63088dc7848cb09aa331fa1fe4f" dependencies = [ "borsh 0.10.3", - "solana-program 1.18.23", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error", @@ -5167,7 +5091,7 @@ checksum = "7aabdb7c471566f6ddcee724beb8618449ea24b399e58d464d6b5bc7db550259" dependencies = [ "arrayref", "bytemuck", - "solana-program 1.18.23", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error", @@ -5182,7 +5106,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a468e6f6371f9c69aae760186ea9f1a01c2908351b06a5e0026d21cfc4d7ecac" dependencies = [ "bytemuck", - "solana-program 1.18.23", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error", @@ -5206,12 +5130,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "strum" version = "0.24.1" @@ -5259,9 +5177,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.76" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", @@ -5277,7 +5195,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5321,9 +5239,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.41" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" dependencies = [ "filetime", "libc", @@ -5367,15 +5285,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -5411,7 +5328,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5422,7 +5339,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", "test-case-core", ] @@ -5458,7 +5375,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5523,9 +5440,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -5538,31 +5455,32 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", "libc", "mio", + "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5656,9 +5574,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" [[package]] name = "toml_edit" @@ -5666,27 +5584,27 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.2.6", "toml_datetime", - "winnow 0.5.40", + "winnow", ] [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.2.6", "toml_datetime", - "winnow 0.6.18", + "winnow", ] [[package]] name = "tower-service" -version = "0.3.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" @@ -5708,7 +5626,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5807,15 +5725,15 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "unicode-xid" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "universal-hash" @@ -5860,9 +5778,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -5889,9 +5807,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "void" @@ -5932,35 +5850,34 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", - "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -5970,9 +5887,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5980,28 +5897,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -6040,11 +5957,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.9" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -6059,7 +5976,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.6", + "windows-targets 0.52.5", ] [[package]] @@ -6077,16 +5994,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", + "windows-targets 0.52.5", ] [[package]] @@ -6106,18 +6014,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -6128,9 +6036,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -6140,9 +6048,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -6152,15 +6060,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" [[package]] name = "windows_i686_gnullvm" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -6170,9 +6078,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -6182,9 +6090,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -6194,9 +6102,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -6206,9 +6114,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" @@ -6219,15 +6127,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winnow" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.50.0" @@ -6278,23 +6177,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -6314,7 +6212,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -6338,9 +6236,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" +version = "2.0.10+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" dependencies = [ "cc", "pkg-config", diff --git a/clients/rust/Cargo.toml b/clients/rust/Cargo.toml index 454daf7d..7f64ef21 100644 --- a/clients/rust/Cargo.toml +++ b/clients/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mpl-bubblegum" -version = "1.4.0" +version = "1.5.0" description = "Metaplex Bubblegum SDK" authors = ["Metaplex Developers "] repository = "https://github.com/metaplex-foundation/mpl-bubblegum" @@ -22,17 +22,17 @@ num-derive = "^0.3" num-traits = "^0.2" serde = { version = "^1.0", features = ["derive"], optional = true } serde_with = { version = "^3.0", optional = true } -solana-program = "^1.14" -thiserror = "^1.0" +solana-program = "~1.18.11" +thiserror = "1.0.63" [dev-dependencies] assert_matches = "1.5.0" bytemuck = "1.14.0" -solana-program-test = "^1.14" -solana-sdk = "^1.14" -spl-account-compression = { version = "0.3.1", features = ["no-entrypoint", "cpi"] } -spl-associated-token-account = { version = ">= 1.1.3, < 3.0", features = ["no-entrypoint"] } +solana-program-test = "~1.18.11" +solana-sdk = "~1.18.11" +spl-account-compression = { version = "0.4.0", features = ["no-entrypoint", "cpi"] } +spl-associated-token-account = { version = ">= 1.1.3", features = ["no-entrypoint"] } spl-concurrent-merkle-tree = "0.3.0" spl-merkle-tree-reference = "0.1.0" spl-noop = { version = "0.2.0", features = ["no-entrypoint"] } -spl-token = { version = ">= 3.5.0, < 5.0", features = ["no-entrypoint"] } +spl-token = { version = ">= 3.5.0", features = ["no-entrypoint"] } diff --git a/clients/rust/src/generated/errors/mpl_bubblegum.rs b/clients/rust/src/generated/errors/mpl_bubblegum.rs index 87dc4019..17141737 100644 --- a/clients/rust/src/generated/errors/mpl_bubblegum.rs +++ b/clients/rust/src/generated/errors/mpl_bubblegum.rs @@ -136,6 +136,36 @@ pub enum MplBubblegumError { /// 6041 (0x1799) - Canopy size should be set bigger for this tree #[error("Canopy size should be set bigger for this tree")] InvalidCanopySize, + /// 6042 (0x179A) - Not enough tokens staked to call this instruction + #[error("Not enough tokens staked to call this instruction")] + NotEnoughStakeForOperation, + /// 6043 (0x179B) - Staking registrar mismatch + #[error("Staking registrar mismatch")] + StakingRegistrarMismatch, + /// 6044 (0x179C) - Staking voter mismatch + #[error("Staking voter mismatch")] + StakingVoterMismatch, + /// 6045 (0x179D) - Fee receiver mismatch + #[error("Fee receiver mismatch")] + FeeReceiverMismatch, + /// 6046 (0x179E) - Staking registrar realm mismatch + #[error("Staking registrar realm mismatch")] + StakingRegistrarRealmMismatch, + /// 6047 (0x179F) - Staking registrar discriminator mismatch + #[error("Staking registrar discriminator mismatch")] + StakingRegistrarDiscriminatorMismatch, + /// 6048 (0x17A0) - Staking voter discriminator mismatch + #[error("Staking voter discriminator mismatch")] + StakingVoterDiscriminatorMismatch, + /// 6049 (0x17A1) - Staking voter registrar mismatch + #[error("Staking voter registrar mismatch")] + StakingVoterRegistrarMismatch, + /// 6050 (0x17A2) - Staking voter authority mismatch + #[error("Staking voter authority mismatch")] + StakingVoterAuthorityMismatch, + /// 6051 (0x17A3) - Invalid mining owner + #[error("Invalid mining owner")] + MiningOwnerMismatch, } impl solana_program::program_error::PrintProgramError for MplBubblegumError { diff --git a/clients/rust/src/generated/errors/spl_account_compression.rs b/clients/rust/src/generated/errors/spl_account_compression.rs index 9c8c7da8..494234ff 100644 --- a/clients/rust/src/generated/errors/spl_account_compression.rs +++ b/clients/rust/src/generated/errors/spl_account_compression.rs @@ -37,6 +37,21 @@ pub enum SplAccountCompressionError { /// 6008 (0x1778) - Leaf index of concurrent merkle tree is out of bounds #[error("Leaf index of concurrent merkle tree is out of bounds")] LeafIndexOutOfBounds, + /// 6009 (0x1779) - Tree was initialized without allocating space for the canopy + #[error("Tree was initialized without allocating space for the canopy")] + CanopyNotAllocated, + /// 6010 (0x177A) - Tree was already initialized + #[error("Tree was already initialized")] + TreeAlreadyInitialized, + /// 6011 (0x177B) - Tree header was not initialized for batch processing + #[error("Tree header was not initialized for batch processing")] + BatchNotInitialized, + /// 6012 (0x177C) - Canopy root does not match the root of the tree + #[error("Canopy root does not match the root of the tree")] + CanopyRootMismatch, + /// 6013 (0x177D) - Canopy contains nodes to the right of the rightmost leaf of the tree + #[error("Canopy contains nodes to the right of the rightmost leaf of the tree")] + CanopyRightmostLeafMismatch, } impl solana_program::program_error::PrintProgramError for SplAccountCompressionError { diff --git a/clients/rust/src/generated/instructions/add_canopy.rs b/clients/rust/src/generated/instructions/add_canopy.rs new file mode 100644 index 00000000..d1bb0f0d --- /dev/null +++ b/clients/rust/src/generated/instructions/add_canopy.rs @@ -0,0 +1,544 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct AddCanopy { + pub tree_config: solana_program::pubkey::Pubkey, + + pub merkle_tree: solana_program::pubkey::Pubkey, + + pub tree_creator_or_delegate: solana_program::pubkey::Pubkey, + + pub log_wrapper: solana_program::pubkey::Pubkey, + + pub compression_program: solana_program::pubkey::Pubkey, + + pub system_program: solana_program::pubkey::Pubkey, +} + +impl AddCanopy { + pub fn instruction( + &self, + args: AddCanopyInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: AddCanopyInstructionArgs, + 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_readonly( + self.tree_config, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.merkle_tree, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.tree_creator_or_delegate, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.log_wrapper, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.compression_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = AddCanopyInstructionData::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_BUBBLEGUM_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct AddCanopyInstructionData { + discriminator: [u8; 8], +} + +impl AddCanopyInstructionData { + fn new() -> Self { + Self { + discriminator: [247, 118, 145, 92, 84, 66, 207, 25], + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AddCanopyInstructionArgs { + pub start_index: u32, + pub canopy_nodes: Vec<[u8; 32]>, +} + +/// Instruction builder. +#[derive(Default)] +pub struct AddCanopyBuilder { + tree_config: Option, + merkle_tree: Option, + tree_creator_or_delegate: Option, + log_wrapper: Option, + compression_program: Option, + system_program: Option, + start_index: Option, + canopy_nodes: Option>, + __remaining_accounts: Vec, +} + +impl AddCanopyBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn tree_config(&mut self, tree_config: solana_program::pubkey::Pubkey) -> &mut Self { + self.tree_config = Some(tree_config); + self + } + #[inline(always)] + pub fn merkle_tree(&mut self, merkle_tree: solana_program::pubkey::Pubkey) -> &mut Self { + self.merkle_tree = Some(merkle_tree); + self + } + #[inline(always)] + pub fn tree_creator_or_delegate( + &mut self, + tree_creator_or_delegate: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.tree_creator_or_delegate = Some(tree_creator_or_delegate); + self + } + /// `[optional account, default to 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV']` + #[inline(always)] + pub fn log_wrapper(&mut self, log_wrapper: solana_program::pubkey::Pubkey) -> &mut Self { + self.log_wrapper = Some(log_wrapper); + self + } + /// `[optional account, default to 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK']` + #[inline(always)] + pub fn compression_program( + &mut self, + compression_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.compression_program = Some(compression_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn start_index(&mut self, start_index: u32) -> &mut Self { + self.start_index = Some(start_index); + self + } + #[inline(always)] + pub fn canopy_nodes(&mut self, canopy_nodes: Vec<[u8; 32]>) -> &mut Self { + self.canopy_nodes = Some(canopy_nodes); + 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 = AddCanopy { + tree_config: self.tree_config.expect("tree_config is not set"), + merkle_tree: self.merkle_tree.expect("merkle_tree is not set"), + tree_creator_or_delegate: self + .tree_creator_or_delegate + .expect("tree_creator_or_delegate is not set"), + log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!( + "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" + )), + compression_program: self.compression_program.unwrap_or(solana_program::pubkey!( + "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + }; + let args = AddCanopyInstructionArgs { + start_index: self.start_index.clone().expect("start_index is not set"), + canopy_nodes: self.canopy_nodes.clone().expect("canopy_nodes is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `add_canopy` CPI accounts. +pub struct AddCanopyCpiAccounts<'a, 'b> { + pub tree_config: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>, + + pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + + pub compression_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `add_canopy` CPI instruction. +pub struct AddCanopyCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_config: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>, + + pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + + pub compression_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: AddCanopyInstructionArgs, +} + +impl<'a, 'b> AddCanopyCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: AddCanopyCpiAccounts<'a, 'b>, + args: AddCanopyInstructionArgs, + ) -> Self { + Self { + __program: program, + tree_config: accounts.tree_config, + merkle_tree: accounts.merkle_tree, + tree_creator_or_delegate: accounts.tree_creator_or_delegate, + log_wrapper: accounts.log_wrapper, + compression_program: accounts.compression_program, + system_program: accounts.system_program, + __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_readonly( + *self.tree_config.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.merkle_tree.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.tree_creator_or_delegate.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.log_wrapper.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.compression_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + 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 = AddCanopyInstructionData::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_BUBBLEGUM_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.tree_config.clone()); + account_infos.push(self.merkle_tree.clone()); + account_infos.push(self.tree_creator_or_delegate.clone()); + account_infos.push(self.log_wrapper.clone()); + account_infos.push(self.compression_program.clone()); + account_infos.push(self.system_program.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) + } + } +} + +/// `add_canopy` CPI instruction builder. +pub struct AddCanopyCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> AddCanopyCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(AddCanopyCpiBuilderInstruction { + __program: program, + tree_config: None, + merkle_tree: None, + tree_creator_or_delegate: None, + log_wrapper: None, + compression_program: None, + system_program: None, + start_index: None, + canopy_nodes: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn tree_config( + &mut self, + tree_config: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.tree_config = Some(tree_config); + self + } + #[inline(always)] + pub fn merkle_tree( + &mut self, + merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.merkle_tree = Some(merkle_tree); + self + } + #[inline(always)] + pub fn tree_creator_or_delegate( + &mut self, + tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.tree_creator_or_delegate = Some(tree_creator_or_delegate); + self + } + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.log_wrapper = Some(log_wrapper); + self + } + #[inline(always)] + pub fn compression_program( + &mut self, + compression_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.compression_program = Some(compression_program); + self + } + #[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 + } + #[inline(always)] + pub fn start_index(&mut self, start_index: u32) -> &mut Self { + self.instruction.start_index = Some(start_index); + self + } + #[inline(always)] + pub fn canopy_nodes(&mut self, canopy_nodes: Vec<[u8; 32]>) -> &mut Self { + self.instruction.canopy_nodes = Some(canopy_nodes); + 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 = AddCanopyInstructionArgs { + start_index: self + .instruction + .start_index + .clone() + .expect("start_index is not set"), + canopy_nodes: self + .instruction + .canopy_nodes + .clone() + .expect("canopy_nodes is not set"), + }; + let instruction = AddCanopyCpi { + __program: self.instruction.__program, + + tree_config: self + .instruction + .tree_config + .expect("tree_config is not set"), + + merkle_tree: self + .instruction + .merkle_tree + .expect("merkle_tree is not set"), + + tree_creator_or_delegate: self + .instruction + .tree_creator_or_delegate + .expect("tree_creator_or_delegate is not set"), + + log_wrapper: self + .instruction + .log_wrapper + .expect("log_wrapper is not set"), + + compression_program: self + .instruction + .compression_program + .expect("compression_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct AddCanopyCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + tree_config: Option<&'b solana_program::account_info::AccountInfo<'a>>, + merkle_tree: Option<&'b solana_program::account_info::AccountInfo<'a>>, + tree_creator_or_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + compression_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + start_index: Option, + canopy_nodes: 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/append_canopy_nodes.rs b/clients/rust/src/generated/instructions/append_canopy_nodes.rs new file mode 100644 index 00000000..a0061b5a --- /dev/null +++ b/clients/rust/src/generated/instructions/append_canopy_nodes.rs @@ -0,0 +1,416 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct AppendCanopyNodes { + pub merkle_tree: solana_program::pubkey::Pubkey, + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + pub authority: solana_program::pubkey::Pubkey, + /// Program used to emit changelogs as cpi instruction data. + pub noop: solana_program::pubkey::Pubkey, +} + +impl AppendCanopyNodes { + pub fn instruction( + &self, + args: AppendCanopyNodesInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: AppendCanopyNodesInstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(3 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.merkle_tree, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.noop, false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = AppendCanopyNodesInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::SPL_ACCOUNT_COMPRESSION_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct AppendCanopyNodesInstructionData { + discriminator: [u8; 8], +} + +impl AppendCanopyNodesInstructionData { + fn new() -> Self { + Self { + discriminator: [139, 155, 238, 167, 11, 243, 132, 205], + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct AppendCanopyNodesInstructionArgs { + pub start_index: u32, + pub canopy_nodes: Vec<[u8; 32]>, +} + +/// Instruction builder. +#[derive(Default)] +pub struct AppendCanopyNodesBuilder { + merkle_tree: Option, + authority: Option, + noop: Option, + start_index: Option, + canopy_nodes: Option>, + __remaining_accounts: Vec, +} + +impl AppendCanopyNodesBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn merkle_tree(&mut self, merkle_tree: solana_program::pubkey::Pubkey) -> &mut Self { + self.merkle_tree = Some(merkle_tree); + self + } + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Program used to emit changelogs as cpi instruction data. + #[inline(always)] + pub fn noop(&mut self, noop: solana_program::pubkey::Pubkey) -> &mut Self { + self.noop = Some(noop); + self + } + #[inline(always)] + pub fn start_index(&mut self, start_index: u32) -> &mut Self { + self.start_index = Some(start_index); + self + } + #[inline(always)] + pub fn canopy_nodes(&mut self, canopy_nodes: Vec<[u8; 32]>) -> &mut Self { + self.canopy_nodes = Some(canopy_nodes); + 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 = AppendCanopyNodes { + merkle_tree: self.merkle_tree.expect("merkle_tree is not set"), + authority: self.authority.expect("authority is not set"), + noop: self.noop.expect("noop is not set"), + }; + let args = AppendCanopyNodesInstructionArgs { + start_index: self.start_index.clone().expect("start_index is not set"), + canopy_nodes: self.canopy_nodes.clone().expect("canopy_nodes is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `append_canopy_nodes` CPI accounts. +pub struct AppendCanopyNodesCpiAccounts<'a, 'b> { + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + pub authority: &'b solana_program::account_info::AccountInfo<'a>, + /// Program used to emit changelogs as cpi instruction data. + pub noop: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `append_canopy_nodes` CPI instruction. +pub struct AppendCanopyNodesCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + pub authority: &'b solana_program::account_info::AccountInfo<'a>, + /// Program used to emit changelogs as cpi instruction data. + pub noop: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: AppendCanopyNodesInstructionArgs, +} + +impl<'a, 'b> AppendCanopyNodesCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: AppendCanopyNodesCpiAccounts<'a, 'b>, + args: AppendCanopyNodesInstructionArgs, + ) -> Self { + Self { + __program: program, + merkle_tree: accounts.merkle_tree, + authority: accounts.authority, + noop: accounts.noop, + __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(3 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.merkle_tree.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.noop.key, + 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 = AppendCanopyNodesInstructionData::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::SPL_ACCOUNT_COMPRESSION_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(3 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.merkle_tree.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.noop.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) + } + } +} + +/// `append_canopy_nodes` CPI instruction builder. +pub struct AppendCanopyNodesCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> AppendCanopyNodesCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(AppendCanopyNodesCpiBuilderInstruction { + __program: program, + merkle_tree: None, + authority: None, + noop: None, + start_index: None, + canopy_nodes: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn merkle_tree( + &mut self, + merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.merkle_tree = Some(merkle_tree); + self + } + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + #[inline(always)] + pub fn authority( + &mut self, + authority: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Program used to emit changelogs as cpi instruction data. + #[inline(always)] + pub fn noop(&mut self, noop: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.noop = Some(noop); + self + } + #[inline(always)] + pub fn start_index(&mut self, start_index: u32) -> &mut Self { + self.instruction.start_index = Some(start_index); + self + } + #[inline(always)] + pub fn canopy_nodes(&mut self, canopy_nodes: Vec<[u8; 32]>) -> &mut Self { + self.instruction.canopy_nodes = Some(canopy_nodes); + 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 = AppendCanopyNodesInstructionArgs { + start_index: self + .instruction + .start_index + .clone() + .expect("start_index is not set"), + canopy_nodes: self + .instruction + .canopy_nodes + .clone() + .expect("canopy_nodes is not set"), + }; + let instruction = AppendCanopyNodesCpi { + __program: self.instruction.__program, + + merkle_tree: self + .instruction + .merkle_tree + .expect("merkle_tree is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + noop: self.instruction.noop.expect("noop is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct AppendCanopyNodesCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + merkle_tree: Option<&'b solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + noop: Option<&'b solana_program::account_info::AccountInfo<'a>>, + start_index: Option, + canopy_nodes: 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/finalize_tree_with_root.rs b/clients/rust/src/generated/instructions/finalize_tree_with_root.rs new file mode 100644 index 00000000..68be995f --- /dev/null +++ b/clients/rust/src/generated/instructions/finalize_tree_with_root.rs @@ -0,0 +1,818 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct FinalizeTreeWithRoot { + pub tree_config: solana_program::pubkey::Pubkey, + + pub merkle_tree: solana_program::pubkey::Pubkey, + + pub payer: solana_program::pubkey::Pubkey, + + pub tree_creator_or_delegate: solana_program::pubkey::Pubkey, + + pub staker: solana_program::pubkey::Pubkey, + + pub registrar: solana_program::pubkey::Pubkey, + + pub voter: solana_program::pubkey::Pubkey, + + pub mining: solana_program::pubkey::Pubkey, + + pub fee_receiver: solana_program::pubkey::Pubkey, + + pub log_wrapper: solana_program::pubkey::Pubkey, + + pub compression_program: solana_program::pubkey::Pubkey, + + pub system_program: solana_program::pubkey::Pubkey, +} + +impl FinalizeTreeWithRoot { + pub fn instruction( + &self, + args: FinalizeTreeWithRootInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: FinalizeTreeWithRootInstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(12 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.tree_config, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.merkle_tree, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.tree_creator_or_delegate, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.staker, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.registrar, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.voter, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mining, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.fee_receiver, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.log_wrapper, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.compression_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = FinalizeTreeWithRootInstructionData::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_BUBBLEGUM_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct FinalizeTreeWithRootInstructionData { + discriminator: [u8; 8], +} + +impl FinalizeTreeWithRootInstructionData { + fn new() -> Self { + Self { + discriminator: [77, 73, 220, 153, 126, 225, 64, 204], + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct FinalizeTreeWithRootInstructionArgs { + pub root: [u8; 32], + pub rightmost_leaf: [u8; 32], + pub rightmost_index: u32, + pub metadata_url: String, + pub metadata_hash: String, +} + +/// Instruction builder. +#[derive(Default)] +pub struct FinalizeTreeWithRootBuilder { + tree_config: Option, + merkle_tree: Option, + payer: Option, + tree_creator_or_delegate: Option, + staker: Option, + registrar: Option, + voter: Option, + mining: Option, + fee_receiver: Option, + log_wrapper: Option, + compression_program: Option, + system_program: Option, + root: Option<[u8; 32]>, + rightmost_leaf: Option<[u8; 32]>, + rightmost_index: Option, + metadata_url: Option, + metadata_hash: Option, + __remaining_accounts: Vec, +} + +impl FinalizeTreeWithRootBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn tree_config(&mut self, tree_config: solana_program::pubkey::Pubkey) -> &mut Self { + self.tree_config = Some(tree_config); + self + } + #[inline(always)] + pub fn merkle_tree(&mut self, merkle_tree: solana_program::pubkey::Pubkey) -> &mut Self { + self.merkle_tree = Some(merkle_tree); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + #[inline(always)] + pub fn tree_creator_or_delegate( + &mut self, + tree_creator_or_delegate: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.tree_creator_or_delegate = Some(tree_creator_or_delegate); + self + } + #[inline(always)] + pub fn staker(&mut self, staker: solana_program::pubkey::Pubkey) -> &mut Self { + self.staker = Some(staker); + self + } + #[inline(always)] + pub fn registrar(&mut self, registrar: solana_program::pubkey::Pubkey) -> &mut Self { + self.registrar = Some(registrar); + self + } + #[inline(always)] + pub fn voter(&mut self, voter: solana_program::pubkey::Pubkey) -> &mut Self { + self.voter = Some(voter); + self + } + #[inline(always)] + pub fn mining(&mut self, mining: solana_program::pubkey::Pubkey) -> &mut Self { + self.mining = Some(mining); + self + } + #[inline(always)] + pub fn fee_receiver(&mut self, fee_receiver: solana_program::pubkey::Pubkey) -> &mut Self { + self.fee_receiver = Some(fee_receiver); + self + } + /// `[optional account, default to 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV']` + #[inline(always)] + pub fn log_wrapper(&mut self, log_wrapper: solana_program::pubkey::Pubkey) -> &mut Self { + self.log_wrapper = Some(log_wrapper); + self + } + /// `[optional account, default to 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK']` + #[inline(always)] + pub fn compression_program( + &mut self, + compression_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.compression_program = Some(compression_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn root(&mut self, root: [u8; 32]) -> &mut Self { + self.root = Some(root); + self + } + #[inline(always)] + pub fn rightmost_leaf(&mut self, rightmost_leaf: [u8; 32]) -> &mut Self { + self.rightmost_leaf = Some(rightmost_leaf); + self + } + #[inline(always)] + pub fn rightmost_index(&mut self, rightmost_index: u32) -> &mut Self { + self.rightmost_index = Some(rightmost_index); + self + } + #[inline(always)] + pub fn metadata_url(&mut self, metadata_url: String) -> &mut Self { + self.metadata_url = Some(metadata_url); + self + } + #[inline(always)] + pub fn metadata_hash(&mut self, metadata_hash: String) -> &mut Self { + self.metadata_hash = Some(metadata_hash); + 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 = FinalizeTreeWithRoot { + tree_config: self.tree_config.expect("tree_config is not set"), + merkle_tree: self.merkle_tree.expect("merkle_tree is not set"), + payer: self.payer.expect("payer is not set"), + tree_creator_or_delegate: self + .tree_creator_or_delegate + .expect("tree_creator_or_delegate is not set"), + staker: self.staker.expect("staker is not set"), + registrar: self.registrar.expect("registrar is not set"), + voter: self.voter.expect("voter is not set"), + mining: self.mining.expect("mining is not set"), + fee_receiver: self.fee_receiver.expect("fee_receiver is not set"), + log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!( + "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" + )), + compression_program: self.compression_program.unwrap_or(solana_program::pubkey!( + "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + }; + let args = FinalizeTreeWithRootInstructionArgs { + root: self.root.clone().expect("root is not set"), + rightmost_leaf: self + .rightmost_leaf + .clone() + .expect("rightmost_leaf is not set"), + rightmost_index: self + .rightmost_index + .clone() + .expect("rightmost_index is not set"), + metadata_url: self.metadata_url.clone().expect("metadata_url is not set"), + metadata_hash: self + .metadata_hash + .clone() + .expect("metadata_hash is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `finalize_tree_with_root` CPI accounts. +pub struct FinalizeTreeWithRootCpiAccounts<'a, 'b> { + pub tree_config: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>, + + pub staker: &'b solana_program::account_info::AccountInfo<'a>, + + pub registrar: &'b solana_program::account_info::AccountInfo<'a>, + + pub voter: &'b solana_program::account_info::AccountInfo<'a>, + + pub mining: &'b solana_program::account_info::AccountInfo<'a>, + + pub fee_receiver: &'b solana_program::account_info::AccountInfo<'a>, + + pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + + pub compression_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `finalize_tree_with_root` CPI instruction. +pub struct FinalizeTreeWithRootCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_config: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>, + + pub staker: &'b solana_program::account_info::AccountInfo<'a>, + + pub registrar: &'b solana_program::account_info::AccountInfo<'a>, + + pub voter: &'b solana_program::account_info::AccountInfo<'a>, + + pub mining: &'b solana_program::account_info::AccountInfo<'a>, + + pub fee_receiver: &'b solana_program::account_info::AccountInfo<'a>, + + pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + + pub compression_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: FinalizeTreeWithRootInstructionArgs, +} + +impl<'a, 'b> FinalizeTreeWithRootCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: FinalizeTreeWithRootCpiAccounts<'a, 'b>, + args: FinalizeTreeWithRootInstructionArgs, + ) -> Self { + Self { + __program: program, + tree_config: accounts.tree_config, + merkle_tree: accounts.merkle_tree, + payer: accounts.payer, + tree_creator_or_delegate: accounts.tree_creator_or_delegate, + staker: accounts.staker, + registrar: accounts.registrar, + voter: accounts.voter, + mining: accounts.mining, + fee_receiver: accounts.fee_receiver, + log_wrapper: accounts.log_wrapper, + compression_program: accounts.compression_program, + system_program: accounts.system_program, + __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(12 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.tree_config.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.merkle_tree.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.tree_creator_or_delegate.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.staker.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.registrar.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.voter.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mining.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.fee_receiver.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.log_wrapper.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.compression_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + 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 = FinalizeTreeWithRootInstructionData::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_BUBBLEGUM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(12 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.tree_config.clone()); + account_infos.push(self.merkle_tree.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.tree_creator_or_delegate.clone()); + account_infos.push(self.staker.clone()); + account_infos.push(self.registrar.clone()); + account_infos.push(self.voter.clone()); + account_infos.push(self.mining.clone()); + account_infos.push(self.fee_receiver.clone()); + account_infos.push(self.log_wrapper.clone()); + account_infos.push(self.compression_program.clone()); + account_infos.push(self.system_program.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) + } + } +} + +/// `finalize_tree_with_root` CPI instruction builder. +pub struct FinalizeTreeWithRootCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> FinalizeTreeWithRootCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(FinalizeTreeWithRootCpiBuilderInstruction { + __program: program, + tree_config: None, + merkle_tree: None, + payer: None, + tree_creator_or_delegate: None, + staker: None, + registrar: None, + voter: None, + mining: None, + fee_receiver: None, + log_wrapper: None, + compression_program: None, + system_program: None, + root: None, + rightmost_leaf: None, + rightmost_index: None, + metadata_url: None, + metadata_hash: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn tree_config( + &mut self, + tree_config: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.tree_config = Some(tree_config); + self + } + #[inline(always)] + pub fn merkle_tree( + &mut self, + merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.merkle_tree = Some(merkle_tree); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + #[inline(always)] + pub fn tree_creator_or_delegate( + &mut self, + tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.tree_creator_or_delegate = Some(tree_creator_or_delegate); + self + } + #[inline(always)] + pub fn staker( + &mut self, + staker: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.staker = Some(staker); + self + } + #[inline(always)] + pub fn registrar( + &mut self, + registrar: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.registrar = Some(registrar); + self + } + #[inline(always)] + pub fn voter(&mut self, voter: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.voter = Some(voter); + self + } + #[inline(always)] + pub fn mining( + &mut self, + mining: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mining = Some(mining); + self + } + #[inline(always)] + pub fn fee_receiver( + &mut self, + fee_receiver: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_receiver = Some(fee_receiver); + self + } + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.log_wrapper = Some(log_wrapper); + self + } + #[inline(always)] + pub fn compression_program( + &mut self, + compression_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.compression_program = Some(compression_program); + self + } + #[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 + } + #[inline(always)] + pub fn root(&mut self, root: [u8; 32]) -> &mut Self { + self.instruction.root = Some(root); + self + } + #[inline(always)] + pub fn rightmost_leaf(&mut self, rightmost_leaf: [u8; 32]) -> &mut Self { + self.instruction.rightmost_leaf = Some(rightmost_leaf); + self + } + #[inline(always)] + pub fn rightmost_index(&mut self, rightmost_index: u32) -> &mut Self { + self.instruction.rightmost_index = Some(rightmost_index); + self + } + #[inline(always)] + pub fn metadata_url(&mut self, metadata_url: String) -> &mut Self { + self.instruction.metadata_url = Some(metadata_url); + self + } + #[inline(always)] + pub fn metadata_hash(&mut self, metadata_hash: String) -> &mut Self { + self.instruction.metadata_hash = Some(metadata_hash); + 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 = FinalizeTreeWithRootInstructionArgs { + root: self.instruction.root.clone().expect("root is not set"), + rightmost_leaf: self + .instruction + .rightmost_leaf + .clone() + .expect("rightmost_leaf is not set"), + rightmost_index: self + .instruction + .rightmost_index + .clone() + .expect("rightmost_index is not set"), + metadata_url: self + .instruction + .metadata_url + .clone() + .expect("metadata_url is not set"), + metadata_hash: self + .instruction + .metadata_hash + .clone() + .expect("metadata_hash is not set"), + }; + let instruction = FinalizeTreeWithRootCpi { + __program: self.instruction.__program, + + tree_config: self + .instruction + .tree_config + .expect("tree_config is not set"), + + merkle_tree: self + .instruction + .merkle_tree + .expect("merkle_tree is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + tree_creator_or_delegate: self + .instruction + .tree_creator_or_delegate + .expect("tree_creator_or_delegate is not set"), + + staker: self.instruction.staker.expect("staker is not set"), + + registrar: self.instruction.registrar.expect("registrar is not set"), + + voter: self.instruction.voter.expect("voter is not set"), + + mining: self.instruction.mining.expect("mining is not set"), + + fee_receiver: self + .instruction + .fee_receiver + .expect("fee_receiver is not set"), + + log_wrapper: self + .instruction + .log_wrapper + .expect("log_wrapper is not set"), + + compression_program: self + .instruction + .compression_program + .expect("compression_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct FinalizeTreeWithRootCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + tree_config: Option<&'b solana_program::account_info::AccountInfo<'a>>, + merkle_tree: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + tree_creator_or_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>, + staker: Option<&'b solana_program::account_info::AccountInfo<'a>>, + registrar: Option<&'b solana_program::account_info::AccountInfo<'a>>, + voter: Option<&'b solana_program::account_info::AccountInfo<'a>>, + mining: Option<&'b solana_program::account_info::AccountInfo<'a>>, + fee_receiver: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + compression_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + root: Option<[u8; 32]>, + rightmost_leaf: Option<[u8; 32]>, + rightmost_index: Option, + metadata_url: Option, + metadata_hash: 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/finalize_tree_with_root_and_collection.rs b/clients/rust/src/generated/instructions/finalize_tree_with_root_and_collection.rs new file mode 100644 index 00000000..f4652233 --- /dev/null +++ b/clients/rust/src/generated/instructions/finalize_tree_with_root_and_collection.rs @@ -0,0 +1,1051 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct FinalizeTreeWithRootAndCollection { + pub tree_config: solana_program::pubkey::Pubkey, + + pub merkle_tree: solana_program::pubkey::Pubkey, + + pub payer: solana_program::pubkey::Pubkey, + + pub tree_creator_or_delegate: solana_program::pubkey::Pubkey, + + pub staker: solana_program::pubkey::Pubkey, + + pub collection_authority: solana_program::pubkey::Pubkey, + + pub registrar: solana_program::pubkey::Pubkey, + + pub voter: solana_program::pubkey::Pubkey, + + pub mining: solana_program::pubkey::Pubkey, + + pub fee_receiver: solana_program::pubkey::Pubkey, + /// If there is no collecton authority record PDA then + /// this must be the Bubblegum program address. + pub collection_authority_record_pda: Option, + + pub collection_mint: solana_program::pubkey::Pubkey, + + pub collection_metadata: solana_program::pubkey::Pubkey, + + pub collection_edition: solana_program::pubkey::Pubkey, + + pub log_wrapper: solana_program::pubkey::Pubkey, + + pub compression_program: solana_program::pubkey::Pubkey, + + pub system_program: solana_program::pubkey::Pubkey, +} + +impl FinalizeTreeWithRootAndCollection { + pub fn instruction( + &self, + args: FinalizeTreeWithRootAndCollectionInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: FinalizeTreeWithRootAndCollectionInstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(17 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.tree_config, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.merkle_tree, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.tree_creator_or_delegate, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.staker, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.registrar, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.voter, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mining, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.fee_receiver, + false, + )); + if let Some(collection_authority_record_pda) = self.collection_authority_record_pda { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + collection_authority_record_pda, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_BUBBLEGUM_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_mint, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.collection_metadata, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.collection_edition, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.log_wrapper, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.compression_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = FinalizeTreeWithRootAndCollectionInstructionData::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_BUBBLEGUM_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct FinalizeTreeWithRootAndCollectionInstructionData { + discriminator: [u8; 8], +} + +impl FinalizeTreeWithRootAndCollectionInstructionData { + fn new() -> Self { + Self { + discriminator: [194, 98, 45, 168, 183, 72, 67, 155], + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct FinalizeTreeWithRootAndCollectionInstructionArgs { + pub root: [u8; 32], + pub rightmost_leaf: [u8; 32], + pub rightmost_index: u32, + pub metadata_url: String, + pub metadata_hash: String, +} + +/// Instruction builder. +#[derive(Default)] +pub struct FinalizeTreeWithRootAndCollectionBuilder { + tree_config: Option, + merkle_tree: Option, + payer: Option, + tree_creator_or_delegate: Option, + staker: Option, + collection_authority: Option, + registrar: Option, + voter: Option, + mining: Option, + fee_receiver: Option, + collection_authority_record_pda: Option, + collection_mint: Option, + collection_metadata: Option, + collection_edition: Option, + log_wrapper: Option, + compression_program: Option, + system_program: Option, + root: Option<[u8; 32]>, + rightmost_leaf: Option<[u8; 32]>, + rightmost_index: Option, + metadata_url: Option, + metadata_hash: Option, + __remaining_accounts: Vec, +} + +impl FinalizeTreeWithRootAndCollectionBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn tree_config(&mut self, tree_config: solana_program::pubkey::Pubkey) -> &mut Self { + self.tree_config = Some(tree_config); + self + } + #[inline(always)] + pub fn merkle_tree(&mut self, merkle_tree: solana_program::pubkey::Pubkey) -> &mut Self { + self.merkle_tree = Some(merkle_tree); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + #[inline(always)] + pub fn tree_creator_or_delegate( + &mut self, + tree_creator_or_delegate: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.tree_creator_or_delegate = Some(tree_creator_or_delegate); + self + } + #[inline(always)] + pub fn staker(&mut self, staker: solana_program::pubkey::Pubkey) -> &mut Self { + self.staker = Some(staker); + self + } + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_authority = Some(collection_authority); + self + } + #[inline(always)] + pub fn registrar(&mut self, registrar: solana_program::pubkey::Pubkey) -> &mut Self { + self.registrar = Some(registrar); + self + } + #[inline(always)] + pub fn voter(&mut self, voter: solana_program::pubkey::Pubkey) -> &mut Self { + self.voter = Some(voter); + self + } + #[inline(always)] + pub fn mining(&mut self, mining: solana_program::pubkey::Pubkey) -> &mut Self { + self.mining = Some(mining); + self + } + #[inline(always)] + pub fn fee_receiver(&mut self, fee_receiver: solana_program::pubkey::Pubkey) -> &mut Self { + self.fee_receiver = Some(fee_receiver); + self + } + /// `[optional account]` + /// If there is no collecton authority record PDA then + /// this must be the Bubblegum program address. + #[inline(always)] + pub fn collection_authority_record_pda( + &mut self, + collection_authority_record_pda: Option, + ) -> &mut Self { + self.collection_authority_record_pda = collection_authority_record_pda; + self + } + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_mint = Some(collection_mint); + self + } + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_metadata = Some(collection_metadata); + self + } + #[inline(always)] + pub fn collection_edition( + &mut self, + collection_edition: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.collection_edition = Some(collection_edition); + self + } + /// `[optional account, default to 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV']` + #[inline(always)] + pub fn log_wrapper(&mut self, log_wrapper: solana_program::pubkey::Pubkey) -> &mut Self { + self.log_wrapper = Some(log_wrapper); + self + } + /// `[optional account, default to 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK']` + #[inline(always)] + pub fn compression_program( + &mut self, + compression_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.compression_program = Some(compression_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn root(&mut self, root: [u8; 32]) -> &mut Self { + self.root = Some(root); + self + } + #[inline(always)] + pub fn rightmost_leaf(&mut self, rightmost_leaf: [u8; 32]) -> &mut Self { + self.rightmost_leaf = Some(rightmost_leaf); + self + } + #[inline(always)] + pub fn rightmost_index(&mut self, rightmost_index: u32) -> &mut Self { + self.rightmost_index = Some(rightmost_index); + self + } + #[inline(always)] + pub fn metadata_url(&mut self, metadata_url: String) -> &mut Self { + self.metadata_url = Some(metadata_url); + self + } + #[inline(always)] + pub fn metadata_hash(&mut self, metadata_hash: String) -> &mut Self { + self.metadata_hash = Some(metadata_hash); + 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 = FinalizeTreeWithRootAndCollection { + tree_config: self.tree_config.expect("tree_config is not set"), + merkle_tree: self.merkle_tree.expect("merkle_tree is not set"), + payer: self.payer.expect("payer is not set"), + tree_creator_or_delegate: self + .tree_creator_or_delegate + .expect("tree_creator_or_delegate is not set"), + staker: self.staker.expect("staker is not set"), + collection_authority: self + .collection_authority + .expect("collection_authority is not set"), + registrar: self.registrar.expect("registrar is not set"), + voter: self.voter.expect("voter is not set"), + mining: self.mining.expect("mining is not set"), + fee_receiver: self.fee_receiver.expect("fee_receiver is not set"), + collection_authority_record_pda: self.collection_authority_record_pda, + collection_mint: self.collection_mint.expect("collection_mint is not set"), + collection_metadata: self + .collection_metadata + .expect("collection_metadata is not set"), + collection_edition: self + .collection_edition + .expect("collection_edition is not set"), + log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!( + "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" + )), + compression_program: self.compression_program.unwrap_or(solana_program::pubkey!( + "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + }; + let args = FinalizeTreeWithRootAndCollectionInstructionArgs { + root: self.root.clone().expect("root is not set"), + rightmost_leaf: self + .rightmost_leaf + .clone() + .expect("rightmost_leaf is not set"), + rightmost_index: self + .rightmost_index + .clone() + .expect("rightmost_index is not set"), + metadata_url: self.metadata_url.clone().expect("metadata_url is not set"), + metadata_hash: self + .metadata_hash + .clone() + .expect("metadata_hash is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `finalize_tree_with_root_and_collection` CPI accounts. +pub struct FinalizeTreeWithRootAndCollectionCpiAccounts<'a, 'b> { + pub tree_config: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>, + + pub staker: &'b solana_program::account_info::AccountInfo<'a>, + + pub collection_authority: &'b solana_program::account_info::AccountInfo<'a>, + + pub registrar: &'b solana_program::account_info::AccountInfo<'a>, + + pub voter: &'b solana_program::account_info::AccountInfo<'a>, + + pub mining: &'b solana_program::account_info::AccountInfo<'a>, + + pub fee_receiver: &'b solana_program::account_info::AccountInfo<'a>, + /// If there is no collecton authority record PDA then + /// this must be the Bubblegum program address. + pub collection_authority_record_pda: Option<&'b solana_program::account_info::AccountInfo<'a>>, + + pub collection_mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub collection_metadata: &'b solana_program::account_info::AccountInfo<'a>, + + pub collection_edition: &'b solana_program::account_info::AccountInfo<'a>, + + pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + + pub compression_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `finalize_tree_with_root_and_collection` CPI instruction. +pub struct FinalizeTreeWithRootAndCollectionCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_config: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>, + + pub staker: &'b solana_program::account_info::AccountInfo<'a>, + + pub collection_authority: &'b solana_program::account_info::AccountInfo<'a>, + + pub registrar: &'b solana_program::account_info::AccountInfo<'a>, + + pub voter: &'b solana_program::account_info::AccountInfo<'a>, + + pub mining: &'b solana_program::account_info::AccountInfo<'a>, + + pub fee_receiver: &'b solana_program::account_info::AccountInfo<'a>, + /// If there is no collecton authority record PDA then + /// this must be the Bubblegum program address. + pub collection_authority_record_pda: Option<&'b solana_program::account_info::AccountInfo<'a>>, + + pub collection_mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub collection_metadata: &'b solana_program::account_info::AccountInfo<'a>, + + pub collection_edition: &'b solana_program::account_info::AccountInfo<'a>, + + pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + + pub compression_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: FinalizeTreeWithRootAndCollectionInstructionArgs, +} + +impl<'a, 'b> FinalizeTreeWithRootAndCollectionCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: FinalizeTreeWithRootAndCollectionCpiAccounts<'a, 'b>, + args: FinalizeTreeWithRootAndCollectionInstructionArgs, + ) -> Self { + Self { + __program: program, + tree_config: accounts.tree_config, + merkle_tree: accounts.merkle_tree, + payer: accounts.payer, + tree_creator_or_delegate: accounts.tree_creator_or_delegate, + staker: accounts.staker, + collection_authority: accounts.collection_authority, + registrar: accounts.registrar, + voter: accounts.voter, + mining: accounts.mining, + fee_receiver: accounts.fee_receiver, + collection_authority_record_pda: accounts.collection_authority_record_pda, + collection_mint: accounts.collection_mint, + collection_metadata: accounts.collection_metadata, + collection_edition: accounts.collection_edition, + log_wrapper: accounts.log_wrapper, + compression_program: accounts.compression_program, + system_program: accounts.system_program, + __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(17 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.tree_config.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.merkle_tree.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.tree_creator_or_delegate.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.staker.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.registrar.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.voter.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mining.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.fee_receiver.key, + false, + )); + if let Some(collection_authority_record_pda) = self.collection_authority_record_pda { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *collection_authority_record_pda.key, + false, + )); + } else { + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + crate::MPL_BUBBLEGUM_ID, + false, + )); + } + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.collection_metadata.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.collection_edition.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.log_wrapper.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.compression_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + 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 = FinalizeTreeWithRootAndCollectionInstructionData::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_BUBBLEGUM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(17 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.tree_config.clone()); + account_infos.push(self.merkle_tree.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.tree_creator_or_delegate.clone()); + account_infos.push(self.staker.clone()); + account_infos.push(self.collection_authority.clone()); + account_infos.push(self.registrar.clone()); + account_infos.push(self.voter.clone()); + account_infos.push(self.mining.clone()); + account_infos.push(self.fee_receiver.clone()); + if let Some(collection_authority_record_pda) = self.collection_authority_record_pda { + account_infos.push(collection_authority_record_pda.clone()); + } + account_infos.push(self.collection_mint.clone()); + account_infos.push(self.collection_metadata.clone()); + account_infos.push(self.collection_edition.clone()); + account_infos.push(self.log_wrapper.clone()); + account_infos.push(self.compression_program.clone()); + account_infos.push(self.system_program.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) + } + } +} + +/// `finalize_tree_with_root_and_collection` CPI instruction builder. +pub struct FinalizeTreeWithRootAndCollectionCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> FinalizeTreeWithRootAndCollectionCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(FinalizeTreeWithRootAndCollectionCpiBuilderInstruction { + __program: program, + tree_config: None, + merkle_tree: None, + payer: None, + tree_creator_or_delegate: None, + staker: None, + collection_authority: None, + registrar: None, + voter: None, + mining: None, + fee_receiver: None, + collection_authority_record_pda: None, + collection_mint: None, + collection_metadata: None, + collection_edition: None, + log_wrapper: None, + compression_program: None, + system_program: None, + root: None, + rightmost_leaf: None, + rightmost_index: None, + metadata_url: None, + metadata_hash: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn tree_config( + &mut self, + tree_config: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.tree_config = Some(tree_config); + self + } + #[inline(always)] + pub fn merkle_tree( + &mut self, + merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.merkle_tree = Some(merkle_tree); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + #[inline(always)] + pub fn tree_creator_or_delegate( + &mut self, + tree_creator_or_delegate: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.tree_creator_or_delegate = Some(tree_creator_or_delegate); + self + } + #[inline(always)] + pub fn staker( + &mut self, + staker: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.staker = Some(staker); + self + } + #[inline(always)] + pub fn collection_authority( + &mut self, + collection_authority: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_authority = Some(collection_authority); + self + } + #[inline(always)] + pub fn registrar( + &mut self, + registrar: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.registrar = Some(registrar); + self + } + #[inline(always)] + pub fn voter(&mut self, voter: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.voter = Some(voter); + self + } + #[inline(always)] + pub fn mining( + &mut self, + mining: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mining = Some(mining); + self + } + #[inline(always)] + pub fn fee_receiver( + &mut self, + fee_receiver: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.fee_receiver = Some(fee_receiver); + self + } + /// `[optional account]` + /// If there is no collecton authority record PDA then + /// this must be the Bubblegum program address. + #[inline(always)] + pub fn collection_authority_record_pda( + &mut self, + collection_authority_record_pda: Option<&'b solana_program::account_info::AccountInfo<'a>>, + ) -> &mut Self { + self.instruction.collection_authority_record_pda = collection_authority_record_pda; + self + } + #[inline(always)] + pub fn collection_mint( + &mut self, + collection_mint: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_mint = Some(collection_mint); + self + } + #[inline(always)] + pub fn collection_metadata( + &mut self, + collection_metadata: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_metadata = Some(collection_metadata); + self + } + #[inline(always)] + pub fn collection_edition( + &mut self, + collection_edition: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.collection_edition = Some(collection_edition); + self + } + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.log_wrapper = Some(log_wrapper); + self + } + #[inline(always)] + pub fn compression_program( + &mut self, + compression_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.compression_program = Some(compression_program); + self + } + #[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 + } + #[inline(always)] + pub fn root(&mut self, root: [u8; 32]) -> &mut Self { + self.instruction.root = Some(root); + self + } + #[inline(always)] + pub fn rightmost_leaf(&mut self, rightmost_leaf: [u8; 32]) -> &mut Self { + self.instruction.rightmost_leaf = Some(rightmost_leaf); + self + } + #[inline(always)] + pub fn rightmost_index(&mut self, rightmost_index: u32) -> &mut Self { + self.instruction.rightmost_index = Some(rightmost_index); + self + } + #[inline(always)] + pub fn metadata_url(&mut self, metadata_url: String) -> &mut Self { + self.instruction.metadata_url = Some(metadata_url); + self + } + #[inline(always)] + pub fn metadata_hash(&mut self, metadata_hash: String) -> &mut Self { + self.instruction.metadata_hash = Some(metadata_hash); + 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 = FinalizeTreeWithRootAndCollectionInstructionArgs { + root: self.instruction.root.clone().expect("root is not set"), + rightmost_leaf: self + .instruction + .rightmost_leaf + .clone() + .expect("rightmost_leaf is not set"), + rightmost_index: self + .instruction + .rightmost_index + .clone() + .expect("rightmost_index is not set"), + metadata_url: self + .instruction + .metadata_url + .clone() + .expect("metadata_url is not set"), + metadata_hash: self + .instruction + .metadata_hash + .clone() + .expect("metadata_hash is not set"), + }; + let instruction = FinalizeTreeWithRootAndCollectionCpi { + __program: self.instruction.__program, + + tree_config: self + .instruction + .tree_config + .expect("tree_config is not set"), + + merkle_tree: self + .instruction + .merkle_tree + .expect("merkle_tree is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + tree_creator_or_delegate: self + .instruction + .tree_creator_or_delegate + .expect("tree_creator_or_delegate is not set"), + + staker: self.instruction.staker.expect("staker is not set"), + + collection_authority: self + .instruction + .collection_authority + .expect("collection_authority is not set"), + + registrar: self.instruction.registrar.expect("registrar is not set"), + + voter: self.instruction.voter.expect("voter is not set"), + + mining: self.instruction.mining.expect("mining is not set"), + + fee_receiver: self + .instruction + .fee_receiver + .expect("fee_receiver is not set"), + + collection_authority_record_pda: self.instruction.collection_authority_record_pda, + + collection_mint: self + .instruction + .collection_mint + .expect("collection_mint is not set"), + + collection_metadata: self + .instruction + .collection_metadata + .expect("collection_metadata is not set"), + + collection_edition: self + .instruction + .collection_edition + .expect("collection_edition is not set"), + + log_wrapper: self + .instruction + .log_wrapper + .expect("log_wrapper is not set"), + + compression_program: self + .instruction + .compression_program + .expect("compression_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct FinalizeTreeWithRootAndCollectionCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + tree_config: Option<&'b solana_program::account_info::AccountInfo<'a>>, + merkle_tree: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + tree_creator_or_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>, + staker: Option<&'b solana_program::account_info::AccountInfo<'a>>, + collection_authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + registrar: Option<&'b solana_program::account_info::AccountInfo<'a>>, + voter: Option<&'b solana_program::account_info::AccountInfo<'a>>, + mining: Option<&'b solana_program::account_info::AccountInfo<'a>>, + fee_receiver: Option<&'b solana_program::account_info::AccountInfo<'a>>, + collection_authority_record_pda: Option<&'b solana_program::account_info::AccountInfo<'a>>, + collection_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>, + collection_metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>, + collection_edition: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + compression_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + root: Option<[u8; 32]>, + rightmost_leaf: Option<[u8; 32]>, + rightmost_index: Option, + metadata_url: Option, + metadata_hash: 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/init_prepared_tree_with_root.rs b/clients/rust/src/generated/instructions/init_prepared_tree_with_root.rs new file mode 100644 index 00000000..4479bef0 --- /dev/null +++ b/clients/rust/src/generated/instructions/init_prepared_tree_with_root.rs @@ -0,0 +1,438 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct InitPreparedTreeWithRoot { + pub merkle_tree: solana_program::pubkey::Pubkey, + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + pub authority: solana_program::pubkey::Pubkey, + /// Program used to emit changelogs as cpi instruction data. + pub noop: solana_program::pubkey::Pubkey, +} + +impl InitPreparedTreeWithRoot { + pub fn instruction( + &self, + args: InitPreparedTreeWithRootInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: InitPreparedTreeWithRootInstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(3 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.merkle_tree, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.noop, false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = InitPreparedTreeWithRootInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::SPL_ACCOUNT_COMPRESSION_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct InitPreparedTreeWithRootInstructionData { + discriminator: [u8; 8], +} + +impl InitPreparedTreeWithRootInstructionData { + fn new() -> Self { + Self { + discriminator: [218, 248, 192, 55, 91, 205, 122, 10], + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct InitPreparedTreeWithRootInstructionArgs { + pub root: [u8; 32], + pub rightmost_leaf: [u8; 32], + pub rightmost_index: u32, +} + +/// Instruction builder. +#[derive(Default)] +pub struct InitPreparedTreeWithRootBuilder { + merkle_tree: Option, + authority: Option, + noop: Option, + root: Option<[u8; 32]>, + rightmost_leaf: Option<[u8; 32]>, + rightmost_index: Option, + __remaining_accounts: Vec, +} + +impl InitPreparedTreeWithRootBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn merkle_tree(&mut self, merkle_tree: solana_program::pubkey::Pubkey) -> &mut Self { + self.merkle_tree = Some(merkle_tree); + self + } + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Program used to emit changelogs as cpi instruction data. + #[inline(always)] + pub fn noop(&mut self, noop: solana_program::pubkey::Pubkey) -> &mut Self { + self.noop = Some(noop); + self + } + #[inline(always)] + pub fn root(&mut self, root: [u8; 32]) -> &mut Self { + self.root = Some(root); + self + } + #[inline(always)] + pub fn rightmost_leaf(&mut self, rightmost_leaf: [u8; 32]) -> &mut Self { + self.rightmost_leaf = Some(rightmost_leaf); + self + } + #[inline(always)] + pub fn rightmost_index(&mut self, rightmost_index: u32) -> &mut Self { + self.rightmost_index = Some(rightmost_index); + 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 = InitPreparedTreeWithRoot { + merkle_tree: self.merkle_tree.expect("merkle_tree is not set"), + authority: self.authority.expect("authority is not set"), + noop: self.noop.expect("noop is not set"), + }; + let args = InitPreparedTreeWithRootInstructionArgs { + root: self.root.clone().expect("root is not set"), + rightmost_leaf: self + .rightmost_leaf + .clone() + .expect("rightmost_leaf is not set"), + rightmost_index: self + .rightmost_index + .clone() + .expect("rightmost_index is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `init_prepared_tree_with_root` CPI accounts. +pub struct InitPreparedTreeWithRootCpiAccounts<'a, 'b> { + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + pub authority: &'b solana_program::account_info::AccountInfo<'a>, + /// Program used to emit changelogs as cpi instruction data. + pub noop: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `init_prepared_tree_with_root` CPI instruction. +pub struct InitPreparedTreeWithRootCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + pub authority: &'b solana_program::account_info::AccountInfo<'a>, + /// Program used to emit changelogs as cpi instruction data. + pub noop: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: InitPreparedTreeWithRootInstructionArgs, +} + +impl<'a, 'b> InitPreparedTreeWithRootCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: InitPreparedTreeWithRootCpiAccounts<'a, 'b>, + args: InitPreparedTreeWithRootInstructionArgs, + ) -> Self { + Self { + __program: program, + merkle_tree: accounts.merkle_tree, + authority: accounts.authority, + noop: accounts.noop, + __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(3 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.merkle_tree.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.noop.key, + 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 = InitPreparedTreeWithRootInstructionData::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::SPL_ACCOUNT_COMPRESSION_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(3 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.merkle_tree.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.noop.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) + } + } +} + +/// `init_prepared_tree_with_root` CPI instruction builder. +pub struct InitPreparedTreeWithRootCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> InitPreparedTreeWithRootCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(InitPreparedTreeWithRootCpiBuilderInstruction { + __program: program, + merkle_tree: None, + authority: None, + noop: None, + root: None, + rightmost_leaf: None, + rightmost_index: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn merkle_tree( + &mut self, + merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.merkle_tree = Some(merkle_tree); + self + } + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + #[inline(always)] + pub fn authority( + &mut self, + authority: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Program used to emit changelogs as cpi instruction data. + #[inline(always)] + pub fn noop(&mut self, noop: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.noop = Some(noop); + self + } + #[inline(always)] + pub fn root(&mut self, root: [u8; 32]) -> &mut Self { + self.instruction.root = Some(root); + self + } + #[inline(always)] + pub fn rightmost_leaf(&mut self, rightmost_leaf: [u8; 32]) -> &mut Self { + self.instruction.rightmost_leaf = Some(rightmost_leaf); + self + } + #[inline(always)] + pub fn rightmost_index(&mut self, rightmost_index: u32) -> &mut Self { + self.instruction.rightmost_index = Some(rightmost_index); + 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 = InitPreparedTreeWithRootInstructionArgs { + root: self.instruction.root.clone().expect("root is not set"), + rightmost_leaf: self + .instruction + .rightmost_leaf + .clone() + .expect("rightmost_leaf is not set"), + rightmost_index: self + .instruction + .rightmost_index + .clone() + .expect("rightmost_index is not set"), + }; + let instruction = InitPreparedTreeWithRootCpi { + __program: self.instruction.__program, + + merkle_tree: self + .instruction + .merkle_tree + .expect("merkle_tree is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + noop: self.instruction.noop.expect("noop is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct InitPreparedTreeWithRootCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + merkle_tree: Option<&'b solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + noop: Option<&'b solana_program::account_info::AccountInfo<'a>>, + root: Option<[u8; 32]>, + rightmost_leaf: Option<[u8; 32]>, + rightmost_index: 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 88e88c00..9e7c778a 100644 --- a/clients/rust/src/generated/instructions/mod.rs +++ b/clients/rust/src/generated/instructions/mod.rs @@ -5,13 +5,20 @@ //! [https://github.com/metaplex-foundation/kinobi] //! +pub(crate) mod add_canopy; +pub(crate) mod append_canopy_nodes; pub(crate) mod burn; pub(crate) mod cancel_redeem; pub(crate) mod create_tree_config; pub(crate) mod decompress_v1; pub(crate) mod delegate; +pub(crate) mod finalize_tree_with_root; +pub(crate) mod finalize_tree_with_root_and_collection; +pub(crate) mod init_prepared_tree_with_root; pub(crate) mod mint_to_collection_v1; pub(crate) mod mint_v1; +pub(crate) mod prepare_batch_merkle_tree; +pub(crate) mod prepare_tree; pub(crate) mod redeem; pub(crate) mod set_and_verify_collection; pub(crate) mod set_decompressible_state; @@ -24,13 +31,20 @@ pub(crate) mod verify_collection; pub(crate) mod verify_creator; pub(crate) mod verify_leaf; +pub use self::add_canopy::*; +pub use self::append_canopy_nodes::*; pub use self::burn::*; pub use self::cancel_redeem::*; pub use self::create_tree_config::*; pub use self::decompress_v1::*; pub use self::delegate::*; +pub use self::finalize_tree_with_root::*; +pub use self::finalize_tree_with_root_and_collection::*; +pub use self::init_prepared_tree_with_root::*; pub use self::mint_to_collection_v1::*; pub use self::mint_v1::*; +pub use self::prepare_batch_merkle_tree::*; +pub use self::prepare_tree::*; pub use self::redeem::*; pub use self::set_and_verify_collection::*; pub use self::set_decompressible_state::*; diff --git a/clients/rust/src/generated/instructions/prepare_batch_merkle_tree.rs b/clients/rust/src/generated/instructions/prepare_batch_merkle_tree.rs new file mode 100644 index 00000000..389df4ec --- /dev/null +++ b/clients/rust/src/generated/instructions/prepare_batch_merkle_tree.rs @@ -0,0 +1,419 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct PrepareBatchMerkleTree { + pub merkle_tree: solana_program::pubkey::Pubkey, + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + pub authority: solana_program::pubkey::Pubkey, + /// Program used to emit changelogs as cpi instruction data. + pub noop: solana_program::pubkey::Pubkey, +} + +impl PrepareBatchMerkleTree { + pub fn instruction( + &self, + args: PrepareBatchMerkleTreeInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: PrepareBatchMerkleTreeInstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(3 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.merkle_tree, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.noop, false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = PrepareBatchMerkleTreeInstructionData::new() + .try_to_vec() + .unwrap(); + let mut args = args.try_to_vec().unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::SPL_ACCOUNT_COMPRESSION_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct PrepareBatchMerkleTreeInstructionData { + discriminator: [u8; 8], +} + +impl PrepareBatchMerkleTreeInstructionData { + fn new() -> Self { + Self { + discriminator: [230, 124, 120, 196, 249, 134, 199, 128], + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct PrepareBatchMerkleTreeInstructionArgs { + pub max_depth: u32, + pub max_buffer_size: u32, +} + +/// Instruction builder. +#[derive(Default)] +pub struct PrepareBatchMerkleTreeBuilder { + merkle_tree: Option, + authority: Option, + noop: Option, + max_depth: Option, + max_buffer_size: Option, + __remaining_accounts: Vec, +} + +impl PrepareBatchMerkleTreeBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn merkle_tree(&mut self, merkle_tree: solana_program::pubkey::Pubkey) -> &mut Self { + self.merkle_tree = Some(merkle_tree); + self + } + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + #[inline(always)] + pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self { + self.authority = Some(authority); + self + } + /// Program used to emit changelogs as cpi instruction data. + #[inline(always)] + pub fn noop(&mut self, noop: solana_program::pubkey::Pubkey) -> &mut Self { + self.noop = Some(noop); + self + } + #[inline(always)] + pub fn max_depth(&mut self, max_depth: u32) -> &mut Self { + self.max_depth = Some(max_depth); + self + } + #[inline(always)] + pub fn max_buffer_size(&mut self, max_buffer_size: u32) -> &mut Self { + self.max_buffer_size = Some(max_buffer_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 = PrepareBatchMerkleTree { + merkle_tree: self.merkle_tree.expect("merkle_tree is not set"), + authority: self.authority.expect("authority is not set"), + noop: self.noop.expect("noop is not set"), + }; + let args = PrepareBatchMerkleTreeInstructionArgs { + max_depth: self.max_depth.clone().expect("max_depth is not set"), + max_buffer_size: self + .max_buffer_size + .clone() + .expect("max_buffer_size is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `prepare_batch_merkle_tree` CPI accounts. +pub struct PrepareBatchMerkleTreeCpiAccounts<'a, 'b> { + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + pub authority: &'b solana_program::account_info::AccountInfo<'a>, + /// Program used to emit changelogs as cpi instruction data. + pub noop: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `prepare_batch_merkle_tree` CPI instruction. +pub struct PrepareBatchMerkleTreeCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + pub authority: &'b solana_program::account_info::AccountInfo<'a>, + /// Program used to emit changelogs as cpi instruction data. + pub noop: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: PrepareBatchMerkleTreeInstructionArgs, +} + +impl<'a, 'b> PrepareBatchMerkleTreeCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: PrepareBatchMerkleTreeCpiAccounts<'a, 'b>, + args: PrepareBatchMerkleTreeInstructionArgs, + ) -> Self { + Self { + __program: program, + merkle_tree: accounts.merkle_tree, + authority: accounts.authority, + noop: accounts.noop, + __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(3 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.merkle_tree.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.noop.key, + 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 = PrepareBatchMerkleTreeInstructionData::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::SPL_ACCOUNT_COMPRESSION_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(3 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.merkle_tree.clone()); + account_infos.push(self.authority.clone()); + account_infos.push(self.noop.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) + } + } +} + +/// `prepare_batch_merkle_tree` CPI instruction builder. +pub struct PrepareBatchMerkleTreeCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> PrepareBatchMerkleTreeCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(PrepareBatchMerkleTreeCpiBuilderInstruction { + __program: program, + merkle_tree: None, + authority: None, + noop: None, + max_depth: None, + max_buffer_size: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn merkle_tree( + &mut self, + merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.merkle_tree = Some(merkle_tree); + self + } + /// Authority that controls write-access to the tree + /// Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs. + #[inline(always)] + pub fn authority( + &mut self, + authority: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.authority = Some(authority); + self + } + /// Program used to emit changelogs as cpi instruction data. + #[inline(always)] + pub fn noop(&mut self, noop: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.noop = Some(noop); + self + } + #[inline(always)] + pub fn max_depth(&mut self, max_depth: u32) -> &mut Self { + self.instruction.max_depth = Some(max_depth); + self + } + #[inline(always)] + pub fn max_buffer_size(&mut self, max_buffer_size: u32) -> &mut Self { + self.instruction.max_buffer_size = Some(max_buffer_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 = PrepareBatchMerkleTreeInstructionArgs { + max_depth: self + .instruction + .max_depth + .clone() + .expect("max_depth is not set"), + max_buffer_size: self + .instruction + .max_buffer_size + .clone() + .expect("max_buffer_size is not set"), + }; + let instruction = PrepareBatchMerkleTreeCpi { + __program: self.instruction.__program, + + merkle_tree: self + .instruction + .merkle_tree + .expect("merkle_tree is not set"), + + authority: self.instruction.authority.expect("authority is not set"), + + noop: self.instruction.noop.expect("noop is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct PrepareBatchMerkleTreeCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + merkle_tree: Option<&'b solana_program::account_info::AccountInfo<'a>>, + authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + noop: Option<&'b solana_program::account_info::AccountInfo<'a>>, + max_depth: Option, + max_buffer_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/prepare_tree.rs b/clients/rust/src/generated/instructions/prepare_tree.rs new file mode 100644 index 00000000..79db4a53 --- /dev/null +++ b/clients/rust/src/generated/instructions/prepare_tree.rs @@ -0,0 +1,591 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! [https://github.com/metaplex-foundation/kinobi] +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +pub struct PrepareTree { + pub tree_config: solana_program::pubkey::Pubkey, + + pub merkle_tree: solana_program::pubkey::Pubkey, + + pub payer: solana_program::pubkey::Pubkey, + + pub tree_creator: solana_program::pubkey::Pubkey, + + pub log_wrapper: solana_program::pubkey::Pubkey, + + pub compression_program: solana_program::pubkey::Pubkey, + + pub system_program: solana_program::pubkey::Pubkey, +} + +impl PrepareTree { + pub fn instruction( + &self, + args: PrepareTreeInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: PrepareTreeInstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(7 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.tree_config, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.merkle_tree, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.tree_creator, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.log_wrapper, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.compression_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = PrepareTreeInstructionData::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_BUBBLEGUM_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +struct PrepareTreeInstructionData { + discriminator: [u8; 8], +} + +impl PrepareTreeInstructionData { + fn new() -> Self { + Self { + discriminator: [41, 56, 189, 77, 58, 12, 142, 71], + } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct PrepareTreeInstructionArgs { + pub max_depth: u32, + pub max_buffer_size: u32, + pub public: Option, +} + +/// Instruction builder. +#[derive(Default)] +pub struct PrepareTreeBuilder { + tree_config: Option, + merkle_tree: Option, + payer: Option, + tree_creator: Option, + log_wrapper: Option, + compression_program: Option, + system_program: Option, + max_depth: Option, + max_buffer_size: Option, + public: Option, + __remaining_accounts: Vec, +} + +impl PrepareTreeBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn tree_config(&mut self, tree_config: solana_program::pubkey::Pubkey) -> &mut Self { + self.tree_config = Some(tree_config); + self + } + #[inline(always)] + pub fn merkle_tree(&mut self, merkle_tree: solana_program::pubkey::Pubkey) -> &mut Self { + self.merkle_tree = Some(merkle_tree); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + #[inline(always)] + pub fn tree_creator(&mut self, tree_creator: solana_program::pubkey::Pubkey) -> &mut Self { + self.tree_creator = Some(tree_creator); + self + } + /// `[optional account, default to 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV']` + #[inline(always)] + pub fn log_wrapper(&mut self, log_wrapper: solana_program::pubkey::Pubkey) -> &mut Self { + self.log_wrapper = Some(log_wrapper); + self + } + /// `[optional account, default to 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK']` + #[inline(always)] + pub fn compression_program( + &mut self, + compression_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.compression_program = Some(compression_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn max_depth(&mut self, max_depth: u32) -> &mut Self { + self.max_depth = Some(max_depth); + self + } + #[inline(always)] + pub fn max_buffer_size(&mut self, max_buffer_size: u32) -> &mut Self { + self.max_buffer_size = Some(max_buffer_size); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn public(&mut self, public: bool) -> &mut Self { + self.public = Some(public); + 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 = PrepareTree { + tree_config: self.tree_config.expect("tree_config is not set"), + merkle_tree: self.merkle_tree.expect("merkle_tree is not set"), + payer: self.payer.expect("payer is not set"), + tree_creator: self.tree_creator.expect("tree_creator is not set"), + log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!( + "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" + )), + compression_program: self.compression_program.unwrap_or(solana_program::pubkey!( + "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + }; + let args = PrepareTreeInstructionArgs { + max_depth: self.max_depth.clone().expect("max_depth is not set"), + max_buffer_size: self + .max_buffer_size + .clone() + .expect("max_buffer_size is not set"), + public: self.public.clone(), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `prepare_tree` CPI accounts. +pub struct PrepareTreeCpiAccounts<'a, 'b> { + pub tree_config: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_creator: &'b solana_program::account_info::AccountInfo<'a>, + + pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + + pub compression_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `prepare_tree` CPI instruction. +pub struct PrepareTreeCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_config: &'b solana_program::account_info::AccountInfo<'a>, + + pub merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + + pub tree_creator: &'b solana_program::account_info::AccountInfo<'a>, + + pub log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + + pub compression_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: PrepareTreeInstructionArgs, +} + +impl<'a, 'b> PrepareTreeCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: PrepareTreeCpiAccounts<'a, 'b>, + args: PrepareTreeInstructionArgs, + ) -> Self { + Self { + __program: program, + tree_config: accounts.tree_config, + merkle_tree: accounts.merkle_tree, + payer: accounts.payer, + tree_creator: accounts.tree_creator, + log_wrapper: accounts.log_wrapper, + compression_program: accounts.compression_program, + system_program: accounts.system_program, + __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(7 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.tree_config.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.merkle_tree.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.tree_creator.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.log_wrapper.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.compression_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + 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 = PrepareTreeInstructionData::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_BUBBLEGUM_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + 1 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.tree_config.clone()); + account_infos.push(self.merkle_tree.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.tree_creator.clone()); + account_infos.push(self.log_wrapper.clone()); + account_infos.push(self.compression_program.clone()); + account_infos.push(self.system_program.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) + } + } +} + +/// `prepare_tree` CPI instruction builder. +pub struct PrepareTreeCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> PrepareTreeCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(PrepareTreeCpiBuilderInstruction { + __program: program, + tree_config: None, + merkle_tree: None, + payer: None, + tree_creator: None, + log_wrapper: None, + compression_program: None, + system_program: None, + max_depth: None, + max_buffer_size: None, + public: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn tree_config( + &mut self, + tree_config: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.tree_config = Some(tree_config); + self + } + #[inline(always)] + pub fn merkle_tree( + &mut self, + merkle_tree: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.merkle_tree = Some(merkle_tree); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + #[inline(always)] + pub fn tree_creator( + &mut self, + tree_creator: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.tree_creator = Some(tree_creator); + self + } + #[inline(always)] + pub fn log_wrapper( + &mut self, + log_wrapper: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.log_wrapper = Some(log_wrapper); + self + } + #[inline(always)] + pub fn compression_program( + &mut self, + compression_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.compression_program = Some(compression_program); + self + } + #[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 + } + #[inline(always)] + pub fn max_depth(&mut self, max_depth: u32) -> &mut Self { + self.instruction.max_depth = Some(max_depth); + self + } + #[inline(always)] + pub fn max_buffer_size(&mut self, max_buffer_size: u32) -> &mut Self { + self.instruction.max_buffer_size = Some(max_buffer_size); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn public(&mut self, public: bool) -> &mut Self { + self.instruction.public = Some(public); + 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 = PrepareTreeInstructionArgs { + max_depth: self + .instruction + .max_depth + .clone() + .expect("max_depth is not set"), + max_buffer_size: self + .instruction + .max_buffer_size + .clone() + .expect("max_buffer_size is not set"), + public: self.instruction.public.clone(), + }; + let instruction = PrepareTreeCpi { + __program: self.instruction.__program, + + tree_config: self + .instruction + .tree_config + .expect("tree_config is not set"), + + merkle_tree: self + .instruction + .merkle_tree + .expect("merkle_tree is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + tree_creator: self + .instruction + .tree_creator + .expect("tree_creator is not set"), + + log_wrapper: self + .instruction + .log_wrapper + .expect("log_wrapper is not set"), + + compression_program: self + .instruction + .compression_program + .expect("compression_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +struct PrepareTreeCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + tree_config: Option<&'b solana_program::account_info::AccountInfo<'a>>, + merkle_tree: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + tree_creator: Option<&'b solana_program::account_info::AccountInfo<'a>>, + log_wrapper: Option<&'b solana_program::account_info::AccountInfo<'a>>, + compression_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + max_depth: Option, + max_buffer_size: Option, + public: 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/concurrent_merkle_tree_header_data.rs b/clients/rust/src/generated/types/concurrent_merkle_tree_header_data.rs index d1eb41fd..61a0a577 100644 --- a/clients/rust/src/generated/types/concurrent_merkle_tree_header_data.rs +++ b/clients/rust/src/generated/types/concurrent_merkle_tree_header_data.rs @@ -30,8 +30,12 @@ pub enum ConcurrentMerkleTreeHeaderData { /// Slot corresponding to when the Merkle tree was created. /// Provides a lower-bound on what slot to start (re-)building a tree from. creation_slot: u64, + /// A flag indicating whether the tree has been initialized with a root. + /// This field was added together with the `finalize_tree_with_root` instruction. + /// It takes 1 byte of space taken from the previous padding for existing accounts. + is_batch_initialized: bool, /// Needs padding for the account to be 8-byte aligned /// 8-byte alignment is necessary to zero-copy the SPL ConcurrentMerkleTree - padding: [u8; 6], + padding: [u8; 5], }, } diff --git a/clients/rust/src/lib.rs b/clients/rust/src/lib.rs index 08cf8ece..1e62b20d 100644 --- a/clients/rust/src/lib.rs +++ b/clients/rust/src/lib.rs @@ -28,6 +28,10 @@ pub enum InstructionName { MintToCollectionV1, SetDecompressibleState, UpdateMetadata, + FinalizeTreeWithRoot, + FinalizeTreeWithRootAndCollection, + PrepareTree, + AddCanopy, } pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { @@ -56,6 +60,10 @@ pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { // `SetDecompressableState` instruction mapped to `SetDecompressibleState` instruction [18, 135, 238, 168, 246, 195, 61, 115] => InstructionName::SetDecompressibleState, [170, 182, 43, 239, 97, 78, 225, 186] => InstructionName::UpdateMetadata, + [77, 73, 220, 153, 126, 225, 64, 204] => InstructionName::FinalizeTreeWithRoot, + [194, 98, 45, 168, 183, 72, 67, 155] => InstructionName::FinalizeTreeWithRootAndCollection, + [41, 56, 189, 77, 58, 12, 142, 71] => InstructionName::PrepareTree, + [247, 118, 145, 92, 84, 66, 207, 25] => InstructionName::AddCanopy, _ => InstructionName::Unknown, } } @@ -78,3 +86,5 @@ impl LeafSchemaEvent { } } } + +pub const MAX_ACC_PROOFS_SIZE: u32 = 17; diff --git a/configs/scripts/program/dump.sh b/configs/scripts/program/dump.sh index 386df6c6..66eaa672 100755 --- a/configs/scripts/program/dump.sh +++ b/configs/scripts/program/dump.sh @@ -16,7 +16,7 @@ cd $(dirname $(dirname $(dirname $SCRIPT_DIR))) OUTPUT=$1 if [ -z ${RPC+x} ]; then - RPC="https://api.mainnet-beta.solana.com" + RPC="https://api.devnet.solana.com" fi if [ -z "$OUTPUT" ]; then diff --git a/idls/bubblegum.json b/idls/bubblegum.json index 070afde2..a88be075 100644 --- a/idls/bubblegum.json +++ b/idls/bubblegum.json @@ -1,5 +1,5 @@ { - "version": "0.12.0", + "version": "0.13.0", "name": "bubblegum", "instructions": [ { @@ -215,6 +215,114 @@ ], "args": [] }, + { + "name": "prepareTree", + "accounts": [ + { + "name": "treeAuthority", + "isMut": true, + "isSigner": false + }, + { + "name": "merkleTree", + "isMut": true, + "isSigner": false + }, + { + "name": "payer", + "isMut": true, + "isSigner": true + }, + { + "name": "treeCreator", + "isMut": false, + "isSigner": true + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false + }, + { + "name": "compressionProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "maxDepth", + "type": "u32" + }, + { + "name": "maxBufferSize", + "type": "u32" + }, + { + "name": "public", + "type": { + "option": "bool" + } + } + ] + }, + { + "name": "addCanopy", + "accounts": [ + { + "name": "treeAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "merkleTree", + "isMut": true, + "isSigner": false + }, + { + "name": "treeDelegate", + "isMut": false, + "isSigner": true + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false + }, + { + "name": "compressionProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "startIndex", + "type": "u32" + }, + { + "name": "canopyNodes", + "type": { + "vec": { + "array": [ + "u8", + 32 + ] + } + } + } + ] + }, { "name": "createTree", "docs": [ @@ -274,6 +382,229 @@ } ] }, + { + "name": "finalizeTreeWithRoot", + "accounts": [ + { + "name": "treeAuthority", + "isMut": true, + "isSigner": false + }, + { + "name": "merkleTree", + "isMut": true, + "isSigner": false + }, + { + "name": "payer", + "isMut": true, + "isSigner": true + }, + { + "name": "treeDelegate", + "isMut": false, + "isSigner": true + }, + { + "name": "staker", + "isMut": false, + "isSigner": true + }, + { + "name": "registrar", + "isMut": false, + "isSigner": false + }, + { + "name": "voter", + "isMut": false, + "isSigner": false + }, + { + "name": "mining", + "isMut": false, + "isSigner": false + }, + { + "name": "feeReceiver", + "isMut": true, + "isSigner": false + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false + }, + { + "name": "compressionProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "root", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "rightmostLeaf", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "rightmostIndex", + "type": "u32" + }, + { + "name": "metadataUrl", + "type": "string" + }, + { + "name": "metadataHash", + "type": "string" + } + ] + }, + { + "name": "finalizeTreeWithRootAndCollection", + "accounts": [ + { + "name": "treeAuthority", + "isMut": true, + "isSigner": false + }, + { + "name": "merkleTree", + "isMut": true, + "isSigner": false + }, + { + "name": "payer", + "isMut": true, + "isSigner": true + }, + { + "name": "treeDelegate", + "isMut": false, + "isSigner": true + }, + { + "name": "staker", + "isMut": false, + "isSigner": true + }, + { + "name": "collectionAuthority", + "isMut": false, + "isSigner": true + }, + { + "name": "registrar", + "isMut": false, + "isSigner": false + }, + { + "name": "voter", + "isMut": false, + "isSigner": false + }, + { + "name": "mining", + "isMut": false, + "isSigner": false + }, + { + "name": "feeReceiver", + "isMut": true, + "isSigner": false + }, + { + "name": "collectionAuthorityRecordPda", + "isMut": false, + "isSigner": false, + "docs": [ + "If there is no collecton authority record PDA then", + "this must be the Bubblegum program address." + ] + }, + { + "name": "collectionMint", + "isMut": false, + "isSigner": false + }, + { + "name": "collectionMetadata", + "isMut": true, + "isSigner": false + }, + { + "name": "editionAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false + }, + { + "name": "compressionProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "root", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "rightmostLeaf", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "rightmostIndex", + "type": "u32" + }, + { + "name": "metadataUrl", + "type": "string" + }, + { + "name": "metadataHash", + "type": "string" + } + ] + }, { "name": "decompressV1", "docs": [ @@ -2070,6 +2401,18 @@ }, { "name": "UpdateMetadata" + }, + { + "name": "FinalizeTreeWithRoot" + }, + { + "name": "FinalizeTreeWithRootAndCollection" + }, + { + "name": "PrepareTree" + }, + { + "name": "AddCanopy" } ] } @@ -2285,6 +2628,56 @@ "code": 6041, "name": "InvalidCanopySize", "msg": "Canopy size should be set bigger for this tree" + }, + { + "code": 6042, + "name": "NotEnoughStakeForOperation", + "msg": "Not enough tokens staked to call this instruction" + }, + { + "code": 6043, + "name": "StakingRegistrarMismatch", + "msg": "Staking registrar mismatch" + }, + { + "code": 6044, + "name": "StakingVoterMismatch", + "msg": "Staking voter mismatch" + }, + { + "code": 6045, + "name": "FeeReceiverMismatch", + "msg": "Fee receiver mismatch" + }, + { + "code": 6046, + "name": "StakingRegistrarRealmMismatch", + "msg": "Staking registrar realm mismatch" + }, + { + "code": 6047, + "name": "StakingRegistrarDiscriminatorMismatch", + "msg": "Staking registrar discriminator mismatch" + }, + { + "code": 6048, + "name": "StakingVoterDiscriminatorMismatch", + "msg": "Staking voter discriminator mismatch" + }, + { + "code": 6049, + "name": "StakingVoterRegistrarMismatch", + "msg": "Staking voter registrar mismatch" + }, + { + "code": 6050, + "name": "StakingVoterAuthorityMismatch", + "msg": "Staking voter authority mismatch" + }, + { + "code": 6051, + "name": "MiningOwnerMismatch", + "msg": "Invalid mining owner" } ], "metadata": { diff --git a/idls/spl_account_compression.json b/idls/spl_account_compression.json index 7fe85863..63ef6114 100644 --- a/idls/spl_account_compression.json +++ b/idls/spl_account_compression.json @@ -1,5 +1,5 @@ { - "version": "0.1.4", + "version": "0.3.1", "name": "spl_account_compression", "instructions": [ { @@ -53,18 +53,186 @@ } ] }, + { + "name": "prepareBatchMerkleTree", + "docs": [ + "In order to initialize a tree with a root, we need to create the tree on-chain first with", + "the proper authority. The tree might contain a canopy, which is a cache of the uppermost", + "nodes. The canopy is used to decrease the size of the proof required to update the tree.", + "If the tree is expected to have a canopy, it needs to be prefilled with the necessary nodes.", + "There are 2 ways to initialize a merkle tree:", + "1. Initialize an empty tree", + "2. Initialize a tree with a root and leaf", + "For the former case, the canopy will be empty which is expected for an empty tree. The", + "expected flow is `init_empty_merkle_tree`. For the latter case, the canopy should be", + "filled with the necessary nodes to render the tree usable. Thus we need to prefill the", + "canopy with the necessary nodes. The expected flow for a tree without canopy is", + "`prepare_batch_merkle_tree` -> `init_prepared_tree_with_root`. The expected flow for a tree", + "with canopy is `prepare_batch_merkle_tree` -> `append_canopy_nodes` (multiple times", + "until all of the canopy is filled) -> `init_prepared_tree_with_root`. This instruction", + "initializes the tree header while leaving the tree itself uninitialized. This allows", + "distinguishing between an empty tree and a tree prepare to be initialized with a root." + ], + "accounts": [ + { + "name": "merkleTree", + "isMut": true, + "isSigner": false + }, + { + "name": "authority", + "isMut": false, + "isSigner": true, + "docs": [ + "Authority that controls write-access to the tree", + "Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs." + ] + }, + { + "name": "noop", + "isMut": false, + "isSigner": false, + "docs": [ + "Program used to emit changelogs as cpi instruction data." + ] + } + ], + "args": [ + { + "name": "maxDepth", + "type": "u32" + }, + { + "name": "maxBufferSize", + "type": "u32" + } + ] + }, + { + "name": "appendCanopyNodes", + "docs": [ + "This instruction pre-initializes the canopy with the specified leaf nodes of the canopy.", + "This is intended to be used after `prepare_batch_merkle_tree` and in conjunction with the", + "`init_prepared_tree_with_root` instruction that'll finalize the tree initialization.", + "The canopy is used to cache the uppermost nodes of the tree, which allows for a smaller", + "proof size when updating the tree. The canopy should be filled with the necessary nodes", + "before calling `init_prepared_tree_with_root`. You may call this instruction multiple", + "times to fill the canopy with the necessary nodes. The canopy may be filled with the", + "nodes in any order. The already filled nodes may be replaced with new nodes before calling", + "`init_prepared_tree_with_root` if the step was done in error.", + "The canopy should be filled with all the nodes that are to the left of the rightmost", + "leaf of the tree before calling `init_prepared_tree_with_root`. The canopy should not", + "contain any nodes to the right of the rightmost leaf of the tree.", + "This instruction calculates and filles in all the canopy nodes \"above\" the provided ones.", + "The validation of the canopy is done in the `init_prepared_tree_with_root` instruction." + ], + "accounts": [ + { + "name": "merkleTree", + "isMut": true, + "isSigner": false + }, + { + "name": "authority", + "isMut": false, + "isSigner": true, + "docs": [ + "Authority that controls write-access to the tree", + "Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs." + ] + }, + { + "name": "noop", + "isMut": false, + "isSigner": false, + "docs": [ + "Program used to emit changelogs as cpi instruction data." + ] + } + ], + "args": [ + { + "name": "startIndex", + "type": "u32" + }, + { + "name": "canopyNodes", + "type": { + "vec": { + "array": [ + "u8", + 32 + ] + } + } + } + ] + }, + { + "name": "initPreparedTreeWithRoot", + "docs": [ + "Initializes a prepared tree with a root and a rightmost leaf. The rightmost leaf is used to", + "verify the canopy if the tree has it. Before calling this instruction, the tree should be", + "prepared with `prepare_batch_merkle_tree` and the canopy should be filled with the necessary", + "nodes with `append_canopy_nodes` (if the canopy is used). This method should be used for", + "batch creation of trees. The indexing of such batches should be done off-chain. The", + "programs calling this instruction should take care of ensuring the indexing is possible.", + "For example, staking may be required to ensure the tree creator has some responsibility", + "for what is being indexed. If indexing is not possible, there should be a mechanism to", + "penalize the tree creator." + ], + "accounts": [ + { + "name": "merkleTree", + "isMut": true, + "isSigner": false + }, + { + "name": "authority", + "isMut": false, + "isSigner": true, + "docs": [ + "Authority that controls write-access to the tree", + "Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs." + ] + }, + { + "name": "noop", + "isMut": false, + "isSigner": false, + "docs": [ + "Program used to emit changelogs as cpi instruction data." + ] + } + ], + "args": [ + { + "name": "root", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "rightmostLeaf", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "rightmostIndex", + "type": "u32" + } + ] + }, { "name": "replaceLeaf", "docs": [ - "Note:", - "Supporting this instruction open a security vulnerability for indexers.", - "This instruction has been deemed unusable for publicly indexed compressed NFTs.", - "Indexing batched data in this way requires indexers to read in the `uri`s onto physical storage", - "and then into their database. This opens up a DOS attack vector, whereby this instruction is", - "repeatedly invoked, causing indexers to fail.", - "", - "Because this instruction was deemed insecure, this instruction has been removed", - "until secure usage is available on-chain.", "Executes an instruction that overwrites a leaf node.", "Composing programs should check that the data hashed into previous_leaf", "matches the authority information necessary to execute this instruction." @@ -454,6 +622,15 @@ ], "type": "u64" }, + { + "name": "isBatchInitialized", + "docs": [ + "A flag indicating whether the tree has been initialized with a root.", + "This field was added together with the `finalize_tree_with_root` instruction.", + "It takes 1 byte of space taken from the previous padding for existing accounts." + ], + "type": "bool" + }, { "name": "padding", "docs": [ @@ -463,7 +640,7 @@ "type": { "array": [ "u8", - 6 + 5 ] } } @@ -623,12 +800,37 @@ "code": 6008, "name": "LeafIndexOutOfBounds", "msg": "Leaf index of concurrent merkle tree is out of bounds" + }, + { + "code": 6009, + "name": "CanopyNotAllocated", + "msg": "Tree was initialized without allocating space for the canopy" + }, + { + "code": 6010, + "name": "TreeAlreadyInitialized", + "msg": "Tree was already initialized" + }, + { + "code": 6011, + "name": "BatchNotInitialized", + "msg": "Tree header was not initialized for batch processing" + }, + { + "code": 6012, + "name": "CanopyRootMismatch", + "msg": "Canopy root does not match the root of the tree" + }, + { + "code": 6013, + "name": "CanopyRightmostLeafMismatch", + "msg": "Canopy contains nodes to the right of the rightmost leaf of the tree" } ], "metadata": { "address": "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK", "origin": "anchor", - "binaryVersion": "0.25.0", - "libVersion": "0.25.0" + "binaryVersion": "0.29.0", + "libVersion": "0.29.0" } } \ No newline at end of file diff --git a/programs/bubblegum/Cargo.lock b/programs/bubblegum/Cargo.lock index 04241678..50b69de0 100644 --- a/programs/bubblegum/Cargo.lock +++ b/programs/bubblegum/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -27,12 +27,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "aead" version = "0.4.3" @@ -123,38 +117,90 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "anchor-attribute-access-control" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf7d535e1381be3de2c0716c0a1c1e32ad9df1042cddcf7bc18d743569e53319" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", +] + [[package]] name = "anchor-attribute-access-control" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5f619f1d04f53621925ba8a2e633ba5a6081f2ae14758cbb67f38fd823e0a3e" dependencies = [ - "anchor-syn", + "anchor-syn 0.29.0", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "anchor-attribute-account" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3bcd731f21048a032be27c7791701120e44f3f6371358fc4261a7f716283d29" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + [[package]] name = "anchor-attribute-account" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7f2a3e1df4685f18d12a943a9f2a7456305401af21a07c9fe076ef9ecd6e400" dependencies = [ - "anchor-syn", + "anchor-syn 0.29.0", "bs58 0.5.0", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "anchor-attribute-constant" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1be64a48e395fe00b8217287f226078be2cf32dae42fdf8a885b997945c3d28" +dependencies = [ + "anchor-syn 0.26.0", + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "anchor-attribute-constant" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9423945cb55627f0b30903288e78baf6f62c6c8ab28fb344b6b25f1ffee3dca7" dependencies = [ - "anchor-syn", + "anchor-syn 0.29.0", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-error" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ea6713d1938c0da03656ff8a693b17dc0396da66d1ba320557f07e86eca0d4" +dependencies = [ + "anchor-syn 0.26.0", + "proc-macro2", "quote", "syn 1.0.109", ] @@ -165,7 +211,20 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93ed12720033cc3c3bf3cfa293349c2275cd5ab99936e33dd4bf283aaad3e241" dependencies = [ - "anchor-syn", + "anchor-syn 0.29.0", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-event" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d401f11efb3644285685f8339829a9786d43ed7490bb1699f33c478d04d5a582" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "proc-macro2", "quote", "syn 1.0.109", ] @@ -176,7 +235,34 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef4dc0371eba2d8c8b54794b0b0eb786a234a559b77593d6f80825b6d2c77a2" dependencies = [ - "anchor-syn", + "anchor-syn 0.29.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-interface" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6700a6f5c888a9c33fe8afc0c64fd8575fa28d05446037306d0f96102ae4480" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "heck 0.3.3", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-program" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ad769993b5266714e8939e47fbdede90e5c030333c7522d99a4d4748cf26712" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", "proc-macro2", "quote", "syn 1.0.109", @@ -188,7 +274,33 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b18c4f191331e078d4a6a080954d1576241c29c56638783322a18d308ab27e4f" dependencies = [ - "anchor-syn", + "anchor-syn 0.29.0", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-attribute-state" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e677fae4a016a554acdd0e3b7f178d3acafaa7e7ffac6b8690cf4e171f1c116" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "anchor-derive-accounts" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "340beef6809d1c3fcc7ae219153d981e95a8a277ff31985bd7050e32645dc9a8" +dependencies = [ + "anchor-syn 0.26.0", + "anyhow", + "proc-macro2", "quote", "syn 1.0.109", ] @@ -199,7 +311,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5de10d6e9620d3bcea56c56151cad83c5992f50d5960b3a9bebc4a50390ddc3c" dependencies = [ - "anchor-syn", + "anchor-syn 0.29.0", "quote", "syn 1.0.109", ] @@ -210,7 +322,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4e2e5be518ec6053d90a2a7f26843dbee607583c779e6c8395951b9739bdfbe" dependencies = [ - "anchor-syn", + "anchor-syn 0.29.0", "borsh-derive-internal 0.10.3", "proc-macro2", "quote", @@ -228,19 +340,43 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "anchor-lang" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "662ceafe667448ee4199a4be2ee83b6bb76da28566eee5cea05f96ab38255af8" +dependencies = [ + "anchor-attribute-access-control 0.26.0", + "anchor-attribute-account 0.26.0", + "anchor-attribute-constant 0.26.0", + "anchor-attribute-error 0.26.0", + "anchor-attribute-event 0.26.0", + "anchor-attribute-interface", + "anchor-attribute-program 0.26.0", + "anchor-attribute-state", + "anchor-derive-accounts 0.26.0", + "arrayref", + "base64 0.13.1", + "bincode", + "borsh 0.9.3", + "bytemuck", + "solana-program", + "thiserror", +] + [[package]] name = "anchor-lang" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35da4785497388af0553586d55ebdc08054a8b1724720ef2749d313494f2b8ad" dependencies = [ - "anchor-attribute-access-control", - "anchor-attribute-account", - "anchor-attribute-constant", - "anchor-attribute-error", - "anchor-attribute-event", - "anchor-attribute-program", - "anchor-derive-accounts", + "anchor-attribute-access-control 0.29.0", + "anchor-attribute-account 0.29.0", + "anchor-attribute-constant 0.29.0", + "anchor-attribute-error 0.29.0", + "anchor-attribute-event 0.29.0", + "anchor-attribute-program 0.29.0", + "anchor-derive-accounts 0.29.0", "anchor-derive-serde", "anchor-derive-space", "arrayref", @@ -253,19 +389,50 @@ dependencies = [ "thiserror", ] +[[package]] +name = "anchor-spl" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f32390ce8356f54c0f0245ea156f8190717e37285b8bf4f406a613dc4b954cde" +dependencies = [ + "anchor-lang 0.26.0", + "solana-program", + "spl-associated-token-account 1.1.3", + "spl-token 3.5.0", +] + [[package]] name = "anchor-spl" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c4fd6e43b2ca6220d2ef1641539e678bfc31b6cc393cf892b373b5997b6a39a" dependencies = [ - "anchor-lang", + "anchor-lang 0.29.0", "solana-program", "spl-associated-token-account 2.3.0", "spl-token 4.0.0", "spl-token-2022 0.9.0", ] +[[package]] +name = "anchor-syn" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0418bcb5daac3b8cb1b60d8fdb1d468ca36f5509f31fb51179326fae1028fdcc" +dependencies = [ + "anyhow", + "bs58 0.3.1", + "heck 0.3.3", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "serde", + "serde_json", + "sha2 0.9.9", + "syn 1.0.109", + "thiserror", +] + [[package]] name = "anchor-syn" version = "0.29.0" @@ -369,7 +536,7 @@ dependencies = [ "derivative", "digest 0.10.7", "itertools", - "num-bigint 0.4.4", + "num-bigint 0.4.5", "num-traits", "paste", "rustc_version", @@ -392,7 +559,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ - "num-bigint 0.4.4", + "num-bigint 0.4.5", "num-traits", "proc-macro2", "quote", @@ -421,7 +588,7 @@ dependencies = [ "ark-serialize-derive", "ark-std", "digest 0.10.7", - "num-bigint 0.4.4", + "num-bigint 0.4.5", ] [[package]] @@ -521,9 +688,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.12" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fec134f64e2bc57411226dfc4e52dec859ddfc7e711fc5e07b612584f000e4aa" +checksum = "9c90a406b4495d129f00461241616194cb8a032c8d1c53c657f0961d5f8e0498" dependencies = [ "brotli", "flate2", @@ -544,13 +711,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -572,15 +739,15 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide 0.7.1", + "miniz_oxide", "object", "rustc-demangle", ] @@ -626,9 +793,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -703,11 +870,11 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "dbe5b10e214954177fb1dc9fbd20a1a2608fe99e6c832033bdc7cea287a20d77" dependencies = [ - "borsh-derive 1.5.1", + "borsh-derive 1.5.0", "cfg_aliases", ] @@ -739,15 +906,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "d7a8646f94ab393e43e8b35a2558b1624bed28b97ee09c5d15456e3c9463f46d" dependencies = [ "once_cell", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", "syn_derive", ] @@ -808,14 +975,20 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "4.0.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +checksum = "e6221fe77a248b9117d431ad93761222e1cf8ff282d9d1d5d9f53d6299a1cf76" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", ] +[[package]] +name = "bs58" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" + [[package]] name = "bs58" version = "0.4.0" @@ -833,24 +1006,26 @@ dependencies = [ [[package]] name = "bubblegum" -version = "0.12.0" +version = "0.13.0" dependencies = [ - "anchor-lang", - "anchor-spl", + "anchor-lang 0.29.0", + "anchor-spl 0.29.0", "async-trait", "bytemuck", "mpl-token-auth-rules", "mpl-token-metadata", + "mplx-rewards", + "mplx-staking-states", "num-traits", "solana-program", "solana-program-test", "solana-sdk", "spl-account-compression", - "spl-associated-token-account 1.1.3", + "spl-associated-token-account 2.3.0", "spl-concurrent-merkle-tree", "spl-merkle-tree-reference", "spl-noop", - "spl-token 3.5.0", + "spl-token 4.0.0", ] [[package]] @@ -871,9 +1046,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" dependencies = [ "bytemuck_derive", ] @@ -886,7 +1061,7 @@ checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -897,9 +1072,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "bzip2" @@ -934,13 +1109,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.15" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" dependencies = [ "jobserver", "libc", - "shlex", ] [[package]] @@ -951,9 +1125,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cfg_aliases" -version = "0.2.1" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" @@ -967,7 +1141,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.6", + "windows-targets 0.52.5", ] [[package]] @@ -1131,9 +1305,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ "crossbeam-utils", ] @@ -1164,9 +1338,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crunchy" @@ -1238,7 +1412,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1249,7 +1423,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1290,7 +1464,7 @@ dependencies = [ "asn1-rs", "displaydoc", "nom", - "num-bigint 0.4.4", + "num-bigint 0.4.5", "num-traits", "rusticata-macros", ] @@ -1373,7 +1547,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1396,7 +1570,7 @@ checksum = "a6cbae11b3de8fce2a456e8ea3dada226b35fe791f0dc1d360c0941f0bb681f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1496,7 +1670,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1505,11 +1679,11 @@ version = "3.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4f76552f53cefc9a7f64987c3701b99d982f7690606fd67de1d09712fbf52f1" dependencies = [ - "num-bigint 0.4.4", + "num-bigint 0.4.5", "num-traits", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1549,9 +1723,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "fastrand" -version = "2.1.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "feature-probe" @@ -1573,12 +1747,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.33" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "miniz_oxide", ] [[package]] @@ -1667,7 +1841,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -1749,9 +1923,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "goblin" @@ -2026,18 +2200,18 @@ dependencies = [ [[package]] name = "include_dir" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" +checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" dependencies = [ "include_dir_macros", ] [[package]] name = "include_dir_macros" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" +checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" dependencies = [ "proc-macro2", "quote", @@ -2045,9 +2219,9 @@ dependencies = [ [[package]] name = "index_list" -version = "0.2.13" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e6ba961c14e98151cd6416dd3685efe786a94c38bc1a535c06ceff0a1600813" +checksum = "70891286cb8e844fdfcf1178b47569699f9e20b5ecc4b45a6240a64771444638" [[package]] name = "indexmap" @@ -2061,9 +2235,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -2114,18 +2288,18 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" -version = "0.1.32" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -2160,11 +2334,23 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lib-sokoban" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0640eb476052d9f48e920969f8117b054d1be1a0b2e4055e61293cd2b1afcce1" +dependencies = [ + "bytemuck", + "num-derive 0.3.3", + "num-traits", + "thiserror", +] + [[package]] name = "libc" -version = "0.2.158" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libsecp256k1" @@ -2222,15 +2408,15 @@ checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" dependencies = [ "ark-bn254", "ark-ff", - "num-bigint 0.4.4", + "num-bigint 0.4.5", "thiserror", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -2244,9 +2430,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lru" @@ -2279,9 +2465,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memmap2" @@ -2343,15 +2529,6 @@ dependencies = [ "adler", ] -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - [[package]] name = "mio" version = "0.8.11" @@ -2424,7 +2601,7 @@ dependencies = [ "num-traits", "rmp-serde", "serde", - "shank", + "shank 0.3.0", "solana-program", "solana-zk-token-sdk", "thiserror", @@ -2453,6 +2630,32 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "mplx-rewards" +version = "0.1.0" +source = "git+https://github.com/metaplex-foundation/aura-rewards.git#8dc168581e33ec08f472a9ee6f8300acf35d58cb" +dependencies = [ + "borsh 1.5.0", + "bytemuck", + "lib-sokoban", + "num-derive 0.4.2", + "num-traits", + "shank 0.4.2", + "solana-program", + "spl-token 4.0.0", + "thiserror", +] + +[[package]] +name = "mplx-staking-states" +version = "0.0.1" +source = "git+https://github.com/metaplex-foundation/aura-staking.git#ac02337227d533fd3f2fc0d4195ba8f214785d3f" +dependencies = [ + "anchor-lang 0.26.0", + "anchor-spl 0.26.0", + "static_assertions", +] + [[package]] name = "nix" version = "0.26.4" @@ -2509,11 +2712,10 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -2547,16 +2749,15 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] @@ -2585,9 +2786,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -2622,11 +2823,11 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ - "num_enum_derive 0.7.3", + "num_enum_derive 0.7.2", ] [[package]] @@ -2650,19 +2851,19 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] name = "num_enum_derive" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -2673,9 +2874,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.36.4" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -2843,7 +3044,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -2921,15 +3122,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.8" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" +checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" [[package]] name = "predicates-tree" -version = "1.0.11" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" +checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" dependencies = [ "predicates-core", "termtree", @@ -2956,11 +3157,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit 0.22.20", + "toml_edit 0.21.1", ] [[package]] @@ -2989,13 +3190,26 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] +[[package]] +name = "proc-macro2-diagnostics" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", + "yansi", +] + [[package]] name = "qstring" version = "0.7.2" @@ -3013,7 +3227,7 @@ checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -3066,9 +3280,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -3205,9 +3419,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -3217,9 +3431,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -3228,9 +3442,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" @@ -3350,9 +3564,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.24" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hash" @@ -3380,11 +3594,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.35" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -3487,7 +3701,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -3540,41 +3754,40 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.209" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.15" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", - "memchr", "ryu", "serde", ] @@ -3610,7 +3823,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -3676,7 +3889,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c9395612d493b69a522725eef78a095f199d43eeb847f4a4b77ec0cacab535" dependencies = [ - "shank_macro", + "shank_macro 0.3.0", +] + +[[package]] +name = "shank" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d894855493d4ce613b25550fe1ed1c62d0af5486b984579ba55e3f8c9631d5" +dependencies = [ + "shank_macro 0.4.2", ] [[package]] @@ -3687,8 +3909,21 @@ checksum = "8abef069c02e15f62233679b1e71f3152fac10f90b3ff89ebbad6a25b7497754" dependencies = [ "proc-macro2", "quote", - "shank_macro_impl", - "shank_render", + "shank_macro_impl 0.3.0", + "shank_render 0.3.0", + "syn 1.0.109", +] + +[[package]] +name = "shank_macro" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9bf2645f8eebde043da69200195058e7b59806705104f908a31d05ca82844ce" +dependencies = [ + "proc-macro2", + "quote", + "shank_macro_impl 0.4.2", + "shank_render 0.4.2", "syn 1.0.109", ] @@ -3705,6 +3940,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "shank_macro_impl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d0593f48acb0a722906416b1f6b8926f6571eb9af16d566a7c65427f269f50" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "serde", + "syn 1.0.109", +] + [[package]] name = "shank_render" version = "0.3.0" @@ -3713,7 +3961,18 @@ checksum = "5a2ea9c6dd95ea311b3b81e63cf4e9c808ed04b098819e6d2c4b1a467d587203" dependencies = [ "proc-macro2", "quote", - "shank_macro_impl", + "shank_macro_impl 0.3.0", +] + +[[package]] +name = "shank_render" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121175ba61809189f888dc5822ebfd30fa0d91e1e1f61d25a4d40b0847b3075e" +dependencies = [ + "proc-macro2", + "quote", + "shank_macro_impl 0.4.2", ] [[package]] @@ -3731,12 +3990,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -3856,7 +4109,7 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_cpus", - "num_enum 0.7.3", + "num_enum 0.7.2", "ouroboros", "percentage", "qualifier_attr", @@ -3916,7 +4169,7 @@ version = "1.18.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48b38e77fde55eaa036666461c61df36238416908c5a4737b59cd1b6165736dc" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.0", "futures", "solana-banks-interface", "solana-program", @@ -3988,7 +4241,7 @@ dependencies = [ "log", "memmap2", "modular-bitfield", - "num_enum 0.7.3", + "num_enum 0.7.2", "rand 0.8.5", "solana-measure", "solana-sdk", @@ -4023,7 +4276,7 @@ dependencies = [ "dashmap", "futures", "futures-util", - "indexmap 2.5.0", + "indexmap 2.2.6", "indicatif", "log", "quinn", @@ -4079,7 +4332,7 @@ dependencies = [ "bincode", "crossbeam-channel", "futures-util", - "indexmap 2.5.0", + "indexmap 2.2.6", "log", "rand 0.8.5", "rayon", @@ -4149,7 +4402,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -4270,11 +4523,11 @@ dependencies = [ "ark-serialize", "base64 0.21.7", "bincode", - "bitflags 2.6.0", + "bitflags 2.5.0", "blake3", "borsh 0.10.3", "borsh 0.9.3", - "borsh 1.5.1", + "borsh 1.5.0", "bs58 0.4.0", "bv", "bytemuck", @@ -4291,7 +4544,7 @@ dependencies = [ "light-poseidon", "log", "memoffset 0.9.0", - "num-bigint 0.4.4", + "num-bigint 0.4.5", "num-derive 0.4.2", "num-traits", "parking_lot", @@ -4546,7 +4799,7 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_cpus", - "num_enum 0.7.3", + "num_enum 0.7.2", "ouroboros", "percentage", "qualifier_attr", @@ -4599,8 +4852,8 @@ dependencies = [ "assert_matches", "base64 0.21.7", "bincode", - "bitflags 2.6.0", - "borsh 1.5.1", + "bitflags 2.5.0", + "borsh 1.5.0", "bs58 0.4.0", "bytemuck", "byteorder", @@ -4619,7 +4872,7 @@ dependencies = [ "memmap2", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.3", + "num_enum 0.7.2", "pbkdf2 0.11.0", "qstring", "qualifier_attr", @@ -4655,7 +4908,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -4706,7 +4959,7 @@ dependencies = [ "crossbeam-channel", "futures-util", "histogram", - "indexmap 2.5.0", + "indexmap 2.2.6", "itertools", "libc", "log", @@ -4766,7 +5019,7 @@ dependencies = [ "async-trait", "bincode", "futures-util", - "indexmap 2.5.0", + "indexmap 2.2.6", "indicatif", "log", "rayon", @@ -4964,11 +5217,11 @@ dependencies = [ [[package]] name = "spl-account-compression" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602499d5fe3b60280239c4656a361b283c8c5f73f769c6cf41d2e8a151ce72db" +checksum = "31f461e20e8efb539d7f3f30cd82931ee128651c6366abe326f083b07253a1d6" dependencies = [ - "anchor-lang", + "anchor-lang 0.29.0", "bytemuck", "solana-program", "spl-concurrent-merkle-tree", @@ -5009,9 +5262,9 @@ dependencies = [ [[package]] name = "spl-concurrent-merkle-tree" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f5f45b971d82cbb0416fdffad3c9098f259545d54072e83a0a482f60f8f689" +checksum = "85d1bbb97252d8a1b90d3d56425038928382a306b71dbba4c836973c94b33f96" dependencies = [ "bytemuck", "solana-program", @@ -5020,9 +5273,9 @@ dependencies = [ [[package]] name = "spl-discriminator" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" +checksum = "daa600f2fe56f32e923261719bae640d873edadbc5237681a39b8e37bfd4d263" dependencies = [ "bytemuck", "solana-program", @@ -5037,7 +5290,7 @@ checksum = "07fd7858fc4ff8fb0e34090e41d7eb06a823e1057945c26d480bfc21d2338a93" dependencies = [ "quote", "spl-discriminator-syn", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5049,7 +5302,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.76", + "syn 2.0.63", "thiserror", ] @@ -5092,9 +5345,9 @@ dependencies = [ [[package]] name = "spl-pod" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2881dddfca792737c0706fa0175345ab282b1b0879c7d877bad129645737c079" +checksum = "85a5db7e4efb1107b0b8e52a13f035437cdcb36ef99c58f6d467f089d9b2915a" dependencies = [ "borsh 0.10.3", "bytemuck", @@ -5105,9 +5358,9 @@ dependencies = [ [[package]] name = "spl-program-error" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "249e0318493b6bcf27ae9902600566c689b7dfba9f1bdff5893e92253374e78c" +checksum = "7e0657b6490196971d9e729520ba934911ff41fbb2cb9004463dbe23cf8b4b4f" dependencies = [ "num-derive 0.4.2", "num-traits", @@ -5125,7 +5378,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5144,9 +5397,9 @@ dependencies = [ [[package]] name = "spl-tlv-account-resolution" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615d381f48ddd2bb3c57c7f7fb207591a2a05054639b18a62e785117dd7a8683" +checksum = "56f335787add7fa711819f9e7c573f8145a5358a709446fe2d24bf2a88117c90" dependencies = [ "bytemuck", "solana-program", @@ -5214,7 +5467,7 @@ dependencies = [ "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.3", + "num_enum 0.7.2", "solana-program", "solana-zk-token-sdk", "spl-memo 4.0.0", @@ -5236,7 +5489,7 @@ dependencies = [ "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.3", + "num_enum 0.7.2", "solana-program", "solana-security-txt", "solana-zk-token-sdk", @@ -5305,15 +5558,15 @@ dependencies = [ "spl-discriminator", "spl-pod", "spl-program-error", - "spl-tlv-account-resolution 0.5.1", + "spl-tlv-account-resolution 0.5.2", "spl-type-length-value", ] [[package]] name = "spl-type-length-value" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a468e6f6371f9c69aae760186ea9f1a01c2908351b06a5e0026d21cfc4d7ecac" +checksum = "8f9ebd75d29c5f48de5f6a9c114e08531030b75b8ac2c557600ac7da0b73b1e8" dependencies = [ "bytemuck", "solana-program", @@ -5387,9 +5640,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.76" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", @@ -5405,7 +5658,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5449,9 +5702,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.41" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" dependencies = [ "filetime", "libc", @@ -5538,7 +5791,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5549,7 +5802,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", "test-case-core", ] @@ -5585,7 +5838,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5662,9 +5915,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.1" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -5681,13 +5934,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5782,9 +6035,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" [[package]] name = "toml_edit" @@ -5792,20 +6045,20 @@ version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.2.6", "toml_datetime", - "winnow 0.5.2", + "winnow", ] [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.2.6", "toml_datetime", - "winnow 0.6.18", + "winnow", ] [[package]] @@ -5835,7 +6088,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -5987,9 +6240,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -6059,27 +6312,26 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", - "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", "wasm-bindgen-shared", ] @@ -6097,9 +6349,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6107,22 +6359,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" @@ -6204,7 +6456,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets 0.52.5", ] [[package]] @@ -6224,18 +6476,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -6246,9 +6498,9 @@ checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -6258,9 +6510,9 @@ checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_aarch64_msvc" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -6270,15 +6522,15 @@ checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_gnu" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" [[package]] name = "windows_i686_gnullvm" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -6288,9 +6540,9 @@ checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_i686_msvc" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -6300,9 +6552,9 @@ checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnu" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -6312,9 +6564,9 @@ checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -6324,9 +6576,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "windows_x86_64_msvc" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" @@ -6337,15 +6589,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winnow" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.50.0" @@ -6385,6 +6628,12 @@ dependencies = [ "rustix", ] +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + [[package]] name = "yasna" version = "0.5.2" @@ -6396,22 +6645,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] @@ -6431,7 +6680,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.63", ] [[package]] diff --git a/programs/bubblegum/README.md b/programs/bubblegum/README.md index 9e6239d9..9deaadf8 100644 --- a/programs/bubblegum/README.md +++ b/programs/bubblegum/README.md @@ -23,15 +23,16 @@ See [README.md](https://github.com/metaplex-foundation/mpl-bubblegum/blob/main/c `Bubblegum` is the Metaplex Protocol program for creating and interacting with Metaplex compressed NFTs (cNFTs). Compressed NFTs are secured on-chain using Merkle trees. With Bubblegum you can: -* Create a tree +* Create a tree. * Delegate authority for a tree. * Mint a cNFT to a tree. -* Verify/unverify creators +* Verify/unverify creators. * Verify/unverify membership of a cNFT to a Metaplex Verified Collection. * Transfer ownership of a cNFT. * Delegate authority for a cNFT. * Burn a cNFT. * Redeem a cNFT and decompress it into an uncompressed Token Metadata NFT. +* Batch-mint a complete tree with verified creators and a single Metaplex Verified Collection. ## Background @@ -43,6 +44,10 @@ In the unlikely scenario that all RPC providers were to lose their data stores, Compressed NFTs can also be losslessly decompressed into uncompressed Metaplex NFTs. Decompression will cost rent for the Metadata and Master Edition `token-metadata` program accounts that need to be created. +### Batch operations + +As was observed, minting of assets constitutes over 90% of all operations pertaining to digital assets. In order to reduce the number of transactions and optimize the time and cost it takes to put your tree on-chain during the Solana heavy load events Metaplex has introduced the batch-mint operations. The batch extension to the Bubblegum program introduces offline Merkle tree creation, enabling users to prepare and manage Merkle trees offline before finalizing them on-chain. The resulting trees are fully compatible with the regular trees. The snapshot of the tree created is required to be stored off-chain so the replay of the tree creation is possible on any indexer. + ## Basic operation ### Creating and minting to a tree @@ -72,6 +77,52 @@ Compressed NFTs support transferring ownership, delegating authority, and burnin Redeeming a cNFT removes the leaf from the Merkle tree and creates a voucher PDA account. The voucher account can be sent to the `decompress_v1` instruction to decompress the cNFT into a Token Metadata NFT. As mentioned above this will cost rent for the Metadata and Master Edition `token-metadata` accounts that are created during the decompression process. Note that after a cNFT is redeemed but before it is decompressed, the process can be reversed using `cancel_redeem`. This puts the cNFT back into the Merkle tree. +## Batch-Mint Operations + +### Introduction +The latest extension to the Bubblegum contract introduces batch-mint operations, allowing users to mint multiple cNFTs in just several transactions, which significantly reduces on-chain overhead and optimizes minting processes for large collections. + +### How It Works +With the batch-mint operations, users can prepare an entire set of NFTs off-chain, populate them within a Merkle tree structure, and then mint them to the tree in a small number of transactions. This process is designed to handle large-scale NFT collections more efficiently. + +### Steps to Perform a Batch-Mint + +In order to simplify the Merkle tree creation and interactions we recommend using the [SDK](https://github.com/metaplex-foundation/rollup-sdk). + +To understand the batch-mint flow, let's recall the structure of a tree data account: + +``` ++--------+----------------------+-----------------+ +| Header | Tree body | Canopy | ++--------+----------------------+-----------------+ + 56 depends on the tree (2ⁿ⁺¹ - 2) * 32 + bytes depth and buffer size bytes +``` +where n is the depth of the canopy. + +1. **Prepare Tree** + - Invoke the `prepare_tree` method to initialize an account with a tree header and an empty tree body and empty canopy buffer. + - The tree is set up with initial parameters (tree size and canopy if required) but remains empty, allowing offline filling. + +2. **Fill Tree Offline** + - User populates the tree offline, ensuring all necessary leaves are in place. + - If the canopy is required, then canopy leaf nodes are populated in the process of adding asset leaves to tree. + - The final root, proof, and last leaf are prepared for submission. + +3. **Serialize and Upload the Tree** + - The offline tree is serialized and uploaded to an IPFS-like service, such as Arweave, ensuring public access. + +4. **Adding canopy (for a tree with a canopy)** + - To transfer canopy leaf nodes from offline tree to the solana tree data account the `add_canopy` method is invoked, tree body at this stage stays empty + +5. **Finalize Tree** + - To finalize the tree the methods `finalize_tree_with_root` for a tree without verified collections or `finalize_tree_with_root_and_collection` for a tree with one verified collection are used. Signatures from both the tree owner and a designated staker are required. + - The staker is responsible for ensuring the data's availability and consistency, verifying it before signing off. + +6. **Manage the Tree** + - Once the batch minting process is complete, you can manage the tree and its NFTs using all the standard Bubblegum operations. + - You can also mint additional assets into a batch-minted tree as if it's a regular tree. + ## Accounts ### 📄 `tree_authority` @@ -125,6 +176,7 @@ This instruction creates a Merkle Tree. | --------------------------------- | ------ | ---- | -- | `max_depth` | 0 | 4 | The maximum depth of the Merkle tree. The capacity of the Merkle tree is 2 ^ max_depth. | `max_buffer_size` | 4 | 4 | The minimum concurrency limit of the Merkle tree. See [Solana Program Library documentation](https://docs.rs/spl-account-compression/0.1.3/spl_account_compression/spl_account_compression/fn.init_empty_merkle_tree.html) on this for more details. +| `public` | 8 | 1 | An optional boolean indicating if the tree is public. @@ -538,3 +590,143 @@ Decompress a cNFT into an uncompressed Token Metadata NFT. This will cost rent | `data` | 0 | ~ | [`MetadataArgs`](program/src/state/metaplex_adapter.rs#L83) struct. + + +### 📄 `prepare_tree` + +Prepare a tree structure that will be used to hold multiple NFTs in a batch-mint operation. This step initializes the tree and allocates the necessary resources for subsequent operations. + +
+ Accounts + +| Name | Writable | Signer | Optional | Description | +|------------------------|:--------:|:------:|:--------:|-------------| +| `tree_authority` | ✅ | | | The [`TreeConfig`](program/src/state/mod.rs#L17) PDA account that is initialized by this instruction. | +| `merkle_tree` | ✅ | | | Unchecked account representing the Merkle tree, must be zero-initialized. | +| `payer` | ✅ | ✅ | | The account responsible for paying the transaction fees. | +| `tree_creator` | | ✅ | | The creator of the tree, who must sign the transaction. | +| `log_wrapper` | | | | The Solana Program Library Wrapper (`spl-noop`) program ID for logging. | +| `compression_program` | | | | The Solana Program Library `spl-account-compression` program ID. | +| `system_program` | | | | The Solana System Program ID. | + +
+ +
+ Arguments + +| Argument | Offset | Size | Description | +|------------------|--------|------|-------------| +| `max_depth` | 0 | 4 | The maximum depth of the Merkle tree. | +| `max_buffer_size`| 4 | 4 | The maximum buffer size for the Merkle tree. | +| `public` | 8 | 1 | An optional boolean indicating if the tree is public. | + +
+ +### 📄 `add_canopy` + +Add an optional canopy to the tree structure. A canopy is used to optimize the verification process for the tree, making it easier to validate NFT ownership. + +
+ Accounts + +| Name | Writable | Signer | Optional | Description | +|---------------------------|:--------:|:------:|:--------:|-------------| +| `tree_authority` | | | | The [`TreeConfig`](program/src/state/mod.rs#L17) PDA account previously initialized by `prepare_tree`. | +| `merkle_tree` | ✅ | | | The account representing the Merkle tree to which the canopy is being added. | +| `tree_delegate` | | ✅ | | The delegate authorized to modify the tree. | +| `log_wrapper` | | | | The Solana Program Library Wrapper (`spl-noop`) program ID for logging. | +| `compression_program` | | | | The Solana Program Library `spl-account-compression` program ID. | +| `system_program` | | | | The Solana System Program ID. | + +
+ +
+ Arguments + +| Argument | Offset | Size | Description | +|-----------------|--------|------|-------------| +| `start_index` | 0 | 4 | The starting index for the canopy nodes being added. | +| `canopy_nodes` | 4 | ??? | A vector of canopy nodes (32-byte arrays) to append to the Merkle tree. | + +
+ +### 📄 `finalize_tree_with_root` + +Finalize the tree structure by setting the Merkle root, which represents the entire batch of NFTs. This operation completes the preparation phase and makes the tree ready for usage. + +
+ Accounts + +| Name | Writable | Signer | Optional | Description | +|------------------------|:--------:|:------:|:--------:|-------------| +| `tree_authority` | ✅ | | | The [`TreeConfig`](program/src/state/mod.rs#L17) PDA account previously initialized by `prepare_tree`. | +| `merkle_tree` | ✅ | | | The account containing the Merkle tree structure. | +| `payer` | ✅ | ✅ | | The account responsible for paying the transaction fees. | +| `tree_delegate` | | ✅ | | The delegate of the tree, responsible for finalizing it. | +| `staker` | | ✅ | | The account of the staker, required to have the minimal required stake to allow batch-minting. | +| `registrar` | | | | The account representing the registrar for managing stake accounts. | +| `voter` | | | | The account representing the voting account. | +| `mining` | | | | The account representing the mining account on rewards contract. | +| `fee_receiver` | ✅ | | | The account designated to receive protocol fees. | +| `log_wrapper` | | | | The Solana Program Library Wrapper (`spl-noop`) program ID for logging. | +| `compression_program` | | | | The Solana Program Library `spl-account-compression` program ID. | +| `system_program` | | | | The Solana System Program ID. | +| _remaining accounts_ | | | ✅ | `Pubkeys`(s) that are 32-byte Keccak256 hash values that represent the nodes for this cNFT's Merkle proof. | + +
+ +
+ Arguments + +| Argument | Offset | Size | Description | +|--------------------|--------|------|-------------| +| `root` | 0 | 32 | The Merkle root hash for the tree. | +| `rightmost_leaf` | 32 | 32 | The hash of the rightmost leaf node in the tree. | +| `rightmost_index` | 64 | 4 | The index of the rightmost leaf node in the tree. | +| `_metadata_url` | 68 | ??? | A string - URL for the uploaded batch-mint json, required by indexers to fetch the tree for initialization. | +| `_metadata_hash` | ??? | ??? | A string representing a hex-encoded xxh3_128 hash of the uploaded batch-mint json-file. | + +
+ +### 📄 `finalize_tree_with_root_and_collection` + +Finalize the tree structure by setting the Merkle root and associating it with a specific NFT collection. This operation allows having a verified collection for NFTs in the batch. + +
+ Accounts + +| Name | Writable | Signer | Optional | Description | +|----------------------------------|:--------:|:------:|:--------:|-------------| +| `tree_authority` | ✅ | | | The [`TreeConfig`](program/src/state/mod.rs#L17) PDA account previously initialized by `prepare_tree`. | +| `merkle_tree` | ✅ | | | The account containing the Merkle tree structure. | +| `payer` | ✅ | ✅ | | The account responsible for paying the transaction fees. | +| `tree_delegate` | | ✅ | | The delegate of the tree, responsible for finalizing it. | +| `staker` | | ✅ | | The account of the staker, required to have the minimal required stake to allow batch-minting. | +| `collection_authority` | | ✅ | | Either the collection update authority or a delegate. | +| `registrar` | | | | The account representing the registrar for managing stake accounts. | +| `voter` | | | | The account representing the voting account. | +| `mining` | | | | The account representing the mining authority. | +| `fee_receiver` | ✅ | | | The account designated to receive protocol fees. | +| `collection_authority_record_pda`| | | ✅ | Either a metadata delegate record PDA for a collection delegate, or a legacy collection authority record PDA. | +| `collection_mint` | | | | The account representing the collection mint. | +| `collection_metadata` | ✅ | | | Metadata account of the collection. Modified in the case of a sized collection. | +| `edition_account` | | | | The account representing the Master Edition account of the collection. | +| `log_wrapper` | | | | The Solana Program Library Wrapper (`spl-noop`) program ID for logging. | +| `compression_program` | | | | The Solana Program Library `spl-account-compression` program ID. | +| `system_program` | | | | The Solana System Program ID. | +| _remaining accounts_ | | | ✅ | `Pubkeys`(s) that are 32-byte Keccak256 hash values that represent the nodes for this cNFT's Merkle proof. | + +
+ +
+ Arguments + +| Argument | Offset | Size | Description | +|--------------------|--------|------|-------------| +| `root` | 0 | 32 | The Merkle root hash for the tree. | +| `rightmost_leaf` | 32 | 32 | The hash of the rightmost leaf node in the tree. | +| `rightmost_index` | 64 | 4 | The index of the rightmost leaf node in the tree. | +| `_metadata_url` | 68 | ??? | A string - URL for the uploaded batch-mint json, required by indexers to fetch the tree for initialization. | +| `_metadata_hash` | ??? | ??? | A string representing a hex-encoded xxh3_128 hash of the uploaded batch-mint json-file. | + +
diff --git a/programs/bubblegum/program/Cargo.toml b/programs/bubblegum/program/Cargo.toml index bc35227a..771d050e 100644 --- a/programs/bubblegum/program/Cargo.toml +++ b/programs/bubblegum/program/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bubblegum" -version = "0.12.0" +version = "0.13.0" description = "NFT Compression" authors = ["Metaplex Developers "] repository = "https://github.com/metaplex-foundation/mpl-bubblegum" @@ -17,7 +17,9 @@ no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] test-sbf = [] -default = [] +default = ["mainnet"] +mainnet = ["mpl-common-constants/mainnet"] +devnet = ["mpl-common-constants/devnet"] [dependencies] anchor-lang = { version = "0.29.0", features = ["init-if-needed"] } @@ -26,15 +28,18 @@ bytemuck = "1.13.0" mpl-token-metadata = "4.1.2" num-traits = "0.2.15" solana-program = "~1.18.15" -spl-account-compression = { version = "0.3.1", features = ["cpi"] } +spl-account-compression = { version = "0.4.0", features = ["cpi"] } spl-associated-token-account = { version = ">= 1.1.3, < 3.0", features = ["no-entrypoint"] } spl-token = { version = ">= 3.5.0, < 5.0", features = ["no-entrypoint"] } +mplx-staking-states = { git = "https://github.com/metaplex-foundation/aura-staking.git" } +mplx-rewards = { git = "https://github.com/metaplex-foundation/aura-rewards.git", features = ["no-entrypoint"] } +mpl-common-constants = { git = "https://github.com/adm-metaex/mpl-common-constants.git", branch = "main" } [dev-dependencies] async-trait = "0.1.71" mpl-token-auth-rules = { version = "1.5.1", features = ["no-entrypoint"] } solana-program-test = "~1.18.15" solana-sdk = "~1.18.15" -spl-concurrent-merkle-tree = "0.3.0" +spl-concurrent-merkle-tree = "0.4.0" spl-merkle-tree-reference = "0.1.0" spl-noop = { version = "0.2.0", features = ["no-entrypoint"] } diff --git a/programs/bubblegum/program/src/error.rs b/programs/bubblegum/program/src/error.rs index 8b4fdce5..636d7344 100644 --- a/programs/bubblegum/program/src/error.rs +++ b/programs/bubblegum/program/src/error.rs @@ -88,6 +88,26 @@ pub enum BubblegumError { InvalidTokenStandard, #[msg("Canopy size should be set bigger for this tree")] InvalidCanopySize, + #[msg("Not enough tokens staked to call this instruction")] + NotEnoughStakeForOperation, + #[msg("Staking registrar mismatch")] + StakingRegistrarMismatch, + #[msg("Staking voter mismatch")] + StakingVoterMismatch, + #[msg("Fee receiver mismatch")] + FeeReceiverMismatch, + #[msg("Staking registrar realm mismatch")] + StakingRegistrarRealmMismatch, + #[msg("Staking registrar discriminator mismatch")] + StakingRegistrarDiscriminatorMismatch, + #[msg("Staking voter discriminator mismatch")] + StakingVoterDiscriminatorMismatch, + #[msg("Staking voter registrar mismatch")] + StakingVoterRegistrarMismatch, + #[msg("Staking voter authority mismatch")] + StakingVoterAuthorityMismatch, + #[msg("Invalid mining owner")] + MiningOwnerMismatch, } // Converts certain Token Metadata errors into Bubblegum equivalents diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index fc73b650..27548d78 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -37,6 +37,10 @@ pub enum InstructionName { MintToCollectionV1, SetDecompressibleState, UpdateMetadata, + FinalizeTreeWithRoot, + FinalizeTreeWithRootAndCollection, + PrepareTree, + AddCanopy, } pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { @@ -55,6 +59,8 @@ pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { [54, 85, 76, 70, 228, 250, 164, 81] => InstructionName::DecompressV1, [116, 110, 29, 56, 107, 219, 42, 93] => InstructionName::Burn, [82, 193, 176, 117, 176, 21, 115, 253] => InstructionName::Compress, + [77, 73, 220, 153, 126, 225, 64, 204] => InstructionName::FinalizeTreeWithRoot, + [194, 98, 45, 168, 183, 72, 67, 155] => InstructionName::FinalizeTreeWithRootAndCollection, [165, 83, 136, 142, 89, 202, 47, 220] => InstructionName::CreateTree, [52, 17, 96, 132, 71, 4, 85, 194] => InstructionName::VerifyCreator, [107, 178, 57, 39, 105, 115, 112, 152] => InstructionName::UnverifyCreator, @@ -65,6 +71,8 @@ pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { // `SetDecompressableState` instruction mapped to `SetDecompressibleState` instruction [18, 135, 238, 168, 246, 195, 61, 115] => InstructionName::SetDecompressibleState, [170, 182, 43, 239, 97, 78, 225, 186] => InstructionName::UpdateMetadata, + [41, 56, 189, 77, 58, 12, 142, 71] => InstructionName::PrepareTree, + [247, 118, 145, 92, 84, 66, 207, 25] => InstructionName::AddCanopy, _ => InstructionName::Unknown, } } @@ -98,9 +106,26 @@ pub mod bubblegum { processor::compress(ctx) } + pub fn prepare_tree<'info>( + ctx: Context<'_, '_, '_, 'info, PrepareTree<'info>>, + max_depth: u32, + max_buffer_size: u32, + public: Option, + ) -> Result<()> { + processor::prepare_tree(ctx, max_depth, max_buffer_size, public) + } + + pub fn add_canopy<'info>( + ctx: Context<'_, '_, '_, 'info, AddCanopy<'info>>, + start_index: u32, + canopy_nodes: Vec<[u8; 32]>, + ) -> Result<()> { + processor::add_canopy(ctx, start_index, canopy_nodes) + } + /// Creates a new tree. - pub fn create_tree( - ctx: Context, + pub fn create_tree<'info>( + ctx: Context<'_, '_, '_, 'info, CreateTree<'info>>, max_depth: u32, max_buffer_size: u32, public: Option, @@ -108,6 +133,42 @@ pub mod bubblegum { processor::create_tree(ctx, max_depth, max_buffer_size, public) } + pub(crate) fn finalize_tree_with_root<'info>( + ctx: Context<'_, '_, '_, 'info, FinalizeTreeWithRoot<'info>>, + root: [u8; 32], + rightmost_leaf: [u8; 32], + rightmost_index: u32, + metadata_url: String, + metadata_hash: String, + ) -> Result<()> { + processor::finalize_tree_with_root( + ctx, + root, + rightmost_leaf, + rightmost_index, + metadata_url, + metadata_hash, + ) + } + + pub(crate) fn finalize_tree_with_root_and_collection<'info>( + ctx: Context<'_, '_, '_, 'info, FinalizeTreeWithRootAndCollection<'info>>, + root: [u8; 32], + rightmost_leaf: [u8; 32], + rightmost_index: u32, + metadata_url: String, + metadata_hash: String, + ) -> Result<()> { + processor::finalize_tree_with_root_and_collection( + ctx, + root, + rightmost_leaf, + rightmost_index, + metadata_url, + metadata_hash, + ) + } + /// Decompresses a leaf node from the tree. pub fn decompress_v1(ctx: Context, metadata: MetadataArgs) -> Result<()> { processor::decompress_v1(ctx, metadata) diff --git a/programs/bubblegum/program/src/processor/add_canopy.rs b/programs/bubblegum/program/src/processor/add_canopy.rs new file mode 100644 index 00000000..e3f28fcd --- /dev/null +++ b/programs/bubblegum/program/src/processor/add_canopy.rs @@ -0,0 +1,53 @@ +use anchor_lang::{prelude::*, system_program::System}; +use spl_account_compression::{program::SplAccountCompression, Noop}; + +use crate::{error::BubblegumError, state::TreeConfig}; + +#[derive(Accounts)] +pub struct AddCanopy<'info> { + #[account( + seeds = [merkle_tree.key().as_ref()], + bump, + )] + pub tree_authority: Account<'info, TreeConfig>, + #[account(mut)] + /// CHECK: + pub merkle_tree: UncheckedAccount<'info>, + pub tree_delegate: Signer<'info>, + pub log_wrapper: Program<'info, Noop>, + pub compression_program: Program<'info, SplAccountCompression>, + pub system_program: Program<'info, System>, +} + +pub(crate) fn add_canopy<'info>( + ctx: Context<'_, '_, '_, 'info, AddCanopy<'info>>, + start_index: u32, + canopy_nodes: Vec<[u8; 32]>, +) -> Result<()> { + let incoming_tree_delegate = ctx.accounts.tree_delegate.key(); + let authority = &ctx.accounts.tree_authority; + + // incoming_tree_delegate is the tree owner as set in prepare tree, it's required to do any modificaitons to the tree, + // including the canopy setup + require!( + incoming_tree_delegate == authority.tree_delegate, + BubblegumError::TreeAuthorityIncorrect, + ); + + let merkle_tree = ctx.accounts.merkle_tree.to_account_info(); + let seed = merkle_tree.key(); + let seeds = &[seed.as_ref(), &[ctx.bumps.tree_authority]]; + + let authority_pda_signer = &[&seeds[..]]; + + let cpi_ctx = CpiContext::new_with_signer( + ctx.accounts.compression_program.to_account_info(), + spl_account_compression::cpi::accounts::Modify { + merkle_tree, + authority: ctx.accounts.tree_authority.to_account_info(), + noop: ctx.accounts.log_wrapper.to_account_info(), + }, + authority_pda_signer, + ); + spl_account_compression::cpi::append_canopy_nodes(cpi_ctx, start_index, canopy_nodes) +} diff --git a/programs/bubblegum/program/src/processor/create_tree.rs b/programs/bubblegum/program/src/processor/create_tree.rs index 20151618..8d6fcbdc 100644 --- a/programs/bubblegum/program/src/processor/create_tree.rs +++ b/programs/bubblegum/program/src/processor/create_tree.rs @@ -1,21 +1,11 @@ -use bytemuck::cast_slice; - use anchor_lang::{prelude::*, system_program::System}; -use spl_account_compression::{ - program::SplAccountCompression, - state::{ - merkle_tree_get_size, ConcurrentMerkleTreeHeader, CONCURRENT_MERKLE_TREE_HEADER_SIZE_V1, - }, - Node, Noop, -}; +use spl_account_compression::{program::SplAccountCompression, Noop}; use crate::{ - error::BubblegumError, state::{DecompressibleState, TreeConfig, TREE_AUTHORITY_SIZE}, + utils::check_canopy_size, }; -pub const MAX_ACC_PROOFS_SIZE: u32 = 17; - #[derive(Accounts)] pub struct CreateTree<'info> { #[account( @@ -37,15 +27,20 @@ pub struct CreateTree<'info> { pub system_program: Program<'info, System>, } -pub(crate) fn create_tree( - ctx: Context, +pub(crate) fn create_tree<'info>( + ctx: Context<'_, '_, '_, 'info, CreateTree<'info>>, max_depth: u32, max_buffer_size: u32, public: Option, ) -> Result<()> { let merkle_tree = ctx.accounts.merkle_tree.to_account_info(); - check_canopy_size(&ctx, max_depth, max_buffer_size)?; + check_canopy_size( + ctx.accounts.merkle_tree.to_account_info(), + ctx.accounts.tree_authority.to_account_info(), + max_depth, + max_buffer_size, + )?; let seed = merkle_tree.key(); let seeds = &[seed.as_ref(), &[ctx.bumps.tree_authority]]; @@ -70,68 +65,3 @@ pub(crate) fn create_tree( ); spl_account_compression::cpi::init_empty_merkle_tree(cpi_ctx, max_depth, max_buffer_size) } - -fn check_canopy_size( - ctx: &Context, - max_depth: u32, - max_buffer_size: u32, -) -> Result<()> { - let merkle_tree_bytes = ctx.accounts.merkle_tree.data.borrow(); - - let (header_bytes, rest) = merkle_tree_bytes.split_at(CONCURRENT_MERKLE_TREE_HEADER_SIZE_V1); - - let mut header = ConcurrentMerkleTreeHeader::try_from_slice(header_bytes)?; - header.initialize( - max_depth, - max_buffer_size, - &ctx.accounts.tree_authority.key(), - Clock::get()?.slot, - ); - - let merkle_tree_size = merkle_tree_get_size(&header)?; - - let (_tree_bytes, canopy_bytes) = rest.split_at(merkle_tree_size); - - let canopy = cast_slice::(canopy_bytes); - - let cached_path_len = get_cached_path_length(canopy, max_depth)?; - - let required_canopy = max_depth.saturating_sub(MAX_ACC_PROOFS_SIZE); - - require!( - (cached_path_len as u32) >= required_canopy, - BubblegumError::InvalidCanopySize - ); - - Ok(()) -} - -// Method is taken from account-compression Solana program -#[inline(always)] -fn get_cached_path_length(canopy: &[Node], max_depth: u32) -> Result { - // The offset of 2 is applied because the canopy is a full binary tree without the root node - // Size: (2^n - 2) -> Size + 2 must be a power of 2 - let closest_power_of_2 = (canopy.len() + 2) as u32; - // This expression will return true if `closest_power_of_2` is actually a power of 2 - if closest_power_of_2 & (closest_power_of_2 - 1) == 0 { - // (1 << max_depth) returns the number of leaves in the full merkle tree - // (1 << (max_depth + 1)) - 1 returns the number of nodes in the full tree - // The canopy size cannot exceed the size of the tree - if closest_power_of_2 > (1 << (max_depth + 1)) { - msg!( - "Canopy size is too large. Size: {}. Max size: {}", - closest_power_of_2 - 2, - (1 << (max_depth + 1)) - 2 - ); - return err!(BubblegumError::InvalidCanopySize); - } - } else { - msg!( - "Canopy length {} is not 2 less than a power of 2", - canopy.len() - ); - return err!(BubblegumError::InvalidCanopySize); - } - // 1 is subtracted from the trailing zeros because the root is not stored in the canopy - Ok(closest_power_of_2.trailing_zeros() - 1) -} diff --git a/programs/bubblegum/program/src/processor/finalize_tree_with_root.rs b/programs/bubblegum/program/src/processor/finalize_tree_with_root.rs new file mode 100644 index 00000000..272b02af --- /dev/null +++ b/programs/bubblegum/program/src/processor/finalize_tree_with_root.rs @@ -0,0 +1,292 @@ +use anchor_lang::{prelude::*, solana_program::clock::Clock, system_program::System}; +use mplx_staking_states::state::{registrar::Registrar, Voter, REGISTRAR_DISCRIMINATOR}; +use spl_account_compression::{program::SplAccountCompression, Noop}; + +use crate::{ + error::BubblegumError, + state::{ + TreeConfig, MINIMUM_WEIGHTED_STAKE, PROTOCOL_FEE_PER_1024_ASSETS, VOTER_DISCRIMINATOR, + }, +}; + +use mpl_common_constants::constants::{DAO_GOVERNING_MINT, DAO_PUBKEY, FEE_RECEIVER}; + +const DISCRIMINATOR_LEN: usize = REGISTRAR_DISCRIMINATOR.len(); + +const DAO_GOVERNING_MINT_PUBKEY: Pubkey = Pubkey::new_from_array(DAO_GOVERNING_MINT); + +const DAO_KEY: Pubkey = Pubkey::new_from_array(DAO_PUBKEY); + +const FEE_RECEIVER_PUBKEY: Pubkey = Pubkey::new_from_array(FEE_RECEIVER); + +#[derive(Accounts)] +pub struct FinalizeTreeWithRoot<'info> { + #[account( + mut, + seeds = [merkle_tree.key().as_ref()], + bump, + )] + pub tree_authority: Account<'info, TreeConfig>, + #[account(mut)] + /// CHECK: + pub merkle_tree: UncheckedAccount<'info>, + #[account(mut)] + pub payer: Signer<'info>, + pub tree_delegate: Signer<'info>, + pub staker: Signer<'info>, + /// CHECK: + pub registrar: UncheckedAccount<'info>, + /// CHECK: + pub voter: UncheckedAccount<'info>, + /// CHECK: + pub mining: UncheckedAccount<'info>, + /// CHECK: + #[account(mut)] + pub fee_receiver: UncheckedAccount<'info>, + pub log_wrapper: Program<'info, Noop>, + pub compression_program: Program<'info, SplAccountCompression>, + pub system_program: Program<'info, System>, +} + +pub(crate) fn finalize_tree_with_root<'info>( + ctx: Context<'_, '_, '_, 'info, FinalizeTreeWithRoot<'info>>, + root: [u8; 32], + rightmost_leaf: [u8; 32], + rightmost_index: u32, + _metadata_url: String, + _metadata_hash: String, +) -> Result<()> { + let incoming_tree_delegate = ctx.accounts.tree_delegate.key(); + let authority = &mut ctx.accounts.tree_authority; + + require!( + incoming_tree_delegate == authority.tree_delegate, + BubblegumError::TreeAuthorityIncorrect, + ); + + require!( + ctx.accounts.fee_receiver.key == &FEE_RECEIVER_PUBKEY, + BubblegumError::FeeReceiverMismatch + ); + check_stake( + &ctx.accounts.staker.to_account_info(), + &ctx.accounts.registrar.to_account_info(), + &ctx.accounts.voter.to_account_info(), + &ctx.accounts.mining.to_account_info(), + )?; + + let num_minted = (rightmost_index + 1) as u64; + // charge protocol fees + let fee = calculate_protocol_fee_lamports(num_minted); + let transfer_instruction = anchor_lang::solana_program::system_instruction::transfer( + &ctx.accounts.payer.key(), + &ctx.accounts.fee_receiver.key(), + fee, + ); + anchor_lang::solana_program::program::invoke( + &transfer_instruction, + &[ + ctx.accounts.payer.to_account_info(), + ctx.accounts.fee_receiver.to_account_info(), + ctx.accounts.system_program.to_account_info(), + ], + )?; + + let merkle_tree = ctx.accounts.merkle_tree.to_account_info(); + let seed = merkle_tree.key(); + let seeds = &[seed.as_ref(), &[ctx.bumps.tree_authority]]; + + if !authority.contains_mint_capacity(num_minted) { + return Err(BubblegumError::InsufficientMintCapacity.into()); + } + authority.increment_mint_count_by(num_minted); + let authority_pda_signer = &[&seeds[..]]; + + finalize_tree( + root, + rightmost_leaf, + rightmost_index, + &ctx.accounts.compression_program.to_account_info(), + &ctx.accounts.tree_authority.to_account_info(), + &merkle_tree, + &ctx.accounts.log_wrapper.to_account_info(), + authority_pda_signer, + ctx.remaining_accounts, + ) +} + +pub(crate) fn check_stake<'info>( + staker_acc: &AccountInfo<'info>, + registrar_acc: &AccountInfo<'info>, + voter_acc: &AccountInfo<'info>, + mining_acc: &AccountInfo<'info>, +) -> Result<()> { + require!( + registrar_acc.owner == &mplx_staking_states::ID, + BubblegumError::StakingRegistrarMismatch + ); + require!( + voter_acc.owner == &mplx_staking_states::ID, + BubblegumError::StakingVoterMismatch + ); + require!( + mining_acc.owner == &mplx_rewards::ID, + BubblegumError::MiningOwnerMismatch + ); + + let generated_registrar = Pubkey::find_program_address( + &[ + DAO_PUBKEY.as_ref(), + b"registrar".as_ref(), + DAO_GOVERNING_MINT.as_ref(), + ], + &mplx_staking_states::ID, + ) + .0; + require!( + &generated_registrar == registrar_acc.key, + BubblegumError::StakingRegistrarMismatch + ); + + let generated_voter_key = Pubkey::find_program_address( + &[ + registrar_acc.key.to_bytes().as_ref(), + b"voter".as_ref(), + staker_acc.key.to_bytes().as_ref(), + ], + &mplx_staking_states::ID, + ) + .0; + require!( + &generated_voter_key == voter_acc.key, + BubblegumError::StakingVoterMismatch + ); + + let registrar_bytes = registrar_acc.to_account_info().data; + let registrar_bytes = registrar_bytes.borrow(); + require!( + registrar_bytes[..DISCRIMINATOR_LEN] == REGISTRAR_DISCRIMINATOR, + BubblegumError::StakingRegistrarDiscriminatorMismatch + ); + + let registrar: &Registrar = bytemuck::from_bytes(®istrar_bytes[DISCRIMINATOR_LEN..]); + + require!( + registrar.realm == DAO_KEY, + BubblegumError::StakingRegistrarRealmMismatch + ); + require!( + registrar.realm_governing_token_mint == DAO_GOVERNING_MINT_PUBKEY, + BubblegumError::StakingRegistrarRealmMismatch + ); + let voter_bytes = voter_acc.to_account_info().data; + + let voter_bytes = voter_bytes.borrow(); + require!( + voter_bytes[..DISCRIMINATOR_LEN] == VOTER_DISCRIMINATOR, + BubblegumError::StakingVoterDiscriminatorMismatch + ); + let voter: &Voter = bytemuck::from_bytes(&voter_bytes[DISCRIMINATOR_LEN..]); + + require!( + &voter.registrar == registrar_acc.key, + BubblegumError::StakingVoterRegistrarMismatch + ); + require!( + &voter.voter_authority == staker_acc.key, + BubblegumError::StakingVoterAuthorityMismatch + ); + let mining_data = mining_acc.data.borrow(); + let mining = mplx_rewards::state::WrappedImmutableMining::from_bytes(&mining_data)?; + require!( + &mining.mining.owner == staker_acc.key, + BubblegumError::MiningOwnerMismatch + ); + let clock = Clock::get()?; + let curr_ts = clock.unix_timestamp as u64; + let weighted_sum: u64 = voter + .deposits + .iter() + .map(|d| d.weighted_stake(curr_ts)) + .sum(); + + if weighted_sum + .checked_add(mining.mining.stake_from_others) + .ok_or(BubblegumError::NumericalOverflowError)? + < MINIMUM_WEIGHTED_STAKE + { + return Err(BubblegumError::NotEnoughStakeForOperation.into()); + } + + Ok(()) +} + +pub(crate) fn finalize_tree<'info>( + root: [u8; 32], + rightmost_leaf: [u8; 32], + rightmost_index: u32, + compression_program: &AccountInfo<'info>, + tree_authority: &AccountInfo<'info>, + merkle_tree: &AccountInfo<'info>, + noop: &AccountInfo<'info>, + authority_pda_signer: &[&[&[u8]]; 1], + remaining_accounts: &[AccountInfo<'info>], +) -> Result<()> { + let cpi_ctx = CpiContext::new_with_signer( + compression_program.clone(), + spl_account_compression::cpi::accounts::Modify { + merkle_tree: merkle_tree.clone(), + authority: tree_authority.clone(), + noop: noop.clone(), + }, + authority_pda_signer, + ) + .with_remaining_accounts(remaining_accounts.to_vec()); + spl_account_compression::cpi::init_prepared_tree_with_root( + cpi_ctx, + root, + rightmost_leaf, + rightmost_index, + ) +} + +fn calculate_protocol_fee_lamports(number_of_assets: u64) -> u64 { + // Round to the nearest higher multiple of 1024 + let num_1024_chunks = (number_of_assets + 1023) / 1024; + num_1024_chunks * PROTOCOL_FEE_PER_1024_ASSETS +} + +#[test] +fn test_calculate_protocol_fee_lamports() { + let mut number_of_assets = 1; + let lamports_fee_for_single_asset_tree = calculate_protocol_fee_lamports(number_of_assets); + assert_eq!( + lamports_fee_for_single_asset_tree, + PROTOCOL_FEE_PER_1024_ASSETS + ); + + number_of_assets = 1023; + let lamports_fee_for_1023_assets_tree = calculate_protocol_fee_lamports(number_of_assets); + assert_eq!( + lamports_fee_for_1023_assets_tree, + PROTOCOL_FEE_PER_1024_ASSETS + ); + + number_of_assets = 1024; + let lamports_fee_for_1024_assets_tree = calculate_protocol_fee_lamports(number_of_assets); + assert_eq!( + lamports_fee_for_1024_assets_tree, + PROTOCOL_FEE_PER_1024_ASSETS + ); + + number_of_assets = 1025; + let lamports_fee_for_1025_assets_tree = calculate_protocol_fee_lamports(number_of_assets); + assert_eq!( + lamports_fee_for_1025_assets_tree, + PROTOCOL_FEE_PER_1024_ASSETS * 2 + ); + + number_of_assets = 1_000_000; + let lamports_fee_for_million_assets_tree = calculate_protocol_fee_lamports(number_of_assets); + assert_eq!(lamports_fee_for_million_assets_tree, 1250560000); +} diff --git a/programs/bubblegum/program/src/processor/finalize_tree_with_root_and_collection.rs b/programs/bubblegum/program/src/processor/finalize_tree_with_root_and_collection.rs new file mode 100644 index 00000000..2b69d6a2 --- /dev/null +++ b/programs/bubblegum/program/src/processor/finalize_tree_with_root_and_collection.rs @@ -0,0 +1,115 @@ +use crate::{ + processor::process_collection_verification_mpl_only, + state::{metaplex_adapter::Collection, metaplex_anchor::TokenMetadata, TreeConfig}, + FinalizeTreeWithRoot, FinalizeTreeWithRootBumps, +}; +use anchor_lang::{prelude::*, system_program::System}; +use spl_account_compression::{program::SplAccountCompression, Noop}; + +#[derive(Accounts)] +pub struct FinalizeTreeWithRootAndCollection<'info> { + #[account( + mut, + seeds = [merkle_tree.key().as_ref()], + bump, + )] + pub tree_authority: Account<'info, TreeConfig>, + #[account(mut)] + /// CHECK: + pub merkle_tree: UncheckedAccount<'info>, + #[account(mut)] + pub payer: Signer<'info>, + pub tree_delegate: Signer<'info>, + pub staker: Signer<'info>, + pub collection_authority: Signer<'info>, + /// CHECK: + pub registrar: UncheckedAccount<'info>, + /// CHECK: + pub voter: UncheckedAccount<'info>, + /// CHECK: + pub mining: UncheckedAccount<'info>, + /// CHECK: + #[account(mut)] + pub fee_receiver: UncheckedAccount<'info>, + /// CHECK: Optional collection authority record PDA. + /// If there is no collecton authority record PDA then + /// this must be the Bubblegum program address. + pub collection_authority_record_pda: UncheckedAccount<'info>, + /// CHECK: This account is checked in the instruction + pub collection_mint: UncheckedAccount<'info>, + #[account(mut)] + pub collection_metadata: Box>, + /// CHECK: This account is checked in the instruction + pub edition_account: UncheckedAccount<'info>, + pub log_wrapper: Program<'info, Noop>, + pub compression_program: Program<'info, SplAccountCompression>, + pub system_program: Program<'info, System>, +} + +pub(crate) fn finalize_tree_with_root_and_collection<'info>( + ctx: Context<'_, '_, '_, 'info, FinalizeTreeWithRootAndCollection<'info>>, + root: [u8; 32], + rightmost_leaf: [u8; 32], + rightmost_index: u32, + metadata_url: String, + metadata_hash: String, +) -> Result<()> { + let mut collection = Some(Collection { + verified: false, + key: ctx.accounts.collection_mint.key(), + }); + process_collection_verification_mpl_only( + &ctx.accounts.collection_metadata, + &ctx.accounts.collection_mint.to_account_info(), + &ctx.accounts.collection_authority.to_account_info(), + &ctx.accounts + .collection_authority_record_pda + .to_account_info(), + &ctx.accounts.edition_account.to_account_info(), + &mut collection, + true, + )?; + let mut accs: FinalizeTreeWithRoot<'info> = ctx.accounts.into(); + let bumps: FinalizeTreeWithRootBumps = ctx.bumps.into(); + let ctx = Context::<'_, '_, '_, 'info, FinalizeTreeWithRoot<'info>>::new( + ctx.program_id, + &mut accs, + ctx.remaining_accounts, + bumps, + ); + crate::processor::finalize_tree_with_root( + ctx, + root, + rightmost_leaf, + rightmost_index, + metadata_url, + metadata_hash, + ) +} + +impl<'info> From<&mut FinalizeTreeWithRootAndCollection<'info>> for FinalizeTreeWithRoot<'info> { + fn from(value: &mut FinalizeTreeWithRootAndCollection<'info>) -> Self { + Self { + tree_authority: value.tree_authority.to_owned(), + merkle_tree: value.merkle_tree.to_owned(), + payer: value.payer.to_owned(), + tree_delegate: value.tree_delegate.to_owned(), + staker: value.staker.to_owned(), + registrar: value.registrar.to_owned(), + voter: value.voter.to_owned(), + mining: value.mining.to_owned(), + fee_receiver: value.fee_receiver.to_owned(), + log_wrapper: value.log_wrapper.to_owned(), + compression_program: value.compression_program.to_owned(), + system_program: value.system_program.to_owned(), + } + } +} + +impl From for FinalizeTreeWithRootBumps { + fn from(value: FinalizeTreeWithRootAndCollectionBumps) -> Self { + Self { + tree_authority: value.tree_authority, + } + } +} diff --git a/programs/bubblegum/program/src/processor/mint_to_collection.rs b/programs/bubblegum/program/src/processor/mint_to_collection.rs index 3f59d0d6..bb89ae52 100644 --- a/programs/bubblegum/program/src/processor/mint_to_collection.rs +++ b/programs/bubblegum/program/src/processor/mint_to_collection.rs @@ -105,7 +105,7 @@ pub(crate) fn mint_to_collection_v1( &collection_authority, &collection_authority_record_pda, &edition_account, - &mut message, + &mut message.collection, true, )?; diff --git a/programs/bubblegum/program/src/processor/mod.rs b/programs/bubblegum/program/src/processor/mod.rs index e3d5e113..f7238f78 100644 --- a/programs/bubblegum/program/src/processor/mod.rs +++ b/programs/bubblegum/program/src/processor/mod.rs @@ -14,14 +14,18 @@ use crate::{ utils::{get_asset_id, hash_creators, hash_metadata, replace_leaf}, }; +mod add_canopy; mod burn; mod cancel_redeem; mod compress; mod create_tree; mod decompress; mod delegate; +mod finalize_tree_with_root; +mod finalize_tree_with_root_and_collection; mod mint; mod mint_to_collection; +mod prepare_tree; mod redeem; mod set_and_verify_collection; mod set_decompressible_state; @@ -33,14 +37,18 @@ mod update_metadata; mod verify_collection; mod verify_creator; +pub(crate) use add_canopy::*; pub(crate) use burn::*; pub(crate) use cancel_redeem::*; pub(crate) use compress::*; pub(crate) use create_tree::*; pub(crate) use decompress::*; pub(crate) use delegate::*; +pub(crate) use finalize_tree_with_root::*; +pub(crate) use finalize_tree_with_root_and_collection::*; pub(crate) use mint::*; pub(crate) use mint_to_collection::*; +pub(crate) use prepare_tree::*; pub(crate) use redeem::*; pub(crate) use set_and_verify_collection::*; pub(crate) use set_decompressible_state::*; @@ -160,15 +168,16 @@ fn process_collection_verification_mpl_only<'info>( collection_authority: &AccountInfo<'info>, collection_authority_record_pda: &AccountInfo<'info>, edition_account: &AccountInfo<'info>, - message: &mut MetadataArgs, + mut message_collection: &mut Option, verify: bool, ) -> Result<()> { // See if a collection authority record PDA was provided. - let collection_authority_record = if collection_authority_record_pda.key() == crate::id() { - None - } else { - Some(collection_authority_record_pda) - }; + let collection_authority_record: Option<&AccountInfo<'info>> = + if collection_authority_record_pda.key() == crate::id() { + None + } else { + Some(collection_authority_record_pda) + }; // Verify correct account ownerships. require!( @@ -185,7 +194,7 @@ fn process_collection_verification_mpl_only<'info>( ); // If the NFT has collection data, we set it to the correct value after doing some validation. - if let Some(collection) = &mut message.collection { + if let Some(collection) = &mut message_collection { assert_collection_membership( &Some(collection.adapt()), collection_metadata, @@ -267,7 +276,7 @@ fn process_collection_verification<'info>( &collection_authority, &collection_authority_record_pda, &edition_account, - &mut message, + &mut message.collection, verify, )?; diff --git a/programs/bubblegum/program/src/processor/prepare_tree.rs b/programs/bubblegum/program/src/processor/prepare_tree.rs new file mode 100644 index 00000000..bf091eb8 --- /dev/null +++ b/programs/bubblegum/program/src/processor/prepare_tree.rs @@ -0,0 +1,77 @@ +use anchor_lang::{prelude::*, system_program::System}; +use spl_account_compression::{program::SplAccountCompression, Noop}; + +use crate::{ + state::{DecompressibleState, TreeConfig, TREE_AUTHORITY_SIZE}, + utils::check_canopy_size, +}; + +#[derive(Accounts)] +pub struct PrepareTree<'info> { + #[account( + init, + seeds = [merkle_tree.key().as_ref()], + payer = payer, + space = TREE_AUTHORITY_SIZE, + bump, + )] + pub tree_authority: Account<'info, TreeConfig>, + #[account(zero)] + /// CHECK: This account must be all zeros + pub merkle_tree: UncheckedAccount<'info>, + #[account(mut)] + pub payer: Signer<'info>, + pub tree_creator: Signer<'info>, + pub log_wrapper: Program<'info, Noop>, + pub compression_program: Program<'info, SplAccountCompression>, + pub system_program: Program<'info, System>, +} + +pub(crate) fn prepare_tree<'info>( + ctx: Context<'_, '_, '_, 'info, PrepareTree<'info>>, + max_depth: u32, + max_buffer_size: u32, + public: Option, +) -> Result<()> { + check_canopy_size( + ctx.accounts.merkle_tree.to_account_info(), + ctx.accounts.tree_authority.to_account_info(), + max_depth, + max_buffer_size, + )?; + + let authority = &mut ctx.accounts.tree_authority; + authority.set_inner(TreeConfig { + tree_creator: ctx.accounts.tree_creator.key(), + tree_delegate: ctx.accounts.tree_creator.key(), + total_mint_capacity: 1 << max_depth, + num_minted: 0, + is_public: public.unwrap_or(false), + is_decompressible: DecompressibleState::Disabled, + }); + + prep_tree_cpi_call(ctx, max_depth, max_buffer_size) +} + +#[inline(always)] +fn prep_tree_cpi_call<'info>( + ctx: Context<'_, '_, '_, 'info, PrepareTree<'info>>, + max_depth: u32, + max_buffer_size: u32, +) -> Result<()> { + let merkle_tree = ctx.accounts.merkle_tree.to_account_info(); + let seed = merkle_tree.key(); + let seeds: &[&[u8]; 2] = &[seed.as_ref(), &[ctx.bumps.tree_authority]]; + let authority_pda_signer = &[&seeds[..]]; + + let cpi_ctx = CpiContext::new_with_signer( + ctx.accounts.compression_program.to_account_info(), + spl_account_compression::cpi::accounts::Initialize { + merkle_tree, + authority: ctx.accounts.tree_authority.to_account_info(), + noop: ctx.accounts.log_wrapper.to_account_info(), + }, + authority_pda_signer, + ); + spl_account_compression::cpi::prepare_batch_merkle_tree(cpi_ctx, max_depth, max_buffer_size) +} diff --git a/programs/bubblegum/program/src/state/mod.rs b/programs/bubblegum/program/src/state/mod.rs index 3ca74245..a1f5bd9d 100644 --- a/programs/bubblegum/program/src/state/mod.rs +++ b/programs/bubblegum/program/src/state/mod.rs @@ -12,6 +12,14 @@ pub const VOUCHER_PREFIX: &str = "voucher"; pub const ASSET_PREFIX: &str = "asset"; pub const COLLECTION_CPI_PREFIX: &str = "collection_cpi"; +pub const MAX_ACC_PROOFS_SIZE: u32 = 17; + +pub const VOTER_DISCRIMINATOR: [u8; 8] = [241, 93, 35, 191, 254, 147, 17, 202]; + +pub const MINIMUM_WEIGHTED_STAKE: u64 = 30_000_000_000_000; // 30 weighted MPLX + +pub const PROTOCOL_FEE_PER_1024_ASSETS: u64 = 1_280_000; // 0.00128 SOL in lamports + #[account] #[derive(Copy, Debug, PartialEq, Eq)] pub struct TreeConfig { @@ -28,6 +36,10 @@ impl TreeConfig { self.num_minted = self.num_minted.saturating_add(1); } + pub fn increment_mint_count_by(&mut self, count: u64) { + self.num_minted = self.num_minted.saturating_add(count); + } + pub fn contains_mint_capacity(&self, requested_capacity: u64) -> bool { let remaining_mints = self.total_mint_capacity.saturating_sub(self.num_minted); requested_capacity <= remaining_mints diff --git a/programs/bubblegum/program/src/utils.rs b/programs/bubblegum/program/src/utils.rs index 3dfc915a..29312a5a 100644 --- a/programs/bubblegum/program/src/utils.rs +++ b/programs/bubblegum/program/src/utils.rs @@ -1,13 +1,22 @@ -use crate::state::{ - metaplex_adapter::{Creator, MetadataArgs}, - ASSET_PREFIX, +use crate::{ + error::BubblegumError, + state::{ + metaplex_adapter::{Creator, MetadataArgs}, + ASSET_PREFIX, MAX_ACC_PROOFS_SIZE, + }, }; use anchor_lang::{ prelude::*, solana_program::{program_memory::sol_memcmp, pubkey::PUBKEY_BYTES}, }; +use bytemuck::cast_slice; use solana_program::keccak; -use spl_account_compression::Node; +use spl_account_compression::{ + state::{ + merkle_tree_get_size, ConcurrentMerkleTreeHeader, CONCURRENT_MERKLE_TREE_HEADER_SIZE_V1, + }, + Node, +}; pub fn hash_creators(creators: &[Creator]) -> Result<[u8; 32]> { // Convert creator Vec to bytes Vec. @@ -106,3 +115,69 @@ pub fn get_asset_id(tree_id: &Pubkey, nonce: u64) -> Pubkey { ) .0 } + +pub(crate) fn check_canopy_size<'info>( + merkle_tree: AccountInfo<'info>, + tree_authority: AccountInfo<'info>, + max_depth: u32, + max_buffer_size: u32, +) -> Result<()> { + let merkle_tree_bytes = merkle_tree.data.borrow(); + + let (header_bytes, rest) = merkle_tree_bytes.split_at(CONCURRENT_MERKLE_TREE_HEADER_SIZE_V1); + + let mut header = ConcurrentMerkleTreeHeader::try_from_slice(header_bytes)?; + header.initialize( + max_depth, + max_buffer_size, + &tree_authority.key(), + Clock::get()?.slot, + ); + + let merkle_tree_size = merkle_tree_get_size(&header)?; + + let (_tree_bytes, canopy_bytes) = rest.split_at(merkle_tree_size); + + let canopy = cast_slice::(canopy_bytes); + + let cached_path_len = get_cached_path_length(canopy, max_depth)?; + + let required_canopy = max_depth.saturating_sub(MAX_ACC_PROOFS_SIZE); + + require!( + (cached_path_len as u32) >= required_canopy, + BubblegumError::InvalidCanopySize + ); + + Ok(()) +} + +// Method taken from [account-compression Solana program](spl_account_compression::canopy::check_canopy_bytes) +#[inline(always)] +fn get_cached_path_length(canopy: &[Node], max_depth: u32) -> Result { + // The offset of 2 is applied because the canopy is a full binary tree without the root node + // Size: (2^n - 2) -> Size + 2 must be a power of 2 + let closest_power_of_2 = (canopy.len() + 2) as u32; + // This expression will return true if `closest_power_of_2` is actually a power of 2 + if closest_power_of_2 & (closest_power_of_2 - 1) == 0 { + // (1 << max_depth) returns the number of leaves in the full merkle tree + // (1 << (max_depth + 1)) - 1 returns the number of nodes in the full tree + // The canopy size cannot exceed the size of the tree + if closest_power_of_2 > (1 << (max_depth + 1)) { + msg!( + "Canopy size is too large. Size: {}. Max size: {}", + closest_power_of_2 - 2, + (1 << (max_depth + 1)) - 2 + ); + return err!(BubblegumError::InvalidCanopySize); + } + } else { + msg!( + "Canopy length {} is not 2 less than a power of 2", + canopy.len() + ); + return err!(BubblegumError::InvalidCanopySize); + } + // 1 is subtracted from the trailing zeros because the root is not stored in the canopy + Ok(closest_power_of_2.trailing_zeros() - 1) +} diff --git a/programs/bubblegum/program/tests/batch-mint.rs b/programs/bubblegum/program/tests/batch-mint.rs new file mode 100644 index 00000000..5413b9c1 --- /dev/null +++ b/programs/bubblegum/program/tests/batch-mint.rs @@ -0,0 +1,849 @@ +#![cfg(feature = "test-sbf")] +pub mod utils; + +use crate::utils::{clone_keypair, Error::BanksClient, LeafArgs}; +use anchor_lang::solana_program::instruction::InstructionError; +use bubblegum::{ + error::BubblegumError, + state::{ + metaplex_adapter::{MetadataArgs, TokenProgramVersion, TokenStandard}, + PROTOCOL_FEE_PER_1024_ASSETS, VOTER_DISCRIMINATOR, + }, +}; +use mpl_common_constants::constants::{DAO_GOVERNING_MINT, DAO_PUBKEY, FEE_RECEIVER}; +use mplx_staking_states::state::{ + DepositEntry, Lockup, LockupKind, LockupPeriod, Registrar, Voter, VotingMintConfig, + REGISTRAR_DISCRIMINATOR, +}; +use solana_program_test::{tokio, BanksClientError}; +use solana_sdk::{ + account::AccountSharedData, + instruction::AccountMeta, + pubkey::Pubkey, + signature::{Keypair, Signer}, + transaction::TransactionError, +}; +use std::{ + collections::HashSet, + str::FromStr, + time::{SystemTime, UNIX_EPOCH}, +}; +use utils::{context::BubblegumTestContext, tree::Tree}; + +const MAX_DEPTH: usize = 10; +const MAX_BUF_SIZE: usize = 32; + +// Creates Tree object and generates test assets without minting it +async fn preinitialize_merkle_tree( + program_context: &BubblegumTestContext, + tree_creator: &Keypair, + assets_owner: &Keypair, + canopy_depth: Option, + num_of_assets: usize, +) -> Tree { + let mut tree = Tree::::with_creator_and_canopy( + tree_creator, + canopy_depth, + program_context.client(), + ); + + for i in 0..num_of_assets { + let (_asset, leaf_args) = create_test_metadata_args(assets_owner, assets_owner, i as u64); + tree.update_leaf(&leaf_args).unwrap(); + } + + tree.alloc(&program_context.test_context().payer) + .await + .unwrap(); + + tree +} + +fn create_test_metadata_args( + assets_owner: &Keypair, + assets_delegate: &Keypair, + index: u64, +) -> (MetadataArgs, LeafArgs) { + let asset = MetadataArgs { + name: format!("{index}"), + symbol: format!("symbol-{index}"), + uri: format!("https://immutable-storage/asset/{index}"), + seller_fee_basis_points: 0, + primary_sale_happened: false, + is_mutable: false, + edition_nonce: None, + token_standard: Some(TokenStandard::NonFungible), + collection: None, + uses: None, + token_program_version: TokenProgramVersion::Original, + creators: Vec::new(), + }; + + let leaf_args = LeafArgs { + owner: clone_keypair(assets_owner), + delegate: clone_keypair(assets_delegate), + metadata: asset.clone(), + nonce: index, + index: index as u32, + }; + + (asset, leaf_args) +} + +async fn get_canopy_from_tree( + merkle_tree: &Tree, + tree_depth: usize, +) -> Vec<[u8; 32]> { + let mut canopy = Vec::new(); + + let node_indexes: Vec<_> = (0..1 << tree_depth).collect(); + + for i in node_indexes { + let proofs: Vec<[u8; 32]> = merkle_tree.proof_of_leaf(i); + + canopy.push( + proofs + .get(merkle_tree.canopy_depth as usize) + .unwrap() + .clone(), + ); + } + + // drop duplications because we iterate through all the assets + // some of them have same hash in path on canopy's level + let mut seen = HashSet::new(); + canopy.retain(|c| { + let is_first = !seen.contains(c); + seen.insert(c.clone()); + is_first + }); + + // have to do it because MerkleTree returns hashes where each pair is reversed + // and this is happening because the proof doesn't contain the parent of the leaf. + // It contains the neighbor of every relevant node up to one level below the root. + // Having those neighbors and the leaf you may recreate the root. So the actual canopy leaf is + // either calculable from the leaf and it's proof by hashing those hashes up to the canopy level, + // or taken from the neighbor, which is done here. + reverse_each_couple(&mut canopy); + + canopy +} + +fn reverse_each_couple(vec: &mut Vec) { + let len = vec.len(); + let mut i = 0; + while i + 1 < len { + vec.swap(i, i + 1); + i += 2; + } +} + +// This function initializes registrar, voter and mining keys. +// Those registrar and voter are related to SPL Governance program. And the mining key is related to the reward program. +// Initialization of these account is required because batch creation requires MPLX stake, +// and all the user's information about stake is saving on these accounts. +async fn initialize_staking_accounts( + program_context: &mut BubblegumTestContext, +) -> (Pubkey, Pubkey, Pubkey) { + let governance_program_id = + Pubkey::from_str("CuyWCRdHT8pZLG793UR5R9z31AC49d47ZW9ggN6P7qZ4").unwrap(); + let realm_authority = Pubkey::from_str("Euec5oQGN3Y9kqVrz6PQRfTpYSn6jK3k1JonDiMTzAtA").unwrap(); + let voter_authority = program_context.test_context().payer.pubkey(); + + let mplx_mint_key = Pubkey::new_unique(); + let grant_authority = Pubkey::new_unique(); + let mining_key = Pubkey::new_unique(); + let reward_pool_key = Pubkey::new_unique(); + + let registrar_key = Pubkey::find_program_address( + &[ + DAO_PUBKEY.as_ref(), + b"registrar".as_ref(), + DAO_GOVERNING_MINT.as_ref(), + ], + &mplx_staking_states::ID, + ) + .0; + + let (voter_key, voter_bump) = Pubkey::find_program_address( + &[ + registrar_key.to_bytes().as_ref(), + b"voter".as_ref(), + voter_authority.to_bytes().as_ref(), + ], + &mplx_staking_states::ID, + ); + + // init structs for Registrar and Voter and fill it in with data + let voting_mint_config = VotingMintConfig { + mint: mplx_mint_key, + grant_authority, + }; + + let registrar = Registrar { + governance_program_id: governance_program_id.clone(), + realm: DAO_PUBKEY.into(), + realm_governing_token_mint: DAO_GOVERNING_MINT.into(), + realm_authority: realm_authority.clone(), + voting_mints: [voting_mint_config, voting_mint_config], + reward_pool: reward_pool_key, + bump: 0, + padding: [0; 7], + }; + + let current_time = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_millis() as u64; + + let lockup = Lockup { + start_ts: 0, + end_ts: current_time + 100, + cooldown_ends_at: 0, + cooldown_requested: false, + kind: LockupKind::Constant, + period: LockupPeriod::ThreeMonths, + _reserved0: [0; 16], + _reserved1: [0; 5], + }; + + let deposit_entry = DepositEntry { + lockup: lockup.clone(), + amount_deposited_native: 100_000_000_000_000, + voting_mint_config_idx: 0, + is_used: true, + delegate: Pubkey::new_unique(), + delegate_last_update_ts: 0, + _reserved0: [0; 32], + _reserved1: [0; 6], + }; + + let deposit_entries = [deposit_entry; 32]; + + let voter = Voter { + deposits: deposit_entries, + voter_authority: voter_authority.clone(), + registrar: registrar_key, + voter_bump, + voter_weight_record_bump: 0, + _reserved1: [0; 14], + }; + + let registrar_acc_data = [ + REGISTRAR_DISCRIMINATOR.as_ref(), + bytemuck::bytes_of(®istrar), + ] + .concat(); + let voter_acc_data = [VOTER_DISCRIMINATOR.as_ref(), bytemuck::bytes_of(&voter)].concat(); + + // for next two accounts set arbitrary balance because it doesn't meter for test + let mut registrar_account = AccountSharedData::new( + 10000000000000000, + registrar_acc_data.len(), + &mplx_staking_states::ID, + ); + registrar_account.set_data_from_slice(registrar_acc_data.as_ref()); + + let mut voter_account = AccountSharedData::new( + 10000000000000000, + voter_acc_data.len(), + &mplx_staking_states::ID, + ); + voter_account.set_data_from_slice(voter_acc_data.as_ref()); + let mut mining_acc_data = [0; mplx_rewards::state::WrappedMining::LEN]; + // TODO: good luck trying to make it work with those allignment requirements of the WrappedMining struct, + // let account_type:u8 = mplx_rewards::state::AccountType::Mining.into(); + // mining_acc_data[0] = account_type; + // let mining_acc = mplx_rewards::state::WrappedMining::from_bytes_mut(&mut mining_acc_data) + // .expect("Failed to create mining account"); + // mining_acc.mining.owner = voter_authority; + // mining_acc.mining.stake_from_others = 0; + // so here is a hacky way to set the owner of the mining account directly + mining_acc_data[32..64].copy_from_slice(&voter_authority.to_bytes()); + let mut mining_account = + AccountSharedData::new(10000000000000000, mining_acc_data.len(), &mplx_rewards::ID); + mining_account.set_data_from_slice(mining_acc_data.as_ref()); + program_context + .mut_test_context() + .set_account(®istrar_key, ®istrar_account); + program_context + .mut_test_context() + .set_account(&voter_key, &voter_account); + program_context + .mut_test_context() + .set_account(&mining_key, &mining_account); + + (registrar_key, voter_key, mining_key) +} + +#[tokio::test] +async fn test_prepare_tree_without_canopy() { + let tree_creator = Keypair::new(); + + let asset_owner = Keypair::new(); + + let num_of_assets_to_mint = 1000; + + let mut program_context = BubblegumTestContext::new().await.unwrap(); + + let mut tree = preinitialize_merkle_tree( + &program_context, + &tree_creator, + &asset_owner, + None, + num_of_assets_to_mint, + ) + .await; + + let rightmost_proof = tree.proof_of_leaf((num_of_assets_to_mint - 1) as u32); + let rightmost_leaf = tree.get_node(num_of_assets_to_mint - 1); + + let (registrar_key, voter_key, mining_key) = + initialize_staking_accounts(&mut program_context).await; + + let fee_receiver = FEE_RECEIVER.into(); + + program_context + .fund_account(tree.creator_pubkey(), 10_000_000_000) + .await + .unwrap(); + program_context + .fund_account(fee_receiver, 10_000_000_000) + .await + .unwrap(); + let start_fee_receiver_balance = program_context + .client() + .get_account(fee_receiver) + .await + .unwrap() + .unwrap() + .lamports; + let start_staker_balance = program_context + .client() + .get_account(program_context.test_context().payer.pubkey()) + .await + .unwrap() + .unwrap() + .lamports; + + let mut tree_tx_builder = tree.prepare_tree_tx( + &program_context.test_context().payer, + &tree_creator, + false, + MAX_DEPTH as u32, + MAX_BUF_SIZE as u32, + ); + + tree_tx_builder.execute_without_root_check().await.unwrap(); + + let mut tree_tx_builder = tree.finalize_tree_with_root_tx( + &program_context.test_context().payer, + &tree_creator, + tree.expected_root(), + rightmost_leaf, + (num_of_assets_to_mint - 1) as u32, + "http://some-url.com".to_string(), + "fileHash".to_string(), + registrar_key, + voter_key, + mining_key, + fee_receiver, + ); + + for proof in rightmost_proof { + tree_tx_builder.additional_accounts.push(AccountMeta { + pubkey: proof.into(), + is_signer: false, + is_writable: false, + }); + } + + tree_tx_builder.execute().await.unwrap(); + + let end_fee_receiver_balance = program_context + .client() + .get_account(fee_receiver) + .await + .unwrap() + .unwrap() + .lamports; + let end_staker_balance = program_context + .client() + .get_account(program_context.test_context().payer.pubkey()) + .await + .unwrap() + .unwrap() + .lamports; + + // such as payer paid for TreeConfig account creation(rent space) in PrepareTree instruction + // and it paid Solana txs fee + // we deduct sum of that expenses to check if protocol fee was really charged + let solana_fee = 1579040; + + assert_eq!( + end_fee_receiver_balance, + start_fee_receiver_balance + PROTOCOL_FEE_PER_1024_ASSETS + ); + assert_eq!( + end_staker_balance, + start_staker_balance - PROTOCOL_FEE_PER_1024_ASSETS - solana_fee + ); +} + +#[tokio::test] +async fn test_prepare_tree_with_canopy() { + let tree_creator = Keypair::new(); + + let asset_owner = Keypair::new(); + + let canopy_depth = 5; + let num_of_assets_to_mint = 1000; + + let mut program_context = BubblegumTestContext::new().await.unwrap(); + + let mut tree = preinitialize_merkle_tree( + &program_context, + &tree_creator, + &asset_owner, + Some(canopy_depth), + num_of_assets_to_mint, + ) + .await; + + let canopy_hashes = get_canopy_from_tree(&tree, MAX_DEPTH).await; + let rightmost_leaf = tree.get_node(num_of_assets_to_mint - 1); + let rightmost_proof = tree.proof_of_leaf((num_of_assets_to_mint - 1) as u32); + + let (registrar_key, voter_key, mining_key) = + initialize_staking_accounts(&mut program_context).await; + + let mut tree_tx_builder = tree.prepare_tree_tx( + &program_context.test_context().payer, + &tree_creator, + false, + MAX_DEPTH as u32, + MAX_BUF_SIZE as u32, + ); + + tree_tx_builder.execute_without_root_check().await.unwrap(); + + for (i, ch) in canopy_hashes.chunks(20).enumerate() { + let start_index = i * 20; + + let mut add_canopy_tx_builder = tree.add_canopy_tx( + &program_context.test_context().payer, + &tree_creator, + start_index as u32, + ch.to_vec(), + ); + + add_canopy_tx_builder + .execute_without_root_check() + .await + .unwrap(); + } + + let fee_receiver = FEE_RECEIVER.into(); + + let mut tree_tx_builder = tree.finalize_tree_with_root_tx( + &program_context.test_context().payer, + &tree_creator, + tree.expected_root(), + rightmost_leaf, + (num_of_assets_to_mint - 1) as u32, + "http://some-url.com".to_string(), + "fileHash".to_string(), + registrar_key, + voter_key, + mining_key, + fee_receiver, + ); + + for proof in rightmost_proof[..canopy_depth as usize].iter() { + tree_tx_builder.additional_accounts.push(AccountMeta { + pubkey: Pubkey::new_from_array(*proof), + is_signer: false, + is_writable: false, + }); + } + + tree_tx_builder.execute().await.unwrap(); +} + +#[tokio::test] +async fn test_put_wrong_canopy() { + let tree_creator = Keypair::new(); + + let asset_owner = Keypair::new(); + + let canopy_depth = 5; + let num_of_assets_to_mint = 1000; + + let mut program_context = BubblegumTestContext::new().await.unwrap(); + + let mut tree = preinitialize_merkle_tree( + &program_context, + &tree_creator, + &asset_owner, + Some(canopy_depth), + num_of_assets_to_mint, + ) + .await; + + let rightmost_leaf = tree.get_node(num_of_assets_to_mint - 1); + let rightmost_proof = tree.proof_of_leaf((num_of_assets_to_mint - 1) as u32); + + let canopy_hashes = vec![[1; 32]; 32]; + + let (registrar_key, voter_key, mining_key) = + initialize_staking_accounts(&mut program_context).await; + + let mut tree_tx_builder = tree.prepare_tree_tx( + &program_context.test_context().payer, + &tree_creator, + false, + MAX_DEPTH as u32, + MAX_BUF_SIZE as u32, + ); + + tree_tx_builder.execute_without_root_check().await.unwrap(); + + for (i, ch) in canopy_hashes.chunks(20).enumerate() { + let start_index = i * 20; + + let mut add_canopy_tx_builder = tree.add_canopy_tx( + &program_context.test_context().payer, + &tree_creator, + start_index as u32, + ch.to_vec(), + ); + + add_canopy_tx_builder + .execute_without_root_check() + .await + .unwrap(); + } + + let fee_receiver = FEE_RECEIVER.into(); + + let mut tree_tx_builder = tree.finalize_tree_with_root_tx( + &program_context.test_context().payer, + &tree_creator, + tree.expected_root(), + rightmost_leaf, + (num_of_assets_to_mint - 1) as u32, + "http://some-url.com".to_string(), + "fileHash".to_string(), + registrar_key, + voter_key, + mining_key, + fee_receiver, + ); + + for proof in rightmost_proof { + tree_tx_builder.additional_accounts.push(AccountMeta { + pubkey: proof.into(), + is_signer: false, + is_writable: false, + }); + } + + let res = tree_tx_builder.execute().await; + + if let Err(err) = res { + if let BanksClient(BanksClientError::TransactionError(e)) = *err { + assert_eq!( + e, + TransactionError::InstructionError(0, InstructionError::Custom(6012),) + ); + } else { + panic!("Wrong variant"); + } + } else { + panic!("Should have failed"); + } +} + +#[tokio::test] +async fn test_prepare_with_small_canopy() { + let program_context = BubblegumTestContext::new().await.unwrap(); + + #[allow(non_upper_case_globals)] + const tree_depth: usize = 20; + #[allow(non_upper_case_globals)] + const tree_buffer: usize = 64; + + let tree_creator = Keypair::new(); + + let mut tree = Tree::::with_creator_and_canopy( + &tree_creator, + None, + program_context.client(), + ); + + tree.alloc(&program_context.test_context().payer) + .await + .unwrap(); + + let mut tree_tx_builder = tree.prepare_tree_tx( + &program_context.test_context().payer, + &tree_creator, + false, + tree_depth as u32, + tree_buffer as u32, + ); + + let res = tree_tx_builder.execute_without_root_check().await; + + if let Err(err) = res { + if let BanksClient(BanksClientError::TransactionError(e)) = *err { + assert_eq!( + e, + TransactionError::InstructionError(0, InstructionError::Custom(6041),) + ); + } else { + panic!("Wrong variant"); + } + } else { + panic!("Should have failed"); + } +} + +#[tokio::test] +async fn test_put_wrong_fee_receiver() { + let tree_creator = Keypair::new(); + + let asset_owner = Keypair::new(); + + let num_of_assets_to_mint = 1000; + + let mut program_context = BubblegumTestContext::new().await.unwrap(); + + let mut tree = preinitialize_merkle_tree( + &program_context, + &tree_creator, + &asset_owner, + None, + num_of_assets_to_mint, + ) + .await; + + let rightmost_leaf = tree.get_node(num_of_assets_to_mint - 1); + let rightmost_proof = tree.proof_of_leaf((num_of_assets_to_mint - 1) as u32); + + let (registrar_key, voter_key, mining_key) = + initialize_staking_accounts(&mut program_context).await; + + let fee_receiver = FEE_RECEIVER.into(); + + program_context + .fund_account(tree.creator_pubkey(), 10_000_000_000) + .await + .unwrap(); + program_context + .fund_account(fee_receiver, 10_000_000_000) + .await + .unwrap(); + + let mut tree_tx_builder = tree.prepare_tree_tx( + &program_context.test_context().payer, + &tree_creator, + false, + MAX_DEPTH as u32, + MAX_BUF_SIZE as u32, + ); + + tree_tx_builder.execute_without_root_check().await.unwrap(); + + let wrong_fee_receiver = Pubkey::new_unique(); + let mut tree_tx_builder = tree.finalize_tree_with_root_tx( + &program_context.test_context().payer, + &tree_creator, + tree.expected_root(), + rightmost_leaf, + (num_of_assets_to_mint - 1) as u32, + "http://some-url.com".to_string(), + "fileHash".to_string(), + registrar_key, + voter_key, + mining_key, + wrong_fee_receiver, + ); + + for proof in rightmost_proof { + tree_tx_builder.additional_accounts.push(AccountMeta { + pubkey: proof.into(), + is_signer: false, + is_writable: false, + }); + } + + let res = tree_tx_builder.execute().await; + if let Err(err) = res { + if let BanksClient(BanksClientError::TransactionError(e)) = *err { + assert_eq!( + e, + TransactionError::InstructionError( + 0, + InstructionError::Custom(BubblegumError::FeeReceiverMismatch.into()), + ) + ); + } else { + panic!("Wrong variant"); + } + } else { + panic!("Should have failed"); + } +} + +#[tokio::test] +async fn test_prepare_tree_with_collection() { + let tree_creator = Keypair::new(); + + let asset_owner = Keypair::new(); + + let num_of_assets_to_mint = 1000; + + let mut program_context = BubblegumTestContext::new().await.unwrap(); + + let mut tree = preinitialize_merkle_tree( + &program_context, + &tree_creator, + &asset_owner, + None, + num_of_assets_to_mint, + ) + .await; + + let fee_receiver = FEE_RECEIVER.into(); + + let rightmost_proof = tree.proof_of_leaf((num_of_assets_to_mint - 1) as u32); + let rightmost_leaf = tree.get_node(num_of_assets_to_mint - 1); + + let (registrar_key, voter_key, mining_key) = + initialize_staking_accounts(&mut program_context).await; + + program_context + .fund_account(tree.creator_pubkey(), 10_000_000_000) + .await + .unwrap(); + program_context + .fund_account(fee_receiver, 10_000_000_000) + .await + .unwrap(); + + let mut tree_tx_builder = tree.prepare_tree_tx( + &program_context.test_context().payer, + &tree_creator, + false, + MAX_DEPTH as u32, + MAX_BUF_SIZE as u32, + ); + + tree_tx_builder.execute_without_root_check().await.unwrap(); + + let mut tree_tx_builder = tree.finalize_tree_with_root_and_collection_tx( + &program_context.payer(), + &program_context.default_collection, + &program_context.test_context().payer, + &tree_creator, + tree.expected_root(), + rightmost_leaf, + 999, + "http://some-url.com".to_string(), + "fileHash".to_string(), + registrar_key, + voter_key, + mining_key, + fee_receiver, + ); + + for proof in rightmost_proof { + tree_tx_builder.additional_accounts.push(AccountMeta { + pubkey: proof.into(), + is_signer: false, + is_writable: false, + }); + } + + tree_tx_builder.execute().await.unwrap(); +} + +#[tokio::test] +async fn test_prepare_tree_with_collection_wrong_authority() { + let tree_creator = Keypair::new(); + + let asset_owner = Keypair::new(); + + let num_of_assets_to_mint = 1000; + + let mut program_context = BubblegumTestContext::new().await.unwrap(); + + let mut tree = preinitialize_merkle_tree( + &program_context, + &tree_creator, + &asset_owner, + None, + num_of_assets_to_mint, + ) + .await; + + let fee_receiver = FEE_RECEIVER.into(); + + let rightmost_leaf = tree.get_node(num_of_assets_to_mint - 1); + + let (registrar_key, voter_key, mining_key) = + initialize_staking_accounts(&mut program_context).await; + + program_context + .fund_account(tree.creator_pubkey(), 10_000_000_000) + .await + .unwrap(); + program_context + .fund_account(fee_receiver, 10_000_000_000) + .await + .unwrap(); + + let mut tree_tx_builder = tree.prepare_tree_tx( + &program_context.test_context().payer, + &tree_creator, + false, + MAX_DEPTH as u32, + MAX_BUF_SIZE as u32, + ); + + tree_tx_builder.execute_without_root_check().await.unwrap(); + + let mut tree_tx_builder = tree.finalize_tree_with_root_and_collection_tx( + &tree_creator, + &program_context.default_collection, + &program_context.test_context().payer, + &tree_creator, + tree.expected_root(), + rightmost_leaf, + 999, + "http://some-url.com".to_string(), + "fileHash".to_string(), + registrar_key, + voter_key, + mining_key, + fee_receiver, + ); + + let res = tree_tx_builder.execute().await; + if let Err(err) = res { + if let BanksClient(BanksClientError::TransactionError(e)) = *err { + assert_eq!( + e, + TransactionError::InstructionError( + 0, + InstructionError::Custom(BubblegumError::InvalidCollectionAuthority.into()), + ) + ); + } else { + panic!("Wrong variant"); + } + } else { + panic!("Should have failed"); + } +} diff --git a/programs/bubblegum/program/tests/simple.rs b/programs/bubblegum/program/tests/simple.rs index b6c936c2..f3e76713 100644 --- a/programs/bubblegum/program/tests/simple.rs +++ b/programs/bubblegum/program/tests/simple.rs @@ -239,14 +239,11 @@ async fn test_create_public_tree_and_mint_passes() { async fn test_create_public_tree_with_canopy() { let context = BubblegumTestContext::new().await.unwrap(); let payer = context.payer(); - let mut tree = context .create_tree_with_canopy::<18, 64>(1, true) .await .unwrap(); - let cfg = tree.read_tree_config().await.unwrap(); - assert_eq!(cfg.tree_creator, payer.pubkey()); assert_eq!(cfg.tree_delegate, payer.pubkey()); assert!(cfg.is_public); @@ -276,6 +273,26 @@ async fn test_cannot_create_tree_needing_too_many_proofs_with_too_small_canopy() async fn test_cannot_create_tree_needing_too_many_proofs_with_no_canopy() { let context = BubblegumTestContext::new().await.unwrap(); + let tree_create_result = context.create_tree_with_canopy::<19, 64>(1, true).await; + + if let Err(err) = tree_create_result { + if let BanksClient(BanksClientError::TransactionError(e)) = *err { + assert_eq!( + e, + TransactionError::InstructionError(0, InstructionError::Custom(6041),) + ); + } else { + panic!("Wrong variant"); + } + } else { + panic!("Should have failed"); + } +} + +#[tokio::test] +async fn test_create_public_tree_with_zero_canopy() { + let context = BubblegumTestContext::new().await.unwrap(); + let tree_create_result = context.create_tree_with_canopy::<18, 64>(0, true).await; if let Err(err) = tree_create_result { diff --git a/programs/bubblegum/program/tests/utils/tree.rs b/programs/bubblegum/program/tests/utils/tree.rs index 808f55a5..edb56224 100644 --- a/programs/bubblegum/program/tests/utils/tree.rs +++ b/programs/bubblegum/program/tests/utils/tree.rs @@ -1,15 +1,19 @@ use super::{ clone_keypair, compute_metadata_hashes, tx_builder::{ - BurnBuilder, CancelRedeemBuilder, CollectionVerificationInner, CreateBuilder, - CreatorVerificationInner, DelegateBuilder, DelegateInner, MintToCollectionV1Builder, - MintV1Builder, RedeemBuilder, SetDecompressibleStateBuilder, SetTreeDelegateBuilder, - TransferBuilder, TransferInner, TxBuilder, UnverifyCreatorBuilder, VerifyCollectionBuilder, + AddCanopyBuilder, BurnBuilder, CancelRedeemBuilder, CollectionVerificationInner, + CreateBuilder, CreatorVerificationInner, DelegateBuilder, DelegateInner, + FinalizeWithRootBuilder, MintToCollectionV1Builder, MintV1Builder, PrepareTreeBuilder, + RedeemBuilder, SetDecompressibleStateBuilder, SetTreeDelegateBuilder, TransferBuilder, + TransferInner, TxBuilder, UnverifyCreatorBuilder, VerifyCollectionBuilder, VerifyCreatorBuilder, }, Error, LeafArgs, Result, }; -use crate::utils::tx_builder::DecompressV1Builder; +use crate::utils::{ + digital_asset::DigitalAsset, + tx_builder::{DecompressV1Builder, FinalizeWithRootAndCollectionBuilder}, +}; use anchor_lang::{self, AccountDeserialize}; use bubblegum::{ state::{leaf_schema::LeafSchema, DecompressibleState, TreeConfig, Voucher, VOUCHER_PREFIX}, @@ -88,6 +92,25 @@ impl Tree Self { + Tree { + tree_creator: clone_keypair(tree_creator), + tree_delegate: clone_keypair(tree_creator), + merkle_tree: clone_keypair(merkle_tree), + canopy_depth, + client, + proof_tree, + num_minted, + } + } + pub fn creator_pubkey(&self) -> Pubkey { self.tree_creator.pubkey() } @@ -253,6 +276,178 @@ impl Tree FinalizeWithRootBuilder { + let tree_authority = + Pubkey::find_program_address(&[self.tree_pubkey().as_ref()], &bubblegum::id()).0; + + let accounts = bubblegum::accounts::FinalizeTreeWithRoot { + tree_authority, + merkle_tree: self.tree_pubkey(), + staker: payer.pubkey(), // TODO: this should be a separate account in a general case + tree_delegate: tree_delegate.pubkey(), + payer: payer.pubkey(), + registrar, + voter, + mining, + fee_receiver, + log_wrapper: spl_noop::id(), + compression_program: spl_account_compression::id(), + system_program: system_program::id(), + }; + + let data = bubblegum::instruction::FinalizeTreeWithRoot { + root, + rightmost_leaf, + rightmost_index, + metadata_url, + metadata_hash, + }; + + self.tx_builder( + accounts, + data, + None, + (), + payer.pubkey(), + &[payer, tree_delegate], + ) + } + + pub fn finalize_tree_with_root_and_collection_tx( + &mut self, + collection_authority: &Keypair, + collection: &DigitalAsset, + payer: &Keypair, + tree_delegate: &Keypair, + root: [u8; 32], + rightmost_leaf: [u8; 32], + rightmost_index: u32, + metadata_url: String, + metadata_hash: String, + registrar: Pubkey, + voter: Pubkey, + mining: Pubkey, + fee_receiver: Pubkey, + ) -> FinalizeWithRootAndCollectionBuilder { + let tree_authority = + Pubkey::find_program_address(&[self.tree_pubkey().as_ref()], &bubblegum::id()).0; + + let accounts = bubblegum::accounts::FinalizeTreeWithRootAndCollection { + tree_authority, + merkle_tree: self.tree_pubkey(), + staker: payer.pubkey(), // TODO: this should be a separate account in a general case + tree_delegate: tree_delegate.pubkey(), + payer: payer.pubkey(), + registrar, + voter, + mining, + collection_authority: collection_authority.pubkey(), + collection_authority_record_pda: bubblegum::id(), + collection_mint: collection.mint.pubkey(), + fee_receiver, + log_wrapper: spl_noop::id(), + compression_program: spl_account_compression::id(), + system_program: system_program::id(), + collection_metadata: collection.metadata, + edition_account: collection.edition.unwrap(), + }; + + let data = bubblegum::instruction::FinalizeTreeWithRootAndCollection { + root, + rightmost_leaf, + rightmost_index, + metadata_url, + metadata_hash, + }; + + self.tx_builder( + accounts, + data, + None, + (), + payer.pubkey(), + &[payer, tree_delegate, collection_authority], + ) + } + + pub fn add_canopy_tx( + &mut self, + payer: &Keypair, + tree_delegate: &Keypair, + start_index: u32, + canopy_nodes: Vec<[u8; 32]>, + ) -> AddCanopyBuilder { + let tree_authority = + Pubkey::find_program_address(&[self.tree_pubkey().as_ref()], &bubblegum::id()).0; + + let accounts = bubblegum::accounts::AddCanopy { + tree_authority, + merkle_tree: self.tree_pubkey(), + tree_delegate: tree_delegate.pubkey(), + log_wrapper: spl_noop::id(), + compression_program: spl_account_compression::id(), + system_program: system_program::id(), + }; + + let data = bubblegum::instruction::AddCanopy { + start_index, + canopy_nodes, + }; + + self.tx_builder( + accounts, + data, + None, + (), + payer.pubkey(), + &[tree_delegate, payer], + ) + } + + pub fn prepare_tree_tx( + &mut self, + payer: &Keypair, + creator: &Keypair, + public: bool, + max_depth: u32, + max_buffer_size: u32, + ) -> PrepareTreeBuilder { + let tree_authority = + Pubkey::find_program_address(&[self.tree_pubkey().as_ref()], &bubblegum::id()).0; + + assert_eq!(creator.pubkey(), self.creator_pubkey()); + let accounts = bubblegum::accounts::PrepareTree { + tree_authority, + merkle_tree: self.tree_pubkey(), + payer: payer.pubkey(), + tree_creator: self.creator_pubkey(), + log_wrapper: spl_noop::id(), + compression_program: spl_account_compression::id(), + system_program: system_program::id(), + }; + + let data = bubblegum::instruction::PrepareTree { + max_depth, + max_buffer_size, + public: Some(public), + }; + + self.tx_builder(accounts, data, None, (), payer.pubkey(), &[payer, creator]) + } + pub fn mint_v1_non_owner_tx<'a>( &'a mut self, tree_delegate: &Keypair, @@ -1021,6 +1216,11 @@ impl Tree Node { + self.proof_tree.get_node(index) + } + // Set Decompression Permission TX pub fn set_decompression_tx( &mut self, diff --git a/programs/bubblegum/program/tests/utils/tx_builder.rs b/programs/bubblegum/program/tests/utils/tx_builder.rs index 34eefb24..40714076 100644 --- a/programs/bubblegum/program/tests/utils/tx_builder.rs +++ b/programs/bubblegum/program/tests/utils/tx_builder.rs @@ -47,7 +47,7 @@ where T: ToAccountMetas, U: InstructionData, { - pub async fn execute(&mut self) -> Result<()> + async fn execute_tx(&mut self) -> Result<()> where Self: OnSuccessfulTxExec, { @@ -85,10 +85,26 @@ where self.on_successful_execute()?; + Ok(()) + } + + pub async fn execute(&mut self) -> Result<()> + where + Self: OnSuccessfulTxExec, + { + self.execute_tx().await?; + // Check the expected tree root matches on-chain state post tx. self.tree.check_expected_root().await } + pub async fn execute_without_root_check(&mut self) -> Result<()> + where + Self: OnSuccessfulTxExec, + { + self.execute_tx().await + } + // Returning `&mut Self` to allow method chaining. pub fn set_signers(&mut self, signers: &[&Keypair]) -> &mut Self { self.signers = signers.iter().map(|k| clone_keypair(k)).collect(); @@ -147,6 +163,83 @@ impl<'a, const MAX_DEPTH: usize, const MAX_BUFFER_SIZE: usize> OnSuccessfulTxExe } } +pub type FinalizeWithRootBuilder<'a, const MAX_DEPTH: usize, const MAX_BUFFER_SIZE: usize> = + TxBuilder< + 'a, + bubblegum::accounts::FinalizeTreeWithRoot, + bubblegum::instruction::FinalizeTreeWithRoot, + (), + MAX_DEPTH, + MAX_BUFFER_SIZE, + >; + +pub type FinalizeWithRootAndCollectionBuilder< + 'a, + const MAX_DEPTH: usize, + const MAX_BUFFER_SIZE: usize, +> = TxBuilder< + 'a, + bubblegum::accounts::FinalizeTreeWithRootAndCollection, + bubblegum::instruction::FinalizeTreeWithRootAndCollection, + (), + MAX_DEPTH, + MAX_BUFFER_SIZE, +>; + +impl<'a, const MAX_DEPTH: usize, const MAX_BUFFER_SIZE: usize> OnSuccessfulTxExec + for FinalizeWithRootBuilder<'a, MAX_DEPTH, MAX_BUFFER_SIZE> +{ + fn on_successful_execute(&mut self) -> Result<()> { + // Do nothing here. + Ok(()) + } +} + +impl<'a, const MAX_DEPTH: usize, const MAX_BUFFER_SIZE: usize> OnSuccessfulTxExec + for FinalizeWithRootAndCollectionBuilder<'a, MAX_DEPTH, MAX_BUFFER_SIZE> +{ + fn on_successful_execute(&mut self) -> Result<()> { + // Do nothing here. + Ok(()) + } +} + +pub type AddCanopyBuilder<'a, const MAX_DEPTH: usize, const MAX_BUFFER_SIZE: usize> = TxBuilder< + 'a, + bubblegum::accounts::AddCanopy, + bubblegum::instruction::AddCanopy, + (), + MAX_DEPTH, + MAX_BUFFER_SIZE, +>; + +impl<'a, const MAX_DEPTH: usize, const MAX_BUFFER_SIZE: usize> OnSuccessfulTxExec + for AddCanopyBuilder<'a, MAX_DEPTH, MAX_BUFFER_SIZE> +{ + fn on_successful_execute(&mut self) -> Result<()> { + // Do nothing here. + Ok(()) + } +} + +pub type PrepareTreeBuilder<'a, const MAX_DEPTH: usize, const MAX_BUFFER_SIZE: usize> = TxBuilder< + 'a, + bubblegum::accounts::PrepareTree, + bubblegum::instruction::PrepareTree, + (), + MAX_DEPTH, + MAX_BUFFER_SIZE, +>; + +impl<'a, const MAX_DEPTH: usize, const MAX_BUFFER_SIZE: usize> OnSuccessfulTxExec + for PrepareTreeBuilder<'a, MAX_DEPTH, MAX_BUFFER_SIZE> +{ + fn on_successful_execute(&mut self) -> Result<()> { + // Do nothing here. + Ok(()) + } +} + pub type MintV1Builder<'a, const MAX_DEPTH: usize, const MAX_BUFFER_SIZE: usize> = TxBuilder< 'a, bubblegum::accounts::MintV1,