Skip to content

Commit

Permalink
Add pNFT Editions (#1143)
Browse files Browse the repository at this point in the history
* Adding edition_marker_v2.

* Adding marker seed.

* Adding divisor to prevent overalloc.

* Responding to feedback and fixing bug.

* Adding Print Instruction (#1094)

* chore: Release

* Update generated SDK and IDL versions for token-metadata 1.11.0 release

* Bubblegum collection docs fix (#1072)

* collection fix

* Revert "collection fix"

This reverts commit cbc20ca.

* change docs for bubblegum

* Allow for 5 creators in Bubblegum (#1086)

* Update token metadata dependency

* Allow data and is_immutable to be updated at same time (#1090)

* Added can_update_data_and_is_mutable_same_instruction to test.
* Also added a couple more tests to Update for other cases.

* Remove Old Testing CLI (#1089)

* remove old CLI

* add README to replace CLI

* chore: Release

* Update generated SDK and IDL versions for token-metadata 1.11.1 release

* Add missing delegate record error (#1093)

* Adding print instruction.

* Add delegate check on transfer (#1095)

* Test delegate status after transfer

* Add delegate check on transfer

* add migration role exception (#1096)

* Allow Bubblegum to create metadata with verified collection (#1087)

* Allow Bubblegum to create metadata with verified collection

* Use separate variable

* Fix ordering in collection verification

* Add test for verifying collection and decompressing
with verified collection.
* Add DigitalAsset from token-metadata in test utils
for creating a collection parent.
* Add needed helper objects such as VerifyCollectionBuilder,
as well as required local test tree updates.
* Fix some clippy issues in the contract.  There are still a
few more clippy issues in the tests but they are more involved.

* Cleanup comment

* Updating based on feedback.

* detect deprecated ixes and provide proper error (#1092)

* detect deprecated ixes and provide proper error

* run cargo fmt

* Removing comments.

* Adding UA check.

* Making code rustier and adding ME check.

* Box test utils err and remove RefCells from test objects (#1097)

* More minor simplifications to Bubblegum BPF tests (#1101)

* Making UA check work for any standard.

* Adding init check.

---------

Co-authored-by: Michael Danenberg <56533526+danenbm@users.noreply.github.com>
Co-authored-by: ethyi <37843741+ethyi@users.noreply.github.com>
Co-authored-by: Fernando Otero <febo@metaplex.com>
Co-authored-by: Samuel Vanderwaal <samuel.vanderwaal@gmail.com>

* Add the ability to burn a ProgrammableNonfungibleEdition (#1108)

* Adding print instruction.

* Updating based on feedback.

* Removing comments.

* Adding UA check.

* Making code rustier and adding ME check.

* Making UA check work for any standard.

* Adding init check.

* Adding burn PR for pNFTEs

* Fixing burn byte offset.

* Adding escrows for pNFTs and removing check for closing the account. (#1110)

* Manually reducing size of Bubblegum IDL for publishing

* Setting Solana to exact version in Bubblegum

* Add operation list (#1098)

* Add operation list

* Update packages version

* Fix typo

* Add operation definition

* Typos

* chore: Release mpl-bubblegum version 0.8.0

* Update Bubblegum npm package version prior to publish

* Fixing in response to feedback.

* replace serialize with metadata save fn

* fix overwriting of fee flag on 'update' (#1114)

* fix overwriting of fee flag on 'update'

* fix index in clean write

---------

Co-authored-by: Michael Danenberg <56533526+danenbm@users.noreply.github.com>
Co-authored-by: Fernando Otero <febo@metaplex.com>
Co-authored-by: Samuel Vanderwaal <samuel.vanderwaal@gmail.com>

* Adding fees and fixing merge errors. (#1116)

* Adding fees and fixing merge errors.

* Adding token standard flag.

* Adding delegate for pNFT editions. (#1130)

* Adding fees for standard NFT editions. (#1131)

* Adding supply and decimal checks. (#1132)

* Adding mint checks. (#1140)

* Removing tests built for statically sized accounts.

* Generating the JS SDK.

* Fixing burn tests and modifying the Edition close auth for utility delegate (#1144)

* Fixing burn test issues.

* Moving UA check up a level.

* Fixing an old test.

* Make mint account optional signer (#1146)

* Fixing burn test issues.

* Moving UA check up a level.

* Fixing an old test.

* Making the mint account an optional signer.

* Removing commented out code.

* Removing unnecessary error.

* Regen JS

---------

Co-authored-by: Michael Danenberg <56533526+danenbm@users.noreply.github.com>
Co-authored-by: ethyi <37843741+ethyi@users.noreply.github.com>
Co-authored-by: Fernando Otero <febo@metaplex.com>
Co-authored-by: Samuel Vanderwaal <samuel.vanderwaal@gmail.com>
  • Loading branch information
5 people authored Jul 14, 2023
1 parent 748c16c commit 976c136
Show file tree
Hide file tree
Showing 37 changed files with 3,491 additions and 167 deletions.
170 changes: 169 additions & 1 deletion token-metadata/js/idl/mpl_token_metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.12.0",
"version": "1.12.2",
"name": "mpl_token_metadata",
"instructions": [
{
Expand Down Expand Up @@ -3578,6 +3578,133 @@
"type": "u8",
"value": 54
}
},
{
"name": "Print",
"accounts": [
{
"name": "editionMetadata",
"isMut": true,
"isSigner": false,
"desc": "New Metadata key (pda of ['metadata', program id, mint id])"
},
{
"name": "edition",
"isMut": true,
"isSigner": false,
"desc": "New Edition (pda of ['metadata', program id, mint id, 'edition'])"
},
{
"name": "editionMint",
"isMut": true,
"isSigner": false,
"desc": "Mint of new token - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY"
},
{
"name": "editionTokenAccountOwner",
"isMut": false,
"isSigner": false,
"desc": "Owner of the token account of new token"
},
{
"name": "editionTokenAccount",
"isMut": true,
"isSigner": false,
"desc": "Token account of new token"
},
{
"name": "editionMintAuthority",
"isMut": false,
"isSigner": true,
"desc": "Mint authority of new mint"
},
{
"name": "editionTokenRecord",
"isMut": true,
"isSigner": false,
"desc": "Token record account",
"optional": true
},
{
"name": "masterEdition",
"isMut": true,
"isSigner": false,
"desc": "Master Record Edition V2 (pda of ['metadata', program id, master metadata mint id, 'edition'])"
},
{
"name": "editionMarkerPda",
"isMut": true,
"isSigner": false,
"desc": "Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number]) where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE)."
},
{
"name": "payer",
"isMut": true,
"isSigner": true,
"desc": "payer"
},
{
"name": "masterTokenAccountOwner",
"isMut": false,
"isSigner": true,
"desc": "owner of token account containing master token"
},
{
"name": "masterTokenAccount",
"isMut": false,
"isSigner": false,
"desc": "token account containing token from master metadata mint"
},
{
"name": "masterMetadata",
"isMut": false,
"isSigner": false,
"desc": "Master record metadata account"
},
{
"name": "updateAuthority",
"isMut": false,
"isSigner": false,
"desc": "The update authority of the master edition."
},
{
"name": "splTokenProgram",
"isMut": false,
"isSigner": false,
"desc": "Token program"
},
{
"name": "splAtaProgram",
"isMut": false,
"isSigner": false,
"desc": "SPL Associated Token Account program"
},
{
"name": "sysvarInstructions",
"isMut": false,
"isSigner": false,
"desc": "Instructions sysvar account"
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false,
"desc": "System program"
}
],
"args": [
{
"name": "printArgs",
"type": {
"defined": "PrintArgs"
}
}
],
"defaultOptionalAccounts": true,
"discriminant": {
"type": "u8",
"value": 55
}
}
],
"accounts": [
Expand Down Expand Up @@ -3680,6 +3807,24 @@
]
}
},
{
"name": "EditionMarkerV2",
"type": {
"kind": "struct",
"fields": [
{
"name": "key",
"type": {
"defined": "Key"
}
},
{
"name": "ledger",
"type": "bytes"
}
]
}
},
{
"name": "TokenOwnedEscrow",
"type": {
Expand Down Expand Up @@ -5225,6 +5370,23 @@
]
}
},
{
"name": "PrintArgs",
"type": {
"kind": "enum",
"variants": [
{
"name": "V1",
"fields": [
{
"name": "edition",
"type": "u64"
}
]
}
]
}
},
{
"name": "LockArgs",
"type": {
Expand Down Expand Up @@ -5321,6 +5483,9 @@
},
{
"name": "ProgrammableNonFungible"
},
{
"name": "ProgrammableNonFungibleEdition"
}
]
}
Expand Down Expand Up @@ -5368,6 +5533,9 @@
},
{
"name": "MetadataDelegate"
},
{
"name": "EditionMarkerV2"
}
]
}
Expand Down
147 changes: 147 additions & 0 deletions token-metadata/js/src/generated/accounts/EditionMarkerV2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/

import * as beet from '@metaplex-foundation/beet';
import * as web3 from '@solana/web3.js';
import * as beetSolana from '@metaplex-foundation/beet-solana';
import { Key, keyBeet } from '../types/Key';

/**
* Arguments used to create {@link EditionMarkerV2}
* @category Accounts
* @category generated
*/
export type EditionMarkerV2Args = {
key: Key;
ledger: Uint8Array;
};
/**
* Holds the data for the {@link EditionMarkerV2} Account and provides de/serialization
* functionality for that data
*
* @category Accounts
* @category generated
*/
export class EditionMarkerV2 implements EditionMarkerV2Args {
private constructor(readonly key: Key, readonly ledger: Uint8Array) {}

/**
* Creates a {@link EditionMarkerV2} instance from the provided args.
*/
static fromArgs(args: EditionMarkerV2Args) {
return new EditionMarkerV2(args.key, args.ledger);
}

/**
* Deserializes the {@link EditionMarkerV2} from the data of the provided {@link web3.AccountInfo}.
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
*/
static fromAccountInfo(
accountInfo: web3.AccountInfo<Buffer>,
offset = 0,
): [EditionMarkerV2, number] {
return EditionMarkerV2.deserialize(accountInfo.data, offset);
}

/**
* Retrieves the account info from the provided address and deserializes
* the {@link EditionMarkerV2} from its data.
*
* @throws Error if no account info is found at the address or if deserialization fails
*/
static async fromAccountAddress(
connection: web3.Connection,
address: web3.PublicKey,
commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig,
): Promise<EditionMarkerV2> {
const accountInfo = await connection.getAccountInfo(address, commitmentOrConfig);
if (accountInfo == null) {
throw new Error(`Unable to find EditionMarkerV2 account at ${address}`);
}
return EditionMarkerV2.fromAccountInfo(accountInfo, 0)[0];
}

/**
* Provides a {@link web3.Connection.getProgramAccounts} config builder,
* to fetch accounts matching filters that can be specified via that builder.
*
* @param programId - the program that owns the accounts we are filtering
*/
static gpaBuilder(
programId: web3.PublicKey = new web3.PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'),
) {
return beetSolana.GpaBuilder.fromStruct(programId, editionMarkerV2Beet);
}

/**
* Deserializes the {@link EditionMarkerV2} from the provided data Buffer.
* @returns a tuple of the account data and the offset up to which the buffer was read to obtain it.
*/
static deserialize(buf: Buffer, offset = 0): [EditionMarkerV2, number] {
return editionMarkerV2Beet.deserialize(buf, offset);
}

/**
* Serializes the {@link EditionMarkerV2} into a Buffer.
* @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it.
*/
serialize(): [Buffer, number] {
return editionMarkerV2Beet.serialize(this);
}

/**
* Returns the byteSize of a {@link Buffer} holding the serialized data of
* {@link EditionMarkerV2} for the provided args.
*
* @param args need to be provided since the byte size for this account
* depends on them
*/
static byteSize(args: EditionMarkerV2Args) {
const instance = EditionMarkerV2.fromArgs(args);
return editionMarkerV2Beet.toFixedFromValue(instance).byteSize;
}

/**
* Fetches the minimum balance needed to exempt an account holding
* {@link EditionMarkerV2} data from rent
*
* @param args need to be provided since the byte size for this account
* depends on them
* @param connection used to retrieve the rent exemption information
*/
static async getMinimumBalanceForRentExemption(
args: EditionMarkerV2Args,
connection: web3.Connection,
commitment?: web3.Commitment,
): Promise<number> {
return connection.getMinimumBalanceForRentExemption(EditionMarkerV2.byteSize(args), commitment);
}

/**
* Returns a readable version of {@link EditionMarkerV2} properties
* and can be used to convert to JSON and/or logging
*/
pretty() {
return {
key: 'Key.' + Key[this.key],
ledger: this.ledger,
};
}
}

/**
* @category Accounts
* @category generated
*/
export const editionMarkerV2Beet = new beet.FixableBeetStruct<EditionMarkerV2, EditionMarkerV2Args>(
[
['key', keyBeet],
['ledger', beet.bytes],
],
EditionMarkerV2.fromArgs,
'EditionMarkerV2',
);
3 changes: 3 additions & 0 deletions token-metadata/js/src/generated/accounts/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './CollectionAuthorityRecord';
export * from './Edition';
export * from './EditionMarker';
export * from './EditionMarkerV2';
export * from './MasterEditionV1';
export * from './MasterEditionV2';
export * from './Metadata';
Expand All @@ -15,6 +16,7 @@ import { CollectionAuthorityRecord } from './CollectionAuthorityRecord';
import { MetadataDelegateRecord } from './MetadataDelegateRecord';
import { Edition } from './Edition';
import { EditionMarker } from './EditionMarker';
import { EditionMarkerV2 } from './EditionMarkerV2';
import { TokenOwnedEscrow } from './TokenOwnedEscrow';
import { MasterEditionV2 } from './MasterEditionV2';
import { MasterEditionV1 } from './MasterEditionV1';
Expand All @@ -29,6 +31,7 @@ export const accountProviders = {
MetadataDelegateRecord,
Edition,
EditionMarker,
EditionMarkerV2,
TokenOwnedEscrow,
MasterEditionV2,
MasterEditionV1,
Expand Down
Loading

0 comments on commit 976c136

Please sign in to comment.