Skip to content

Commit

Permalink
Remove update_metadata_collection_nft instruction (#47)
Browse files Browse the repository at this point in the history
* Remove update_metadata_collection_nft ix

* Remove unneeded checks and errors

* Regenerate IDL and clients

* Update Solita test
  • Loading branch information
danenbm authored Oct 4, 2023
1 parent a331582 commit 9652483
Show file tree
Hide file tree
Showing 20 changed files with 164 additions and 1,962 deletions.
51 changes: 4 additions & 47 deletions clients/js-solita/src/generated/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -798,57 +798,14 @@ export class MetadataArgsMissingError extends Error {
createErrorFromCodeLookup.set(0x1795, () => new MetadataArgsMissingError());
createErrorFromNameLookup.set('MetadataArgsMissing', () => new MetadataArgsMissingError());

/**
* NFTLinkedToCollection: 'NFT linked to collection'
*
* @category Errors
* @category generated
*/
export class NFTLinkedToCollectionError extends Error {
readonly code: number = 0x1796;
readonly name: string = 'NFTLinkedToCollection';
constructor() {
super('NFT linked to collection');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, NFTLinkedToCollectionError);
}
}
}

createErrorFromCodeLookup.set(0x1796, () => new NFTLinkedToCollectionError());
createErrorFromNameLookup.set('NFTLinkedToCollection', () => new NFTLinkedToCollectionError());

/**
* NFTNotLinkedToVerifiedCollection: 'NFT not linked to verified collection'
*
* @category Errors
* @category generated
*/
export class NFTNotLinkedToVerifiedCollectionError extends Error {
readonly code: number = 0x1797;
readonly name: string = 'NFTNotLinkedToVerifiedCollection';
constructor() {
super('NFT not linked to verified collection');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, NFTNotLinkedToVerifiedCollectionError);
}
}
}

createErrorFromCodeLookup.set(0x1797, () => new NFTNotLinkedToVerifiedCollectionError());
createErrorFromNameLookup.set(
'NFTNotLinkedToVerifiedCollection',
() => new NFTNotLinkedToVerifiedCollectionError(),
);

