Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(token-metadata): add burn_print_edition handler #684

Merged
merged 27 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
681652d
feat(token-metadata): add burn_print_edition handler
samuelvanderwaal Aug 19, 2022
8cb4b4f
Merge branch 'master' into feat/burn-print-editions
samuelvanderwaal Aug 19, 2022
fed8698
fix(burn-print-edition): clippy lints
samuelvanderwaal Aug 23, 2022
e949d4e
fix: clippy lints
samuelvanderwaal Aug 23, 2022
a20d4fc
tests(token-metadata): add more tests
samuelvanderwaal Aug 23, 2022
5f3d0cb
chore(token-metadata): generate JS code for burn_edition_nft
samuelvanderwaal Aug 23, 2022
8d62056
Merge branch 'master' into feat/burn-print-editions
samuelvanderwaal Aug 24, 2022
ea15701
test(burn_edition_nft): only holder of print edition can burn
samuelvanderwaal Aug 24, 2022
836937a
test(token-metadata/burn_edition_nft): reprint burned nft
samuelvanderwaal Aug 25, 2022
e0fb85e
chore(token-metadata): merge master into branch
samuelvanderwaal Aug 25, 2022
b9a4b0c
test(token-metadata) refactor burn_edition_nft tests a little
samuelvanderwaal Aug 25, 2022
455c745
test(token-metdata): make mask check more complex
samuelvanderwaal Aug 25, 2022
2ec0b82
fix: clippy lints
samuelvanderwaal Aug 25, 2022
ded9c23
refactor: fix supply account; decrement max_supply
samuelvanderwaal Aug 31, 2022
3ffe8a8
chore: merge master into branch
samuelvanderwaal Aug 31, 2022
662c5e7
Merge branch 'master' into feat/burn-print-editions
samuelvanderwaal Sep 8, 2022
4f19f68
finish spec implementation; update tests
samuelvanderwaal Sep 14, 2022
da20c43
Merge branch 'master' into feat/burn-print-editions
samuelvanderwaal Sep 14, 2022
72257b1
refactor: update tests for new supply accounting; remove unused fn
samuelvanderwaal Sep 14, 2022
ce68d7e
chore: generate JS lib for token metadata
samuelvanderwaal Sep 14, 2022
a836cbc
chore: clean up tests
samuelvanderwaal Sep 14, 2022
c657d1c
fix: decrement max supply correctly
samuelvanderwaal Sep 14, 2022
cdfebb8
add missing check; regnerate JS api
samuelvanderwaal Sep 16, 2022
6307d9a
refactor: address review comments
samuelvanderwaal Sep 19, 2022
b92e489
add tests checking invalid master & print derivations
samuelvanderwaal Sep 19, 2022
6aefd85
tests: add a few more tests
samuelvanderwaal Sep 19, 2022
3326dd1
chore(token-metadata/js): generate JS lib
samuelvanderwaal Sep 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 101 additions & 1 deletion token-metadata/js/idl/mpl_token_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,76 @@
"type": "u8",
"value": 36
}
},
{
"name": "BurnEditionNft",
"accounts": [
{
"name": "metadata",
"isMut": true,
"isSigner": false,
"desc": "Metadata (pda of ['metadata', program id, mint id])"
},
{
"name": "owner",
"isMut": true,
"isSigner": true,
"desc": "NFT owner"
},
{
"name": "printEditionMint",
"isMut": true,
"isSigner": false,
"desc": "Mint of the print edition NFT"
},
{
"name": "masterEditionMint",
"isMut": true,
"isSigner": false,
"desc": "Mint of the original/master NFT"
},
{
"name": "printEditionTokenAccount",
"isMut": true,
"isSigner": false,
"desc": "Token account the print edition NFT is in"
},
{
"name": "masterEditionTokenAccount",
"isMut": false,
"isSigner": false,
"desc": "Token account the Master Edition NFT is in"
},
{
"name": "masterEditionAccount",
"isMut": true,
"isSigner": false,
"desc": "MasterEdition2 of the original NFT"
},
{
"name": "printEditionAccount",
"isMut": true,
"isSigner": false,
"desc": "Print Edition account of the NFT"
},
{
"name": "editionMarkerAccount",
"isMut": true,
"isSigner": false,
"desc": "Edition Marker PDA of the NFT"
},
{
"name": "splTokenProgram",
"isMut": false,
"isSigner": false,
"desc": "SPL Token Program"
}
],
"args": [],
"discriminant": {
"type": "u8",
"value": 37
}
}
],
"accounts": [
Expand Down Expand Up @@ -3416,7 +3486,7 @@
{
"code": 113,
"name": "CollectionMasterEditionAccountInvalid",
"msg": "Edition account aoesnt match collection "
"msg": "Edition account doesnt match collection "
},
{
"code": 114,
Expand All @@ -3427,6 +3497,36 @@
"code": 115,
"name": "AlreadyUnverified",
"msg": "Item is already unverified."
},
{
"code": 116,
"name": "NotAPrintEdition",
"msg": "This edition is not a Print Edition"
},
{
"code": 117,
"name": "InvalidMasterEdition",
"msg": "Invalid Master Edition"
},
{
"code": 118,
"name": "InvalidPrintEdition",
"msg": "Invalid Print Edition"
},
{
"code": 119,
"name": "InvalidEditionMarker",
"msg": "Invalid Edition Marker"
},
{
"code": 120,
"name": "ReservationListDeprecated",
"msg": "Reservation List is Deprecated"
},
{
"code": 121,
"name": "PrintEditionDoesNotMatchMasterEdition",
"msg": "Print Edition does not match Master Edition"
}
],
"metadata": {
Expand Down
130 changes: 128 additions & 2 deletions token-metadata/js/src/generated/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2440,7 +2440,7 @@ createErrorFromNameLookup.set(
);

/**
* CollectionMasterEditionAccountInvalid: 'Edition account aoesnt match collection '
* CollectionMasterEditionAccountInvalid: 'Edition account doesnt match collection '
*
* @category Errors
* @category generated
Expand All @@ -2449,7 +2449,7 @@ export class CollectionMasterEditionAccountInvalidError extends Error {
readonly code: number = 0x71;
readonly name: string = 'CollectionMasterEditionAccountInvalid';
constructor() {
super('Edition account aoesnt match collection ');
super('Edition account doesnt match collection ');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, CollectionMasterEditionAccountInvalidError);
}
Expand Down Expand Up @@ -2502,6 +2502,132 @@ export class AlreadyUnverifiedError extends Error {
createErrorFromCodeLookup.set(0x73, () => new AlreadyUnverifiedError());
createErrorFromNameLookup.set('AlreadyUnverified', () => new AlreadyUnverifiedError());

/**
* NotAPrintEdition: 'This edition is not a Print Edition'
*
* @category Errors
* @category generated
*/
export class NotAPrintEditionError extends Error {
readonly code: number = 0x74;
readonly name: string = 'NotAPrintEdition';
constructor() {
super('This edition is not a Print Edition');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, NotAPrintEditionError);
}
}
}