/**
* PrimarySaleCanOnlyBeFlippedToTrue: 'Can only update primary sale to true'
*
* @category Errors
* @category generated
*/
export class PrimarySaleCanOnlyBeFlippedToTrueError extends Error {
readonly code: number = 0x1798;
readonly code: number = 0x1796;
readonly name: string = 'PrimarySaleCanOnlyBeFlippedToTrue';
constructor() {
super('Can only update primary sale to true');
Expand All @@ -858,7 +815,7 @@ export class PrimarySaleCanOnlyBeFlippedToTrueError extends Error {
}
}

createErrorFromCodeLookup.set(0x1798, () => new PrimarySaleCanOnlyBeFlippedToTrueError());
createErrorFromCodeLookup.set(0x1796, () => new PrimarySaleCanOnlyBeFlippedToTrueError());
createErrorFromNameLookup.set(
'PrimarySaleCanOnlyBeFlippedToTrue',
() => new PrimarySaleCanOnlyBeFlippedToTrueError(),
Expand All @@ -871,7 +828,7 @@ createErrorFromNameLookup.set(
* @category generated
*/
export class CreatorDidNotUnverifyError extends Error {
readonly code: number = 0x1799;
readonly code: number = 0x1797;
readonly name: string = 'CreatorDidNotUnverify';
constructor() {
super('Creator did not unverify the metadata');
Expand All @@ -881,7 +838,7 @@ export class CreatorDidNotUnverifyError extends Error {
}
}

createErrorFromCodeLookup.set(0x1799, () => new CreatorDidNotUnverifyError());
createErrorFromCodeLookup.set(0x1797, () => new CreatorDidNotUnverifyError());
createErrorFromNameLookup.set('CreatorDidNotUnverify', () => new CreatorDidNotUnverifyError());

/**
Expand Down
1 change: 0 additions & 1 deletion clients/js-solita/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ export * from './transfer';
export * from './unverifyCollection';
export * from './unverifyCreator';
export * from './updateMetadata';
export * from './updateMetadataCollectionNft';
export * from './verifyCollection';
export * from './verifyCreator';

This file was deleted.

9 changes: 2 additions & 7 deletions clients/js-solita/tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
TokenStandard,
Creator,
createMintToCollectionV1Instruction,
createUpdateMetadataCollectionNftInstruction,
createSetDecompressibleStateInstruction,
DecompressibleState,
} from '../src/generated';
Expand Down Expand Up @@ -626,7 +625,7 @@ describe('Bubblegum tests', () => {
);
} catch (err) {
assert(
err.message.includes('"Custom":6041'),
err.message.includes('"Custom":6039'),
'Did not fail for correct reason! ' + err.message,
);
}
Expand Down Expand Up @@ -818,13 +817,9 @@ describe('Bubblegum tests', () => {
primarySaleHappened: null,
isMutable: null,
};
const updateMetadataIx = createUpdateMetadataCollectionNftInstruction(
const updateMetadataIx = createUpdateMetadataInstruction(
{
metadataBuffer: BUBBLEGUM_PROGRAM_ID,
collectionAuthority: payer,
collectionMint: collection.mintAddress,
collectionMetadata: collection.metadataAddress,
collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID,
treeAuthority,
treeDelegate: payer,
leafOwner: payer,
Expand Down
37 changes: 4 additions & 33 deletions clients/js/src/generated/errors/mplBubblegum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,46 +543,17 @@ export class MetadataArgsMissingError extends ProgramError {
codeToErrorMap.set(0x1795, MetadataArgsMissingError);
nameToErrorMap.set('MetadataArgsMissing', MetadataArgsMissingError);

/** NFTLinkedToCollection: NFT linked to collection */
export class NFTLinkedToCollectionError extends ProgramError {
readonly name: string = 'NFTLinkedToCollection';

readonly code: number = 0x1796; // 6038

constructor(program: Program, cause?: Error) {
super('NFT linked to collection', program, cause);
}
}
codeToErrorMap.set(0x1796, NFTLinkedToCollectionError);
nameToErrorMap.set('NFTLinkedToCollection', NFTLinkedToCollectionError);

/** NFTNotLinkedToVerifiedCollection: NFT not linked to verified collection */
export class NFTNotLinkedToVerifiedCollectionError extends ProgramError {
readonly name: string = 'NFTNotLinkedToVerifiedCollection';

readonly code: number = 0x1797; // 6039

constructor(program: Program, cause?: Error) {
super('NFT not linked to verified collection', program, cause);
}
}
codeToErrorMap.set(0x1797, NFTNotLinkedToVerifiedCollectionError);
nameToErrorMap.set(
'NFTNotLinkedToVerifiedCollection',
NFTNotLinkedToVerifiedCollectionError
);

/** PrimarySaleCanOnlyBeFlippedToTrue: Can only update primary sale to true */
export class PrimarySaleCanOnlyBeFlippedToTrueError extends ProgramError {
readonly name: string = 'PrimarySaleCanOnlyBeFlippedToTrue';

readonly code: number = 0x1798; // 6040
readonly code: number = 0x1796; // 6038

constructor(program: Program, cause?: Error) {
super('Can only update primary sale to true', program, cause);
}
}
codeToErrorMap.set(0x1798, PrimarySaleCanOnlyBeFlippedToTrueError);
codeToErrorMap.set(0x1796, PrimarySaleCanOnlyBeFlippedToTrueError);
nameToErrorMap.set(
'PrimarySaleCanOnlyBeFlippedToTrue',
PrimarySaleCanOnlyBeFlippedToTrueError
Expand All @@ -592,13 +563,13 @@ nameToErrorMap.set(
export class CreatorDidNotUnverifyError extends ProgramError {
readonly name: string = 'CreatorDidNotUnverify';

readonly code: number = 0x1799; // 6041
readonly code: number = 0x1797; // 6039

constructor(program: Program, cause?: Error) {
super('Creator did not unverify the metadata', program, cause);
}
}
codeToErrorMap.set(0x1799, CreatorDidNotUnverifyError);
codeToErrorMap.set(0x1797, CreatorDidNotUnverifyError);
nameToErrorMap.set('CreatorDidNotUnverify', CreatorDidNotUnverifyError);

/**
Expand Down
1 change: 0 additions & 1 deletion clients/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export * from './transfer';
export * from './unverifyCollection';
export * from './unverifyCreator';
export * from './updateMetadata';
export * from './updateMetadataCollectionNft';
export * from './verifyCollection';
export * from './verifyCreator';
export * from './verifyLeaf';
Loading

0 comments on commit 9652483

Please sign in to comment.