createErrorFromCodeLookup.set(0x74, () => new NotAPrintEditionError());
createErrorFromNameLookup.set('NotAPrintEdition', () => new NotAPrintEditionError());

/**
* InvalidMasterEdition: 'Invalid Master Edition'
*
* @category Errors
* @category generated
*/
export class InvalidMasterEditionError extends Error {
readonly code: number = 0x75;
readonly name: string = 'InvalidMasterEdition';
constructor() {
super('Invalid Master Edition');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, InvalidMasterEditionError);
}
}
}

createErrorFromCodeLookup.set(0x75, () => new InvalidMasterEditionError());
createErrorFromNameLookup.set('InvalidMasterEdition', () => new InvalidMasterEditionError());

/**
* InvalidPrintEdition: 'Invalid Print Edition'
*
* @category Errors
* @category generated
*/
export class InvalidPrintEditionError extends Error {
readonly code: number = 0x76;
readonly name: string = 'InvalidPrintEdition';
constructor() {
super('Invalid Print Edition');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, InvalidPrintEditionError);
}
}
}

createErrorFromCodeLookup.set(0x76, () => new InvalidPrintEditionError());
createErrorFromNameLookup.set('InvalidPrintEdition', () => new InvalidPrintEditionError());

/**
* InvalidEditionMarker: 'Invalid Edition Marker'
*
* @category Errors
* @category generated
*/
export class InvalidEditionMarkerError extends Error {
readonly code: number = 0x77;
readonly name: string = 'InvalidEditionMarker';
constructor() {
super('Invalid Edition Marker');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, InvalidEditionMarkerError);
}
}
}

createErrorFromCodeLookup.set(0x77, () => new InvalidEditionMarkerError());
createErrorFromNameLookup.set('InvalidEditionMarker', () => new InvalidEditionMarkerError());

/**
* ReservationListDeprecated: 'Reservation List is Deprecated'
*
* @category Errors
* @category generated
*/
export class ReservationListDeprecatedError extends Error {
readonly code: number = 0x78;
readonly name: string = 'ReservationListDeprecated';
constructor() {
super('Reservation List is Deprecated');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, ReservationListDeprecatedError);
}
}
}

createErrorFromCodeLookup.set(0x78, () => new ReservationListDeprecatedError());
createErrorFromNameLookup.set(
'ReservationListDeprecated',
() => new ReservationListDeprecatedError(),
);

/**
* PrintEditionDoesNotMatchMasterEdition: 'Print Edition does not match Master Edition'
*
* @category Errors
* @category generated
*/
export class PrintEditionDoesNotMatchMasterEditionError extends Error {
readonly code: number = 0x79;
readonly name: string = 'PrintEditionDoesNotMatchMasterEdition';
constructor() {
super('Print Edition does not match Master Edition');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, PrintEditionDoesNotMatchMasterEditionError);
}
}
}

createErrorFromCodeLookup.set(0x79, () => new PrintEditionDoesNotMatchMasterEditionError());
createErrorFromNameLookup.set(
'PrintEditionDoesNotMatchMasterEdition',
() => new PrintEditionDoesNotMatchMasterEditionError(),
);

/**
* Attempts to resolve a custom program error from the provided error code.
* @category Errors
Expand Down
Loading