diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8..b589d56 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..b1077fb --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index d02be3f..24a0579 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -15,7 +15,7 @@ - + diff --git a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Accounts.kt b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Accounts.kt index 05ec1ec..528c170 100644 --- a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Accounts.kt +++ b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Accounts.kt @@ -2,7 +2,7 @@ // Accounts // Metaplex // -// This code was generated locally by Funkatronics on 2023-01-30 +// This code was generated locally by Funkatronics on 2023-07-18 // @file:UseSerializers(PublicKeyAs32ByteSerializer::class) @@ -11,6 +11,7 @@ package com.metaplex.lib.experimental.jen.tokenmetadata import com.metaplex.lib.serialization.serializers.solana.PublicKeyAs32ByteSerializer import com.solana.core.PublicKey import kotlin.Boolean +import kotlin.ByteArray import kotlin.UByte import kotlin.ULong import kotlin.collections.List @@ -43,6 +44,9 @@ class Edition( @Serializable class EditionMarker(val key: Key, val ledger: List) +@Serializable +class EditionMarkerV2(val key: Key, val ledger: ByteArray) + @Serializable class TokenOwnedEscrow( val key: Key, @@ -90,7 +94,8 @@ class TokenRecord( val state: TokenState, val ruleSetRevision: ULong?, val delegate: PublicKey?, - val delegateRole: TokenDelegateRole? + val delegateRole: TokenDelegateRole?, + val lockedTransfer: PublicKey? ) @Serializable diff --git a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Errors.kt b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Errors.kt index a110b85..0d35893 100644 --- a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Errors.kt +++ b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Errors.kt @@ -2,7 +2,7 @@ // Errors // Metaplex // -// This code was generated locally by Funkatronics on 2023-01-30 +// This code was generated locally by Funkatronics on 2023-07-18 // package com.metaplex.lib.experimental.jen.tokenmetadata @@ -18,13 +18,13 @@ sealed interface TokenMetadataError { class InstructionUnpackError : TokenMetadataError { override val code: Int = 0 - override val message: String = "Failed to unpack instruction data" + override val message: String = "" } class InstructionPackError : TokenMetadataError { override val code: Int = 1 - override val message: String = "Failed to pack instruction data" + override val message: String = "" } class NotRentExempt : TokenMetadataError { @@ -105,8 +105,7 @@ class UriTooLong : TokenMetadataError { class UpdateAuthorityMustBeEqualToMetadataAuthorityAndSigner : TokenMetadataError { override val code: Int = 14 - override val message: String = - "Update authority must be equivalent to the metadata's authority and also signer of this transaction" + override val message: String = "" } class MintMismatch : TokenMetadataError { @@ -124,44 +123,43 @@ class EditionsMustHaveExactlyOneToken : TokenMetadataError { class MaxEditionsMintedAlready : TokenMetadataError { override val code: Int = 17 - override val message: String = "Maximum editions printed already" + override val message: String = "" } class TokenMintToFailed : TokenMetadataError { override val code: Int = 18 - override val message: String = "Token mint to failed" + override val message: String = "" } class MasterRecordMismatch : TokenMetadataError { override val code: Int = 19 - override val message: String = - "The master edition record passed must match the master record on the edition given" + override val message: String = "" } class DestinationMintMismatch : TokenMetadataError { override val code: Int = 20 - override val message: String = "The destination account does not have the right mint" + override val message: String = "" } class EditionAlreadyMinted : TokenMetadataError { override val code: Int = 21 - override val message: String = "An edition can only mint one of its kind!" + override val message: String = "" } class PrintingMintDecimalsShouldBeZero : TokenMetadataError { override val code: Int = 22 - override val message: String = "Printing mint decimals should be zero" + override val message: String = "" } class OneTimePrintingAuthorizationMintDecimalsShouldBeZero : TokenMetadataError { override val code: Int = 23 - override val message: String = "OneTimePrintingAuthorization mint decimals should be zero" + override val message: String = "" } class EditionMintDecimalsShouldBeZero : TokenMetadataError { @@ -173,14 +171,13 @@ class EditionMintDecimalsShouldBeZero : TokenMetadataError { class TokenBurnFailed : TokenMetadataError { override val code: Int = 25 - override val message: String = "Token burn failed" + override val message: String = "" } class TokenAccountOneTimeAuthMintMismatch : TokenMetadataError { override val code: Int = 26 - override val message: String = - "The One Time authorization mint does not match that on the token account!" + override val message: String = "" } class DerivedKeyInvalid : TokenMetadataError { @@ -224,21 +221,19 @@ class NotEnoughTokens : TokenMetadataError { class PrintingMintAuthorizationAccountMismatch : TokenMetadataError { override val code: Int = 33 - override val message: String = - "The mint on your authorization token holding account does not match your Printing mint!" + override val message: String = "" } class AuthorizationTokenAccountOwnerMismatch : TokenMetadataError { override val code: Int = 34 - override val message: String = - "The authorization token account has a different owner than the update authority for the master edition!" + override val message: String = "" } class Disabled : TokenMetadataError { override val code: Int = 35 - override val message: String = "This feature is currently disabled." + override val message: String = "" } class CreatorsTooLong : TokenMetadataError { @@ -256,8 +251,7 @@ class CreatorsMustBeAtleastOne : TokenMetadataError { class MustBeOneOfCreators : TokenMetadataError { override val code: Int = 38 - override val message: String = - "If using a creators array, you must be one of the creators listed" + override val message: String = "" } class NoCreatorsPresentOnMetadata : TokenMetadataError { @@ -305,32 +299,31 @@ class ShareTotalMustBe100 : TokenMetadataError { class ReservationExists : TokenMetadataError { override val code: Int = 46 - override val message: String = "This reservation list already exists!" + override val message: String = "" } class ReservationDoesNotExist : TokenMetadataError { override val code: Int = 47 - override val message: String = "This reservation list does not exist!" + override val message: String = "" } class ReservationNotSet : TokenMetadataError { override val code: Int = 48 - override val message: String = - "This reservation list exists but was never set with reservations" + override val message: String = "" } class ReservationAlreadyMade : TokenMetadataError { override val code: Int = 49 - override val message: String = "This reservation list has already been set!" + override val message: String = "" } class BeyondMaxAddressSize : TokenMetadataError { override val code: Int = 50 - override val message: String = "Provided more addresses than max allowed in single reservation" + override val message: String = "" } class NumericalOverflowError : TokenMetadataError { @@ -342,14 +335,13 @@ class NumericalOverflowError : TokenMetadataError { class ReservationBreachesMaximumSupply : TokenMetadataError { override val code: Int = 52 - override val message: String = - "This reservation would go beyond the maximum supply of the master edition!" + override val message: String = "" } class AddressNotInReservation : TokenMetadataError { override val code: Int = 53 - override val message: String = "Address not in reservation!" + override val message: String = "" } class CannotVerifyAnotherCreator : TokenMetadataError { @@ -367,8 +359,7 @@ class CannotUnverifyAnotherCreator : TokenMetadataError { class SpotMismatch : TokenMetadataError { override val code: Int = 56 - override val message: String = - "In initial reservation setting, spots remaining should equal total spots" + override val message: String = "" } class IncorrectOwner : TokenMetadataError { @@ -380,8 +371,7 @@ class IncorrectOwner : TokenMetadataError { class PrintingWouldBreachMaximumSupply : TokenMetadataError { override val code: Int = 58 - override val message: String = - "printing these tokens would breach the maximum supply limit of the master edition" + override val message: String = "" } class DataIsImmutable : TokenMetadataError { @@ -399,8 +389,7 @@ class DuplicateCreatorAddress : TokenMetadataError { class ReservationSpotsRemainingShouldMatchTotalSpotsAtStart : TokenMetadataError { override val code: Int = 61 - override val message: String = - "Reservation spots remaining should match total spots when first being created" + override val message: String = "" } class InvalidTokenProgram : TokenMetadataError { @@ -418,19 +407,19 @@ class DataTypeMismatch : TokenMetadataError { class BeyondAlottedAddressSize : TokenMetadataError { override val code: Int = 64 - override val message: String = "Beyond alotted address size in reservation!" + override val message: String = "" } class ReservationNotComplete : TokenMetadataError { override val code: Int = 65 - override val message: String = "The reservation has only been partially alotted" + override val message: String = "" } class TriedToReplaceAnExistingReservation : TokenMetadataError { override val code: Int = 66 - override val message: String = "You cannot splice over an existing reservation!" + override val message: String = "" } class InvalidOperation : TokenMetadataError { @@ -467,8 +456,7 @@ class InvalidEditionIndex : TokenMetadataError { class ReservationArrayShouldBeSizeOne : TokenMetadataError { override val code: Int = 72 - override val message: String = - "In the legacy system the reservation needs to be of size one for cpu limit reasons" + override val message: String = "" } class IsMutableCanOnlyBeFlippedToFalse : TokenMetadataError { @@ -493,8 +481,7 @@ class Removed : TokenMetadataError { class MustBeBurned : TokenMetadataError { override val code: Int = 76 - override val message: String = - "This token use method is burn and there are no remaining uses, it must be burned" + override val message: String = "" } class InvalidUseMethod : TokenMetadataError { @@ -579,7 +566,7 @@ class InvalidUseAuthorityRecord : TokenMetadataError { class InvalidCollectionAuthorityRecord : TokenMetadataError { override val code: Int = 90 - override val message: String = "This Collection Authority Record is invalid." + override val message: String = "" } class InvalidFreezeAuthority : TokenMetadataError { @@ -598,7 +585,7 @@ class InvalidDelegate : TokenMetadataError { class CannotAdjustVerifiedCreator : TokenMetadataError { override val code: Int = 93 - override val message: String = "Creator can not be adjusted once they are verified." + override val message: String = "" } class CannotRemoveVerifiedCreator : TokenMetadataError { @@ -610,13 +597,13 @@ class CannotRemoveVerifiedCreator : TokenMetadataError { class CannotWipeVerifiedCreators : TokenMetadataError { override val code: Int = 95 - override val message: String = "Can not wipe verified creators." + override val message: String = "" } class NotAllowedToChangeSellerFeeBasisPoints : TokenMetadataError { override val code: Int = 96 - override val message: String = "Not allowed to change seller fee basis points." + override val message: String = "" } class EditionOverrideCannotBeZero : TokenMetadataError { @@ -640,7 +627,7 @@ class RevokeCollectionAuthoritySignerIncorrect : TokenMetadataError { class TokenCloseFailed : TokenMetadataError { override val code: Int = 100 - override val message: String = "Token close failed" + override val message: String = "" } class UnsizedCollection : TokenMetadataError { @@ -658,8 +645,7 @@ class SizedCollection : TokenMetadataError { class MissingCollectionMetadata : TokenMetadataError { override val code: Int = 103 - override val message: String = - "Can't burn a verified member of a collection w/o providing collection metadata account" + override val message: String = "Missing collection metadata account" } class NotAMemberOfCollection : TokenMetadataError { @@ -707,7 +693,7 @@ class MasterEditionHasPrints : TokenMetadataError { class BorshDeserializationError : TokenMetadataError { override val code: Int = 111 - override val message: String = "Borsh Deserialization Error" + override val message: String = "" } class CannotUpdateVerifiedCollection : TokenMetadataError { @@ -731,7 +717,7 @@ class AlreadyVerified : TokenMetadataError { class AlreadyUnverified : TokenMetadataError { override val code: Int = 115 - override val message: String = "Item is already unverified." + override val message: String = "" } class NotAPrintEdition : TokenMetadataError { @@ -1051,3 +1037,148 @@ class AmountMustBeGreaterThanZero : TokenMetadataError { override val message: String = "Amount must be greater than zero" } + +class InvalidDelegateArgs : TokenMetadataError { + override val code: Int = 169 + + override val message: String = "Invalid delegate args" +} + +class MissingLockedTransferAddress : TokenMetadataError { + override val code: Int = 170 + + override val message: String = "Missing address for locked transfer" +} + +class InvalidLockedTransferAddress : TokenMetadataError { + override val code: Int = 171 + + override val message: String = "Invalid destination address for locked transfer" +} + +class DataIncrementLimitExceeded : TokenMetadataError { + override val code: Int = 172 + + override val message: String = "Exceeded account realloc increase limit" +} + +class CannotUpdateAssetWithDelegate : TokenMetadataError { + override val code: Int = 173 + + override val message: String = + "Cannot update the rule set of a programmable asset that has a delegate" +} + +class InvalidAmount : TokenMetadataError { + override val code: Int = 174 + + override val message: String = "Invalid token amount for this operation or token standard" +} + +class MissingMasterEditionMintAccount : TokenMetadataError { + override val code: Int = 175 + + override val message: String = "Missing master edition mint account" +} + +class MissingMasterEditionTokenAccount : TokenMetadataError { + override val code: Int = 176 + + override val message: String = "Missing master edition token account" +} + +class MissingEditionMarkerAccount : TokenMetadataError { + override val code: Int = 177 + + override val message: String = "Missing edition marker account" +} + +class CannotBurnWithDelegate : TokenMetadataError { + override val code: Int = 178 + + override val message: String = "Cannot burn while persistent delegate is set" +} + +class MissingEdition : TokenMetadataError { + override val code: Int = 179 + + override val message: String = "Missing edition account" +} + +class InvalidAssociatedTokenAccountProgram : TokenMetadataError { + override val code: Int = 180 + + override val message: String = "Invalid Associated Token Account Program" +} + +class InvalidInstructionsSysvar : TokenMetadataError { + override val code: Int = 181 + + override val message: String = "Invalid InstructionsSysvar" +} + +class InvalidParentAccounts : TokenMetadataError { + override val code: Int = 182 + + override val message: String = "Invalid or Unneeded parent accounts" +} + +class InvalidUpdateArgs : TokenMetadataError { + override val code: Int = 183 + + override val message: String = "Authority cannot apply all update args" +} + +class InsufficientTokenBalance : TokenMetadataError { + override val code: Int = 184 + + override val message: String = "Token account does not have enough tokens" +} + +class MissingCollectionMint : TokenMetadataError { + override val code: Int = 185 + + override val message: String = "Missing collection account" +} + +class MissingCollectionMasterEdition : TokenMetadataError { + override val code: Int = 186 + + override val message: String = "Missing collection master edition account" +} + +class InvalidTokenRecord : TokenMetadataError { + override val code: Int = 187 + + override val message: String = "Invalid token record account" +} + +class InvalidCloseAuthority : TokenMetadataError { + override val code: Int = 188 + + override val message: String = "The close authority needs to be revoked by the Utility Delegate" +} + +class InvalidInstruction : TokenMetadataError { + override val code: Int = 189 + + override val message: String = "Invalid or removed instruction" +} + +class MissingDelegateRecord : TokenMetadataError { + override val code: Int = 190 + + override val message: String = "Missing delegate record" +} + +class InvalidFeeAccount : TokenMetadataError { + override val code: Int = 191 + + override val message: String = "" +} + +class InvalidMetadataFlags : TokenMetadataError { + override val code: Int = 192 + + override val message: String = "" +} diff --git a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Instructions.kt b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Instructions.kt index d7b2fc9..5f8ce12 100644 --- a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Instructions.kt +++ b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Instructions.kt @@ -2,7 +2,7 @@ // Instructions // Metaplex // -// This code was generated locally by Funkatronics on 2023-01-30 +// This code was generated locally by Funkatronics on 2023-07-18 // package com.metaplex.lib.experimental.jen.tokenmetadata @@ -21,8 +21,7 @@ object TokenMetadataInstructions { payer: PublicKey, updateAuthority: PublicKey, systemProgram: PublicKey, - rent: PublicKey, - createMetadataAccountArgs: CreateMetadataAccountArgs + rent: PublicKey ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(metadata, false, true)) @@ -34,20 +33,17 @@ object TokenMetadataInstructions { keys.add(AccountMeta(rent, false, false)) return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(0), - Args_CreateMetadataAccount(createMetadataAccountArgs))) + Args_CreateMetadataAccount())) } - fun UpdateMetadataAccount( - metadata: PublicKey, - updateAuthority: PublicKey, - updateMetadataAccountArgs: UpdateMetadataAccountArgs - ): TransactionInstruction { + fun UpdateMetadataAccount(metadata: PublicKey, updateAuthority: PublicKey): + TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(metadata, false, true)) keys.add(AccountMeta(updateAuthority, true, false)) return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(1), - Args_UpdateMetadataAccount(updateMetadataAccountArgs))) + Args_UpdateMetadataAccount())) } fun DeprecatedCreateMasterEdition( @@ -63,8 +59,7 @@ object TokenMetadataInstructions { tokenProgram: PublicKey, systemProgram: PublicKey, rent: PublicKey, - oneTimePrintingAuthorizationMintAuthority: PublicKey, - createMasterEditionArgs: CreateMasterEditionArgs + oneTimePrintingAuthorizationMintAuthority: PublicKey ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(edition, false, true)) @@ -82,7 +77,7 @@ object TokenMetadataInstructions { keys.add(AccountMeta(oneTimePrintingAuthorizationMintAuthority, true, false)) return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(2), - Args_DeprecatedCreateMasterEdition(createMasterEditionArgs))) + Args_DeprecatedCreateMasterEdition())) } fun DeprecatedMintNewEditionFromMasterEditionViaPrintingToken( @@ -142,8 +137,7 @@ object TokenMetadataInstructions { fun DeprecatedSetReservationList( masterEdition: PublicKey, reservationList: PublicKey, - resource: PublicKey, - setReservationListArgs: SetReservationListArgs + resource: PublicKey ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(masterEdition, false, true)) @@ -151,7 +145,7 @@ object TokenMetadataInstructions { keys.add(AccountMeta(resource, true, false)) return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(5), - Args_DeprecatedSetReservationList(setReservationListArgs))) + Args_DeprecatedSetReservationList())) } fun DeprecatedCreateReservationList( @@ -195,8 +189,7 @@ object TokenMetadataInstructions { metadata: PublicKey, masterEdition: PublicKey, tokenProgram: PublicKey, - rent: PublicKey, - mintPrintingTokensViaTokenArgs: MintPrintingTokensViaTokenArgs + rent: PublicKey ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(destination, false, true)) @@ -210,7 +203,7 @@ object TokenMetadataInstructions { keys.add(AccountMeta(rent, false, false)) return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(8), - Args_DeprecatedMintPrintingTokensViaToken(mintPrintingTokensViaTokenArgs))) + Args_DeprecatedMintPrintingTokensViaToken())) } fun DeprecatedMintPrintingTokens( @@ -220,8 +213,7 @@ object TokenMetadataInstructions { metadata: PublicKey, masterEdition: PublicKey, tokenProgram: PublicKey, - rent: PublicKey, - mintPrintingTokensViaTokenArgs: MintPrintingTokensViaTokenArgs + rent: PublicKey ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(destination, false, true)) @@ -233,7 +225,7 @@ object TokenMetadataInstructions { keys.add(AccountMeta(rent, false, false)) return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(9), - Args_DeprecatedMintPrintingTokens(mintPrintingTokensViaTokenArgs))) + Args_DeprecatedMintPrintingTokens())) } fun CreateMasterEdition( @@ -245,8 +237,7 @@ object TokenMetadataInstructions { metadata: PublicKey, tokenProgram: PublicKey, systemProgram: PublicKey, - rent: PublicKey, - createMasterEditionArgs: CreateMasterEditionArgs + rent: PublicKey ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(edition, false, true)) @@ -260,7 +251,7 @@ object TokenMetadataInstructions { keys.add(AccountMeta(rent, false, false)) return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(10), - Args_CreateMasterEdition(createMasterEditionArgs))) + Args_CreateMasterEdition())) } fun MintNewEditionFromMasterEditionViaToken( @@ -384,8 +375,7 @@ object TokenMetadataInstructions { payer: PublicKey, updateAuthority: PublicKey, systemProgram: PublicKey, - rent: PublicKey?, - createMetadataAccountArgsV2: CreateMetadataAccountArgsV2 + rent: PublicKey? ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(metadata, false, true)) @@ -397,7 +387,7 @@ object TokenMetadataInstructions { rent?.let { keys.add(AccountMeta(it, false, false)) } return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(16), - Args_CreateMetadataAccountV2(createMetadataAccountArgsV2))) + Args_CreateMetadataAccountV2())) } fun CreateMasterEditionV3( @@ -433,7 +423,8 @@ object TokenMetadataInstructions { payer: PublicKey, collectionMint: PublicKey, collection: PublicKey, - collectionMasterEditionAccount: PublicKey + collectionMasterEditionAccount: PublicKey, + collectionAuthorityRecord: PublicKey? ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(metadata, false, true)) @@ -442,6 +433,7 @@ object TokenMetadataInstructions { keys.add(AccountMeta(collectionMint, false, false)) keys.add(AccountMeta(collection, false, false)) keys.add(AccountMeta(collectionMasterEditionAccount, false, false)) + collectionAuthorityRecord?.let { keys.add(AccountMeta(it, false, false)) } return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(18), Args_VerifyCollection())) @@ -803,7 +795,7 @@ object TokenMetadataInstructions { ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(metadata, false, true)) - keys.add(AccountMeta(updateAuthority, true, true)) + keys.add(AccountMeta(updateAuthority, true, false)) keys.add(AccountMeta(mint, false, false)) edition?.let { keys.add(AccountMeta(it, false, false)) } return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), @@ -944,36 +936,58 @@ object TokenMetadataInstructions { } fun Burn( + authority: PublicKey, + collectionMetadata: PublicKey?, metadata: PublicKey, - owner: PublicKey, + edition: PublicKey?, mint: PublicKey, - tokenAccount: PublicKey, - masterEditionAccount: PublicKey, + token: PublicKey, + masterEdition: PublicKey?, + masterEditionMint: PublicKey?, + masterEditionToken: PublicKey?, + editionMarker: PublicKey?, + tokenRecord: PublicKey?, + systemProgram: PublicKey, + sysvarInstructions: PublicKey, splTokenProgram: PublicKey, - collectionMetadata: PublicKey?, - authorizationRules: PublicKey?, - authorizationRulesProgram: PublicKey?, burnArgs: BurnArgs ): TransactionInstruction { val keys = mutableListOf() + keys.add(AccountMeta(authority, true, true)) + collectionMetadata?.let { keys.add(AccountMeta(it, false, true)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } keys.add(AccountMeta(metadata, false, true)) - keys.add(AccountMeta(owner, true, true)) + edition?.let { keys.add(AccountMeta(it, false, true)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } keys.add(AccountMeta(mint, false, true)) - keys.add(AccountMeta(tokenAccount, false, true)) - keys.add(AccountMeta(masterEditionAccount, false, true)) - keys.add(AccountMeta(splTokenProgram, false, false)) - collectionMetadata?.let { keys.add(AccountMeta(it, false, true)) } + keys.add(AccountMeta(token, false, true)) + masterEdition?.let { keys.add(AccountMeta(it, false, true)) } ?: run { keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), false, false)) } - authorizationRules?.let { keys.add(AccountMeta(it, false, false)) } + masterEditionMint?.let { keys.add(AccountMeta(it, false, false)) } ?: run { keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), false, false)) } - authorizationRulesProgram?.let { keys.add(AccountMeta(it, false, false)) } + masterEditionToken?.let { keys.add(AccountMeta(it, false, false)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } + editionMarker?.let { keys.add(AccountMeta(it, false, true)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } + tokenRecord?.let { keys.add(AccountMeta(it, false, true)) } ?: run { keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), false, false)) } + keys.add(AccountMeta(systemProgram, false, false)) + keys.add(AccountMeta(sysvarInstructions, false, false)) + keys.add(AccountMeta(splTokenProgram, false, false)) return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(41), Args_Burn(burnArgs))) } @@ -1033,7 +1047,7 @@ object TokenMetadataInstructions { keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), false, false)) } keys.add(AccountMeta(metadata, false, false)) - masterEdition?.let { keys.add(AccountMeta(it, false, false)) } + masterEdition?.let { keys.add(AccountMeta(it, false, true)) } ?: run { keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), false, false)) } @@ -1300,8 +1314,7 @@ object TokenMetadataInstructions { sysvarInstructions: PublicKey, splTokenProgram: PublicKey, authorizationRulesProgram: PublicKey?, - authorizationRules: PublicKey?, - migrateArgs: MigrateArgs + authorizationRules: PublicKey? ): TransactionInstruction { val keys = mutableListOf() keys.add(AccountMeta(metadata, false, true)) @@ -1313,7 +1326,7 @@ object TokenMetadataInstructions { keys.add(AccountMeta(authority, true, false)) keys.add(AccountMeta(collectionMetadata, false, false)) keys.add(AccountMeta(delegateRecord, false, false)) - keys.add(AccountMeta(tokenRecord, false, false)) + keys.add(AccountMeta(tokenRecord, false, true)) keys.add(AccountMeta(systemProgram, false, false)) keys.add(AccountMeta(sysvarInstructions, false, false)) keys.add(AccountMeta(splTokenProgram, false, false)) @@ -1326,8 +1339,7 @@ object TokenMetadataInstructions { keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), false, false)) } return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), - keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(48), - Args_Migrate(migrateArgs))) + keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(48), Args_Migrate())) } fun Transfer( @@ -1414,7 +1426,7 @@ object TokenMetadataInstructions { false, false)) } keys.add(AccountMeta(mint, false, false)) keys.add(AccountMeta(metadata, false, true)) - edition?.let { keys.add(AccountMeta(it, false, true)) } + edition?.let { keys.add(AccountMeta(it, false, false)) } ?: run { keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), false, false)) } @@ -1485,38 +1497,138 @@ object TokenMetadataInstructions { } fun Verify( + authority: PublicKey, + delegateRecord: PublicKey?, metadata: PublicKey, - collectionAuthority: PublicKey, - payer: PublicKey, - authorizationRules: PublicKey?, - authorizationRulesProgram: PublicKey?, - verifyArgs: VerifyArgs + collectionMint: PublicKey?, + collectionMetadata: PublicKey?, + collectionMasterEdition: PublicKey?, + systemProgram: PublicKey, + sysvarInstructions: PublicKey, + verificationArgs: VerificationArgs ): TransactionInstruction { val keys = mutableListOf() + keys.add(AccountMeta(authority, true, false)) + delegateRecord?.let { keys.add(AccountMeta(it, false, false)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } keys.add(AccountMeta(metadata, false, true)) - keys.add(AccountMeta(collectionAuthority, true, true)) - keys.add(AccountMeta(payer, true, true)) - authorizationRules?.let { keys.add(AccountMeta(it, false, false)) } + collectionMint?.let { keys.add(AccountMeta(it, false, false)) } ?: run { keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), false, false)) } - authorizationRulesProgram?.let { keys.add(AccountMeta(it, false, false)) } + collectionMetadata?.let { keys.add(AccountMeta(it, false, true)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } + collectionMasterEdition?.let { keys.add(AccountMeta(it, false, false)) } ?: run { keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), false, false)) } + keys.add(AccountMeta(systemProgram, false, false)) + keys.add(AccountMeta(sysvarInstructions, false, false)) return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(52), - Args_Verify(verifyArgs))) + Args_Verify(verificationArgs))) + } + + fun Unverify( + authority: PublicKey, + delegateRecord: PublicKey?, + metadata: PublicKey, + collectionMint: PublicKey?, + collectionMetadata: PublicKey?, + systemProgram: PublicKey, + sysvarInstructions: PublicKey, + verificationArgs: VerificationArgs + ): TransactionInstruction { + val keys = mutableListOf() + keys.add(AccountMeta(authority, true, false)) + delegateRecord?.let { keys.add(AccountMeta(it, false, false)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } + keys.add(AccountMeta(metadata, false, true)) + collectionMint?.let { keys.add(AccountMeta(it, false, false)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } + collectionMetadata?.let { keys.add(AccountMeta(it, false, true)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } + keys.add(AccountMeta(systemProgram, false, false)) + keys.add(AccountMeta(sysvarInstructions, false, false)) + return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(53), + Args_Unverify(verificationArgs))) + } + + fun Collect(authority: PublicKey, pdaAccount: PublicKey): TransactionInstruction { + val keys = mutableListOf() + keys.add(AccountMeta(authority, true, false)) + keys.add(AccountMeta(pdaAccount, false, false)) + return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(54), Args_Collect())) + } + + fun Print( + editionMetadata: PublicKey, + edition: PublicKey, + editionMint: PublicKey, + editionTokenAccountOwner: PublicKey, + editionTokenAccount: PublicKey, + editionMintAuthority: PublicKey, + editionTokenRecord: PublicKey?, + masterEdition: PublicKey, + editionMarkerPda: PublicKey, + payer: PublicKey, + masterTokenAccountOwner: PublicKey, + masterTokenAccount: PublicKey, + masterMetadata: PublicKey, + updateAuthority: PublicKey, + splTokenProgram: PublicKey, + splAtaProgram: PublicKey, + sysvarInstructions: PublicKey, + systemProgram: PublicKey, + printArgs: PrintArgs + ): TransactionInstruction { + val keys = mutableListOf() + keys.add(AccountMeta(editionMetadata, false, true)) + keys.add(AccountMeta(edition, false, true)) + keys.add(AccountMeta(editionMint, false, true)) + keys.add(AccountMeta(editionTokenAccountOwner, false, false)) + keys.add(AccountMeta(editionTokenAccount, false, true)) + keys.add(AccountMeta(editionMintAuthority, true, false)) + editionTokenRecord?.let { keys.add(AccountMeta(it, false, true)) } + ?: run { + keys.add(AccountMeta(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + false, false)) } + keys.add(AccountMeta(masterEdition, false, true)) + keys.add(AccountMeta(editionMarkerPda, false, true)) + keys.add(AccountMeta(payer, true, true)) + keys.add(AccountMeta(masterTokenAccountOwner, true, false)) + keys.add(AccountMeta(masterTokenAccount, false, false)) + keys.add(AccountMeta(masterMetadata, false, false)) + keys.add(AccountMeta(updateAuthority, false, false)) + keys.add(AccountMeta(splTokenProgram, false, false)) + keys.add(AccountMeta(splAtaProgram, false, false)) + keys.add(AccountMeta(sysvarInstructions, false, false)) + keys.add(AccountMeta(systemProgram, false, false)) + return TransactionInstruction(PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"), + keys, Borsh.encodeToByteArray(ByteDiscriminatorSerializer(55), + Args_Print(printArgs))) } @Serializable - class Args_CreateMetadataAccount(val createMetadataAccountArgs: CreateMetadataAccountArgs) + class Args_CreateMetadataAccount() @Serializable - class Args_UpdateMetadataAccount(val updateMetadataAccountArgs: UpdateMetadataAccountArgs) + class Args_UpdateMetadataAccount() @Serializable - class Args_DeprecatedCreateMasterEdition(val createMasterEditionArgs: CreateMasterEditionArgs) + class Args_DeprecatedCreateMasterEdition() @Serializable class Args_DeprecatedMintNewEditionFromMasterEditionViaPrintingToken() @@ -1525,7 +1637,7 @@ object TokenMetadataInstructions { class Args_UpdatePrimarySaleHappenedViaToken() @Serializable - class Args_DeprecatedSetReservationList(val setReservationListArgs: SetReservationListArgs) + class Args_DeprecatedSetReservationList() @Serializable class Args_DeprecatedCreateReservationList() @@ -1534,15 +1646,13 @@ object TokenMetadataInstructions { class Args_SignMetadata() @Serializable - class Args_DeprecatedMintPrintingTokensViaToken(val mintPrintingTokensViaTokenArgs: - MintPrintingTokensViaTokenArgs) + class Args_DeprecatedMintPrintingTokensViaToken() @Serializable - class Args_DeprecatedMintPrintingTokens(val mintPrintingTokensViaTokenArgs: - MintPrintingTokensViaTokenArgs) + class Args_DeprecatedMintPrintingTokens() @Serializable - class Args_CreateMasterEdition(val createMasterEditionArgs: CreateMasterEditionArgs) + class Args_CreateMasterEdition() @Serializable class Args_MintNewEditionFromMasterEditionViaToken(val @@ -1564,7 +1674,7 @@ object TokenMetadataInstructions { class Args_UpdateMetadataAccountV2(val updateMetadataAccountArgsV2: UpdateMetadataAccountArgsV2) @Serializable - class Args_CreateMetadataAccountV2(val createMetadataAccountArgsV2: CreateMetadataAccountArgsV2) + class Args_CreateMetadataAccountV2() @Serializable class Args_CreateMasterEditionV3(val createMasterEditionArgs: CreateMasterEditionArgs) @@ -1660,7 +1770,7 @@ object TokenMetadataInstructions { class Args_Unlock(val unlockArgs: UnlockArgs) @Serializable - class Args_Migrate(val migrateArgs: MigrateArgs) + class Args_Migrate() @Serializable class Args_Transfer(val transferArgs: TransferArgs) @@ -1672,5 +1782,14 @@ object TokenMetadataInstructions { class Args_Use(val useArgs: UseArgs) @Serializable - class Args_Verify(val verifyArgs: VerifyArgs) + class Args_Verify(val verificationArgs: VerificationArgs) + + @Serializable + class Args_Unverify(val verificationArgs: VerificationArgs) + + @Serializable + class Args_Collect() + + @Serializable + class Args_Print(val printArgs: PrintArgs) } diff --git a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Types.kt b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Types.kt index d648488..98cb2f2 100644 --- a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Types.kt +++ b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/Types.kt @@ -2,7 +2,7 @@ // Types // Metaplex // -// This code was generated locally by Funkatronics on 2023-01-30 +// This code was generated locally by Funkatronics on 2023-07-18 // @file:UseSerializers(PublicKeyAs32ByteSerializer::class) @@ -30,30 +30,6 @@ import kotlinx.serialization.encoding.Encoder @Serializable data class SetCollectionSizeArgs(val size: ULong) -@Serializable -data class CreateMetadataAccountArgsV2(val data: DataV2, val isMutable: Boolean) - -@Serializable -data class CreateMetadataAccountArgs(val data: Data, val isMutable: Boolean) - -@Serializable -data class UpdateMetadataAccountArgs( - val data: Data?, - val updateAuthority: PublicKey?, - val primarySaleHappened: Boolean? -) - -@Serializable -data class MintPrintingTokensViaTokenArgs(val supply: ULong) - -@Serializable -data class SetReservationListArgs( - val reservations: List, - val totalReservationSpots: ULong?, - val offset: ULong, - val totalSpotOffset: ULong -) - @Serializable data class CreateMasterEditionArgs(val maxSupply: ULong?) @@ -89,7 +65,6 @@ data class AuthorizationData(val payload: Payload) @Serializable data class AssetData( - val updateAuthority: PublicKey, val name: String, val symbol: String, val uri: String, @@ -155,7 +130,7 @@ data class SeedsVec(val seeds: List) data class LeafInfo(val leaf: List, val proof: List>) @Serializable -data class Payload(val map: HashMap) +data class Payload(val map: HashMap) @Serializable data class Uses( @@ -166,7 +141,7 @@ data class Uses( @Serializable(with = BurnArgsSerializer::class) sealed class BurnArgs { - data class V1(val authorization_data: AuthorizationData?) : BurnArgs() + data class V1(val amount: ULong) : BurnArgs() } class BurnArgsSerializer : KSerializer { @@ -178,9 +153,7 @@ class BurnArgsSerializer : KSerializer { is BurnArgs.V1 -> { encoder.encodeSerializableValue(Byte.serializer(), 0.toByte()) - - encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, - value.authorization_data) + encoder.encodeSerializableValue(kotlin.ULong.serializer(), value.amount) } else -> { throw Throwable("Can not serialize")} } @@ -188,38 +161,7 @@ class BurnArgsSerializer : KSerializer { override fun deserialize(decoder: Decoder): BurnArgs = when(decoder.decodeByte().toInt()){ 0 -> BurnArgs.V1 ( - authorization_data = - decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), - ) else -> { throw Throwable("Can not deserialize")} - } -} - -@Serializable(with = VerifyArgsSerializer::class) -sealed class VerifyArgs { - data class V1(val authorization_data: AuthorizationData?) : VerifyArgs() -} - -class VerifyArgsSerializer : KSerializer { - override val descriptor: SerialDescriptor = - kotlinx.serialization.json.JsonObject.serializer().descriptor - - override fun serialize(encoder: Encoder, value: VerifyArgs) { - when(value){ - is VerifyArgs.V1 -> { - encoder.encodeSerializableValue(Byte.serializer(), 0.toByte()) - - - encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, - value.authorization_data) - } - else -> { throw Throwable("Can not serialize")} - } - } - - override fun deserialize(decoder: Decoder): VerifyArgs = when(decoder.decodeByte().toInt()){ - 0 -> VerifyArgs.V1 ( - authorization_data = - decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + amount = decoder.decodeSerializableValue(kotlin.ULong.serializer()), ) else -> { throw Throwable("Can not deserialize")} } } @@ -234,7 +176,7 @@ sealed class DelegateArgs { data class TransferV1(val amount: ULong, val authorization_data: AuthorizationData?) : DelegateArgs() - data class UpdateV1(val authorization_data: AuthorizationData?) : DelegateArgs() + data class DataV1(val authorization_data: AuthorizationData?) : DelegateArgs() data class UtilityV1(val amount: ULong, val authorization_data: AuthorizationData?) : DelegateArgs() @@ -243,6 +185,22 @@ sealed class DelegateArgs { DelegateArgs() data class StandardV1(val amount: ULong) : DelegateArgs() + + data class LockedTransferV1( + val amount: ULong, + val locked_address: PublicKey, + val authorization_data: AuthorizationData? + ) : DelegateArgs() + + data class ProgrammableConfigV1(val authorization_data: AuthorizationData?) : DelegateArgs() + + data class AuthorityItemV1(val authorization_data: AuthorizationData?) : DelegateArgs() + + data class DataItemV1(val authorization_data: AuthorizationData?) : DelegateArgs() + + data class CollectionItemV1(val authorization_data: AuthorizationData?) : DelegateArgs() + + data class ProgrammableConfigItemV1(val authorization_data: AuthorizationData?) : DelegateArgs() } class DelegateArgsSerializer : KSerializer { @@ -274,7 +232,7 @@ class DelegateArgsSerializer : KSerializer { encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, value.authorization_data) } - is DelegateArgs.UpdateV1 -> { + is DelegateArgs.DataV1 -> { encoder.encodeSerializableValue(Byte.serializer(), 3.toByte()) @@ -302,6 +260,50 @@ class DelegateArgsSerializer : KSerializer { encoder.encodeSerializableValue(kotlin.ULong.serializer(), value.amount) } + is DelegateArgs.LockedTransferV1 -> { + encoder.encodeSerializableValue(Byte.serializer(), 7.toByte()) + + encoder.encodeSerializableValue(kotlin.ULong.serializer(), value.amount) + encoder.encodeSerializableValue(PublicKeyAs32ByteSerializer, value.locked_address) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is DelegateArgs.ProgrammableConfigV1 -> { + encoder.encodeSerializableValue(Byte.serializer(), 8.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is DelegateArgs.AuthorityItemV1 -> { + encoder.encodeSerializableValue(Byte.serializer(), 9.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is DelegateArgs.DataItemV1 -> { + encoder.encodeSerializableValue(Byte.serializer(), 10.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is DelegateArgs.CollectionItemV1 -> { + encoder.encodeSerializableValue(Byte.serializer(), 11.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is DelegateArgs.ProgrammableConfigItemV1 -> { + encoder.encodeSerializableValue(Byte.serializer(), 12.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } else -> { throw Throwable("Can not serialize")} } } @@ -318,7 +320,7 @@ class DelegateArgsSerializer : KSerializer { amount = decoder.decodeSerializableValue(kotlin.ULong.serializer()), authorization_data = decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), - ) 3 -> DelegateArgs.UpdateV1 ( + ) 3 -> DelegateArgs.DataV1 ( authorization_data = decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), ) 4 -> DelegateArgs.UtilityV1 ( @@ -331,6 +333,26 @@ class DelegateArgsSerializer : KSerializer { decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), ) 6 -> DelegateArgs.StandardV1 ( amount = decoder.decodeSerializableValue(kotlin.ULong.serializer()), + ) 7 -> DelegateArgs.LockedTransferV1 ( + amount = decoder.decodeSerializableValue(kotlin.ULong.serializer()), + locked_address = decoder.decodeSerializableValue(PublicKeyAs32ByteSerializer), + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 8 -> DelegateArgs.ProgrammableConfigV1 ( + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 9 -> DelegateArgs.AuthorityItemV1 ( + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 10 -> DelegateArgs.DataItemV1 ( + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 11 -> DelegateArgs.CollectionItemV1 ( + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 12 -> DelegateArgs.ProgrammableConfigItemV1 ( + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), ) else -> { throw Throwable("Can not deserialize")} } } @@ -343,24 +365,46 @@ enum class RevokeArgs { TransferV1, - UpdateV1, + DataV1, UtilityV1, StakingV1, - StandardV1 + StandardV1, + + LockedTransferV1, + + ProgrammableConfigV1, + + MigrationV1, + + AuthorityItemV1, + + DataItemV1, + + CollectionItemV1, + + ProgrammableConfigItemV1 } @Serializable enum class MetadataDelegateRole { - Authority, + AuthorityItem, Collection, Use, - Update + Data, + + ProgrammableConfig, + + DataItem, + + CollectionItem, + + ProgrammableConfigItem } @Serializable(with = CreateArgsSerializer::class) @@ -481,6 +525,45 @@ sealed class UpdateArgs { val rule_set: RuleSetToggle, val authorization_data: AuthorizationData? ) : UpdateArgs() + + data class AsUpdateAuthorityV2( + val new_update_authority: PublicKey?, + val data: Data?, + val primary_sale_happened: Boolean?, + val is_mutable: Boolean?, + val collection: CollectionToggle, + val collection_details: CollectionDetailsToggle, + val uses: UsesToggle, + val rule_set: RuleSetToggle, + val token_standard: TokenStandard?, + val authorization_data: AuthorizationData? + ) : UpdateArgs() + + data class AsAuthorityItemDelegateV2( + val new_update_authority: PublicKey?, + val primary_sale_happened: Boolean?, + val is_mutable: Boolean?, + val token_standard: TokenStandard?, + val authorization_data: AuthorizationData? + ) : UpdateArgs() + + data class AsCollectionDelegateV2(val collection: CollectionToggle, val authorization_data: + AuthorizationData?) : UpdateArgs() + + data class AsDataDelegateV2(val data: Data?, val authorization_data: AuthorizationData?) : + UpdateArgs() + + data class AsProgrammableConfigDelegateV2(val rule_set: RuleSetToggle, val authorization_data: + AuthorizationData?) : UpdateArgs() + + data class AsDataItemDelegateV2(val data: Data?, val authorization_data: AuthorizationData?) : + UpdateArgs() + + data class AsCollectionItemDelegateV2(val collection: CollectionToggle, val authorization_data: + AuthorizationData?) : UpdateArgs() + + data class AsProgrammableConfigItemDelegateV2(val rule_set: RuleSetToggle, val + authorization_data: AuthorizationData?) : UpdateArgs() } class UpdateArgsSerializer : KSerializer { @@ -511,6 +594,113 @@ class UpdateArgsSerializer : KSerializer { encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.UsesToggle.serializer(), value.uses) + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.RuleSetToggle.serializer(), + value.rule_set) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is UpdateArgs.AsUpdateAuthorityV2 -> { + encoder.encodeSerializableValue(Byte.serializer(), 1.toByte()) + + encoder.encodeSerializableValue(PublicKeyAs32ByteSerializer.nullable, + value.new_update_authority) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.Data.serializer().nullable, + value.data) + encoder.encodeSerializableValue(kotlin.Boolean.serializer().nullable, + value.primary_sale_happened) + encoder.encodeSerializableValue(kotlin.Boolean.serializer().nullable, + value.is_mutable) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.CollectionToggle.serializer(), + value.collection) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.CollectionDetailsToggle.serializer(), + value.collection_details) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.UsesToggle.serializer(), + value.uses) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.RuleSetToggle.serializer(), + value.rule_set) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.TokenStandard.serializer().nullable, + value.token_standard) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is UpdateArgs.AsAuthorityItemDelegateV2 -> { + encoder.encodeSerializableValue(Byte.serializer(), 2.toByte()) + + encoder.encodeSerializableValue(PublicKeyAs32ByteSerializer.nullable, + value.new_update_authority) + encoder.encodeSerializableValue(kotlin.Boolean.serializer().nullable, + value.primary_sale_happened) + encoder.encodeSerializableValue(kotlin.Boolean.serializer().nullable, + value.is_mutable) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.TokenStandard.serializer().nullable, + value.token_standard) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is UpdateArgs.AsCollectionDelegateV2 -> { + encoder.encodeSerializableValue(Byte.serializer(), 3.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.CollectionToggle.serializer(), + value.collection) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is UpdateArgs.AsDataDelegateV2 -> { + encoder.encodeSerializableValue(Byte.serializer(), 4.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.Data.serializer().nullable, + value.data) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is UpdateArgs.AsProgrammableConfigDelegateV2 -> { + encoder.encodeSerializableValue(Byte.serializer(), 5.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.RuleSetToggle.serializer(), + value.rule_set) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is UpdateArgs.AsDataItemDelegateV2 -> { + encoder.encodeSerializableValue(Byte.serializer(), 6.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.Data.serializer().nullable, + value.data) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is UpdateArgs.AsCollectionItemDelegateV2 -> { + encoder.encodeSerializableValue(Byte.serializer(), 7.toByte()) + + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.CollectionToggle.serializer(), + value.collection) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable, + value.authorization_data) + } + is UpdateArgs.AsProgrammableConfigItemDelegateV2 -> { + encoder.encodeSerializableValue(Byte.serializer(), 8.toByte()) + + encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.RuleSetToggle.serializer(), value.rule_set) @@ -540,6 +730,66 @@ class UpdateArgsSerializer : KSerializer { decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.RuleSetToggle.serializer()), authorization_data = decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 1 -> UpdateArgs.AsUpdateAuthorityV2 ( + new_update_authority = + decoder.decodeSerializableValue(PublicKeyAs32ByteSerializer.nullable), + data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.Data.serializer().nullable), + primary_sale_happened = + decoder.decodeSerializableValue(kotlin.Boolean.serializer().nullable), + is_mutable = decoder.decodeSerializableValue(kotlin.Boolean.serializer().nullable), + collection = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.CollectionToggle.serializer()), + collection_details = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.CollectionDetailsToggle.serializer()), + uses = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.UsesToggle.serializer()), + rule_set = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.RuleSetToggle.serializer()), + token_standard = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.TokenStandard.serializer().nullable), + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 2 -> UpdateArgs.AsAuthorityItemDelegateV2 ( + new_update_authority = + decoder.decodeSerializableValue(PublicKeyAs32ByteSerializer.nullable), + primary_sale_happened = + decoder.decodeSerializableValue(kotlin.Boolean.serializer().nullable), + is_mutable = decoder.decodeSerializableValue(kotlin.Boolean.serializer().nullable), + token_standard = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.TokenStandard.serializer().nullable), + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 3 -> UpdateArgs.AsCollectionDelegateV2 ( + collection = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.CollectionToggle.serializer()), + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 4 -> UpdateArgs.AsDataDelegateV2 ( + data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.Data.serializer().nullable), + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 5 -> UpdateArgs.AsProgrammableConfigDelegateV2 ( + rule_set = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.RuleSetToggle.serializer()), + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 6 -> UpdateArgs.AsDataItemDelegateV2 ( + data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.Data.serializer().nullable), + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 7 -> UpdateArgs.AsCollectionItemDelegateV2 ( + collection = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.CollectionToggle.serializer()), + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), + ) 8 -> UpdateArgs.AsProgrammableConfigItemDelegateV2 ( + rule_set = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.RuleSetToggle.serializer()), + authorization_data = + decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.AuthorizationData.serializer().nullable), ) else -> { throw Throwable("Can not deserialize")} } } @@ -711,34 +961,29 @@ class RuleSetToggleSerializer : KSerializer { } } -@Serializable(with = MigrateArgsSerializer::class) -sealed class MigrateArgs { - data class V1(val migration_type: MigrationType, val rule_set: PublicKey?) : MigrateArgs() +@Serializable(with = PrintArgsSerializer::class) +sealed class PrintArgs { + data class V1(val edition: ULong) : PrintArgs() } -class MigrateArgsSerializer : KSerializer { +class PrintArgsSerializer : KSerializer { override val descriptor: SerialDescriptor = kotlinx.serialization.json.JsonObject.serializer().descriptor - override fun serialize(encoder: Encoder, value: MigrateArgs) { + override fun serialize(encoder: Encoder, value: PrintArgs) { when(value){ - is MigrateArgs.V1 -> { + is PrintArgs.V1 -> { encoder.encodeSerializableValue(Byte.serializer(), 0.toByte()) - - encoder.encodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.MigrationType.serializer(), - value.migration_type) - encoder.encodeSerializableValue(PublicKeyAs32ByteSerializer.nullable, value.rule_set) + encoder.encodeSerializableValue(kotlin.ULong.serializer(), value.edition) } else -> { throw Throwable("Can not serialize")} } } - override fun deserialize(decoder: Decoder): MigrateArgs = when(decoder.decodeByte().toInt()){ - 0 -> MigrateArgs.V1 ( - migration_type = - decoder.decodeSerializableValue(com.metaplex.lib.experimental.jen.tokenmetadata.MigrationType.serializer()), - rule_set = decoder.decodeSerializableValue(PublicKeyAs32ByteSerializer.nullable), + override fun deserialize(decoder: Decoder): PrintArgs = when(decoder.decodeByte().toInt()){ + 0 -> PrintArgs.V1 ( + edition = decoder.decodeSerializableValue(kotlin.ULong.serializer()), ) else -> { throw Throwable("Can not deserialize")} } } @@ -833,6 +1078,13 @@ class UseArgsSerializer : KSerializer { } } +@Serializable +enum class VerificationArgs { + CreatorV1, + + CollectionV1 +} + @Serializable enum class TokenStandard { NonFungible, @@ -843,7 +1095,9 @@ enum class TokenStandard { NonFungibleEdition, - ProgrammableNonFungible + ProgrammableNonFungible, + + ProgrammableNonFungibleEdition } @Serializable @@ -872,7 +1126,9 @@ enum class Key { TokenRecord, - MetadataDelegate + MetadataDelegate, + + EditionMarkerV2 } @Serializable(with = CollectionDetailsSerializer::class) @@ -1035,6 +1291,8 @@ enum class TokenDelegateRole { Standard, + LockedTransfer, + Migration } @@ -1044,9 +1302,34 @@ enum class AuthorityType { Metadata, + Holder, + + MetadataDelegate, + + TokenDelegate +} + +@Serializable +enum class PayloadKey { + Amount, + + Authority, + + AuthoritySeeds, + Delegate, - Holder + DelegateSeeds, + + Destination, + + DestinationSeeds, + + Holder, + + Source, + + SourceSeeds } @Serializable(with = PayloadTypeSerializer::class) @@ -1103,17 +1386,6 @@ class PayloadTypeSerializer : KSerializer { } } -@Serializable -enum class PayloadKey { - Target, - - Holder, - - Authority, - - Amount -} - @Serializable enum class UseMethod { Burn, diff --git a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/idl.kt b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/idl.kt index f1d9e03..87e00a9 100644 --- a/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/idl.kt +++ b/lib/src/main/java/com/metaplex/lib/experimental/jen/tokenmetadata/idl.kt @@ -12,7 +12,7 @@ import org.intellij.lang.annotations.Language @Language("json") val tokenMetadataJson = """ { - "version": "1.7.0-beta.2", + "version": "1.13.0", "name": "mpl_token_metadata", "instructions": [ { @@ -61,14 +61,7 @@ val tokenMetadataJson = """ "desc": "Rent info" } ], - "args": [ - { - "name": "createMetadataAccountArgs", - "type": { - "defined": "CreateMetadataAccountArgs" - } - } - ], + "args": [], "discriminant": { "type": "u8", "value": 0 @@ -90,14 +83,7 @@ val tokenMetadataJson = """ "desc": "Update authority key" } ], - "args": [ - { - "name": "updateMetadataAccountArgs", - "type": { - "defined": "UpdateMetadataAccountArgs" - } - } - ], + "args": [], "discriminant": { "type": "u8", "value": 1 @@ -185,14 +171,7 @@ val tokenMetadataJson = """ "desc": "One time authorization printing mint authority - must be provided if using max supply. THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY." } ], - "args": [ - { - "name": "createMasterEditionArgs", - "type": { - "defined": "CreateMasterEditionArgs" - } - } - ], + "args": [], "discriminant": { "type": "u8", "value": 2 @@ -355,14 +334,7 @@ val tokenMetadataJson = """ "desc": "The resource you tied the reservation list too" } ], - "args": [ - { - "name": "setReservationListArgs", - "type": { - "defined": "SetReservationListArgs" - } - } - ], + "args": [], "discriminant": { "type": "u8", "value": 5 @@ -506,14 +478,7 @@ val tokenMetadataJson = """ "desc": "Rent" } ], - "args": [ - { - "name": "mintPrintingTokensViaTokenArgs", - "type": { - "defined": "MintPrintingTokensViaTokenArgs" - } - } - ], + "args": [], "discriminant": { "type": "u8", "value": 8 @@ -565,14 +530,7 @@ val tokenMetadataJson = """ "desc": "Rent" } ], - "args": [ - { - "name": "mintPrintingTokensViaTokenArgs", - "type": { - "defined": "MintPrintingTokensViaTokenArgs" - } - } - ], + "args": [], "discriminant": { "type": "u8", "value": 9 @@ -636,14 +594,7 @@ val tokenMetadataJson = """ "desc": "Rent info" } ], - "args": [ - { - "name": "createMasterEditionArgs", - "type": { - "defined": "CreateMasterEditionArgs" - } - } - ], + "args": [], "discriminant": { "type": "u8", "value": 10 @@ -991,14 +942,7 @@ val tokenMetadataJson = """ "optional": true } ], - "args": [ - { - "name": "createMetadataAccountArgsV2", - "type": { - "defined": "CreateMetadataAccountArgsV2" - } - } - ], + "args": [], "discriminant": { "type": "u8", "value": 16 @@ -1114,6 +1058,13 @@ val tokenMetadataJson = """ "isMut": false, "isSigner": false, "desc": "MasterEdition2 Account of the Collection Token" + }, + { + "name": "collectionAuthorityRecord", + "isMut": false, + "isSigner": false, + "desc": "Collection Authority Record PDA", + "optional": true } ], "args": [], @@ -1994,7 +1945,7 @@ val tokenMetadataJson = """ }, { "name": "updateAuthority", - "isMut": true, + "isMut": false, "isSigner": true, "desc": "Metadata update authority" }, @@ -2358,6 +2309,19 @@ val tokenMetadataJson = """ { "name": "Burn", "accounts": [ + { + "name": "authority", + "isMut": true, + "isSigner": true, + "desc": "Asset owner or Utility delegate" + }, + { + "name": "collectionMetadata", + "isMut": true, + "isSigner": false, + "desc": "Metadata of the Collection", + "optional": true + }, { "name": "metadata", "isMut": true, @@ -2365,10 +2329,11 @@ val tokenMetadataJson = """ "desc": "Metadata (pda of ['metadata', program id, mint id])" }, { - "name": "owner", + "name": "edition", "isMut": true, - "isSigner": true, - "desc": "Asset owner" + "isSigner": false, + "desc": "Edition of the asset", + "optional": true }, { "name": "mint", @@ -2377,43 +2342,63 @@ val tokenMetadataJson = """ "desc": "Mint of token asset" }, { - "name": "tokenAccount", + "name": "token", "isMut": true, "isSigner": false, "desc": "Token account to close" }, { - "name": "masterEditionAccount", + "name": "masterEdition", "isMut": true, "isSigner": false, - "desc": "MasterEdition of the asset" + "desc": "Master edition account", + "optional": true }, { - "name": "splTokenProgram", + "name": "masterEditionMint", "isMut": false, "isSigner": false, - "desc": "SPL Token Program" + "desc": "Master edition mint of the asset", + "optional": true }, { - "name": "collectionMetadata", + "name": "masterEditionToken", + "isMut": false, + "isSigner": false, + "desc": "Master edition token account", + "optional": true + }, + { + "name": "editionMarker", "isMut": true, "isSigner": false, - "desc": "Metadata of the Collection", + "desc": "Edition marker account", "optional": true }, { - "name": "authorizationRules", - "isMut": false, + "name": "tokenRecord", + "isMut": true, "isSigner": false, - "desc": "Token Authorization Rules account", + "desc": "Token record account", "optional": true }, { - "name": "authorizationRulesProgram", + "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "desc": "System program" + }, + { + "name": "sysvarInstructions", + "isMut": false, + "isSigner": false, + "desc": "Instructions sysvar account" + }, + { + "name": "splTokenProgram", + "isMut": false, + "isSigner": false, + "desc": "SPL Token Program" } ], "args": [ @@ -2527,7 +2512,7 @@ val tokenMetadataJson = """ }, { "name": "masterEdition", - "isMut": false, + "isMut": true, "isSigner": false, "desc": "Master Edition account", "optional": true @@ -2842,7 +2827,7 @@ val tokenMetadataJson = """ "name": "authority", "isMut": false, "isSigner": true, - "desc": "Delegate account" + "desc": "Delegate or freeze authority" }, { "name": "tokenOwner", @@ -2944,7 +2929,7 @@ val tokenMetadataJson = """ "name": "authority", "isMut": false, "isSigner": true, - "desc": "Delegate account" + "desc": "Delegate or freeze authority" }, { "name": "tokenOwner", @@ -3076,7 +3061,7 @@ val tokenMetadataJson = """ "name": "payer", "isMut": true, "isSigner": true, - "desc": "Update authority" + "desc": "Payer" }, { "name": "authority", @@ -3098,7 +3083,7 @@ val tokenMetadataJson = """ }, { "name": "tokenRecord", - "isMut": false, + "isMut": true, "isSigner": false, "desc": "Token record account" }, @@ -3118,7 +3103,7 @@ val tokenMetadataJson = """ "name": "splTokenProgram", "isMut": false, "isSigner": false, - "desc": "Token Program" + "desc": "SPL Token Program" }, { "name": "authorizationRulesProgram", @@ -3135,14 +3120,7 @@ val tokenMetadataJson = """ "optional": true } ], - "args": [ - { - "name": "migrateArgs", - "type": { - "defined": "MigrateArgs" - } - } - ], + "args": [], "defaultOptionalAccounts": true, "discriminant": { "type": "u8", @@ -3199,21 +3177,21 @@ val tokenMetadataJson = """ "name": "ownerTokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account", + "desc": "Owner token record account", "optional": true }, { "name": "destinationTokenRecord", "isMut": true, "isSigner": false, - "desc": "Token record account", + "desc": "Destination token record account", "optional": true }, { "name": "authority", "isMut": false, "isSigner": true, - "desc": "Transfer authority (token or delegate owner)" + "desc": "Transfer authority (token owner or delegate)" }, { "name": "payer", @@ -3311,7 +3289,7 @@ val tokenMetadataJson = """ }, { "name": "edition", - "isMut": true, + "isMut": false, "isSigner": false, "desc": "Edition account", "optional": true @@ -3332,7 +3310,7 @@ val tokenMetadataJson = """ "name": "sysvarInstructions", "isMut": false, "isSigner": false, - "desc": "System program" + "desc": "Instructions sysvar account" }, { "name": "authorizationRulesProgram", @@ -3462,6 +3440,19 @@ val tokenMetadataJson = """ { "name": "Verify", "accounts": [ + { + "name": "authority", + "isMut": false, + "isSigner": true, + "desc": "Creator to verify, collection update authority or delegate" + }, + { + "name": "delegateRecord", + "isMut": false, + "isSigner": false, + "desc": "Delegate record PDA", + "optional": true + }, { "name": "metadata", "isMut": true, @@ -3469,37 +3460,44 @@ val tokenMetadataJson = """ "desc": "Metadata account" }, { - "name": "collectionAuthority", - "isMut": true, - "isSigner": true, - "desc": "Collection Update authority" + "name": "collectionMint", + "isMut": false, + "isSigner": false, + "desc": "Mint of the Collection", + "optional": true }, { - "name": "payer", + "name": "collectionMetadata", "isMut": true, - "isSigner": true, - "desc": "payer" + "isSigner": false, + "desc": "Metadata Account of the Collection", + "optional": true }, { - "name": "authorizationRules", + "name": "collectionMasterEdition", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules account", + "desc": "Master Edition Account of the Collection Token", "optional": true }, { - "name": "authorizationRulesProgram", + "name": "systemProgram", "isMut": false, "isSigner": false, - "desc": "Token Authorization Rules Program", - "optional": true + "desc": "System program" + }, + { + "name": "sysvarInstructions", + "isMut": false, + "isSigner": false, + "desc": "Instructions sysvar account" } ], "args": [ { - "name": "verifyArgs", + "name": "verificationArgs", "type": { - "defined": "VerifyArgs" + "defined": "VerificationArgs" } } ], @@ -3508,78 +3506,290 @@ val tokenMetadataJson = """ "type": "u8", "value": 52 } - } - ], - "accounts": [ - { - "name": "CollectionAuthorityRecord", - "type": { - "kind": "struct", - "fields": [ - { - "name": "key", - "type": { - "defined": "Key" - } - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "updateAuthority", - "type": { - "option": "publicKey" - } - } - ] - } - }, - { - "name": "MetadataDelegateRecord", - "type": { - "kind": "struct", - "fields": [ - { - "name": "key", - "type": { - "defined": "Key" - } - }, - { - "name": "bump", - "type": "u8" - }, - { - "name": "mint", - "type": "publicKey" - }, - { - "name": "delegate", - "type": "publicKey" - }, - { - "name": "updateAuthority", - "type": "publicKey" - } - ] - } }, { - "name": "Edition", - "type": { - "kind": "struct", - "fields": [ - { - "name": "key", - "type": { - "defined": "Key" - } - }, - { - "name": "parent", - "type": "publicKey" - }, + "name": "Unverify", + "accounts": [ + { + "name": "authority", + "isMut": false, + "isSigner": true, + "desc": "Creator to verify, collection (or metadata if parent burned) update authority or delegate" + }, + { + "name": "delegateRecord", + "isMut": false, + "isSigner": false, + "desc": "Delegate record PDA", + "optional": true + }, + { + "name": "metadata", + "isMut": true, + "isSigner": false, + "desc": "Metadata account" + }, + { + "name": "collectionMint", + "isMut": false, + "isSigner": false, + "desc": "Mint of the Collection", + "optional": true + }, + { + "name": "collectionMetadata", + "isMut": true, + "isSigner": false, + "desc": "Metadata Account of the Collection", + "optional": true + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "desc": "System program" + }, + { + "name": "sysvarInstructions", + "isMut": false, + "isSigner": false, + "desc": "Instructions sysvar account" + } + ], + "args": [ + { + "name": "verificationArgs", + "type": { + "defined": "VerificationArgs" + } + } + ], + "defaultOptionalAccounts": true, + "discriminant": { + "type": "u8", + "value": 53 + } + }, + { + "name": "Collect", + "accounts": [ + { + "name": "authority", + "isMut": false, + "isSigner": true, + "desc": "Authority to collect fees" + }, + { + "name": "pdaAccount", + "isMut": false, + "isSigner": false, + "desc": "PDA to retrieve fees from" + } + ], + "args": [], + "discriminant": { + "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": [ + { + "name": "CollectionAuthorityRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "Key" + } + }, + { + "name": "bump", + "type": "u8" + }, + { + "name": "updateAuthority", + "type": { + "option": "publicKey" + } + } + ] + } + }, + { + "name": "MetadataDelegateRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "Key" + } + }, + { + "name": "bump", + "type": "u8" + }, + { + "name": "mint", + "type": "publicKey" + }, + { + "name": "delegate", + "type": "publicKey" + }, + { + "name": "updateAuthority", + "type": "publicKey" + } + ] + } + }, + { + "name": "Edition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "Key" + } + }, + { + "name": "parent", + "type": "publicKey" + }, { "name": "edition", "type": "u64" @@ -3610,6 +3820,24 @@ val tokenMetadataJson = """ ] } }, + { + "name": "EditionMarkerV2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "key", + "type": { + "defined": "Key" + } + }, + { + "name": "ledger", + "type": "bytes" + } + ] + } + }, { "name": "TokenOwnedEscrow", "type": { @@ -3816,6 +4044,12 @@ val tokenMetadataJson = """ "defined": "TokenDelegateRole" } } + }, + { + "name": "lockedTransfer", + "type": { + "option": "publicKey" + } } ] } @@ -3928,112 +4162,6 @@ val tokenMetadataJson = """ ] } }, - { - "name": "CreateMetadataAccountArgsV2", - "type": { - "kind": "struct", - "fields": [ - { - "name": "data", - "type": { - "defined": "DataV2" - } - }, - { - "name": "isMutable", - "type": "bool" - } - ] - } - }, - { - "name": "CreateMetadataAccountArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "data", - "type": { - "defined": "Data" - } - }, - { - "name": "isMutable", - "type": "bool" - } - ] - } - }, - { - "name": "UpdateMetadataAccountArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "data", - "type": { - "option": { - "defined": "Data" - } - } - }, - { - "name": "updateAuthority", - "type": { - "option": "publicKey" - } - }, - { - "name": "primarySaleHappened", - "type": { - "option": "bool" - } - } - ] - } - }, - { - "name": "MintPrintingTokensViaTokenArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "supply", - "type": "u64" - } - ] - } - }, - { - "name": "SetReservationListArgs", - "type": { - "kind": "struct", - "fields": [ - { - "name": "reservations", - "type": { - "vec": { - "defined": "Reservation" - } - } - }, - { - "name": "totalReservationSpots", - "type": { - "option": "u64" - } - }, - { - "name": "offset", - "type": "u64" - }, - { - "name": "totalSpotOffset", - "type": "u64" - } - ] - } - }, { "name": "CreateMasterEditionArgs", "type": { @@ -4175,10 +4303,6 @@ val tokenMetadataJson = """ "type": { "kind": "struct", "fields": [ - { - "name": "updateAuthority", - "type": "publicKey" - }, { "name": "name", "type": "string" @@ -4463,9 +4587,7 @@ val tokenMetadataJson = """ "name": "map", "type": { "hashMap": [ - { - "defined": "PayloadKey" - }, + "string", { "defined": "PayloadType" } @@ -4506,12 +4628,8 @@ val tokenMetadataJson = """ "name": "V1", "fields": [ { - "name": "authorization_data", - "type": { - "option": { - "defined": "AuthorizationData" - } - } + "name": "amount", + "type": "u64" } ] } @@ -4519,12 +4637,12 @@ val tokenMetadataJson = """ } }, { - "name": "VerifyArgs", + "name": "DelegateArgs", "type": { "kind": "enum", "variants": [ { - "name": "V1", + "name": "CollectionV1", "fields": [ { "name": "authorization_data", @@ -4535,18 +4653,14 @@ val tokenMetadataJson = """ } } ] - } - ] - } - }, - { - "name": "DelegateArgs", - "type": { - "kind": "enum", - "variants": [ + }, { - "name": "CollectionV1", + "name": "SaleV1", "fields": [ + { + "name": "amount", + "type": "u64" + }, { "name": "authorization_data", "type": { @@ -4558,7 +4672,7 @@ val tokenMetadataJson = """ ] }, { - "name": "SaleV1", + "name": "TransferV1", "fields": [ { "name": "amount", @@ -4575,12 +4689,85 @@ val tokenMetadataJson = """ ] }, { - "name": "TransferV1", + "name": "DataV1", + "fields": [ + { + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" + } + } + } + ] + }, + { + "name": "UtilityV1", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" + } + } + } + ] + }, + { + "name": "StakingV1", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" + } + } + } + ] + }, + { + "name": "StandardV1", + "fields": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "LockedTransferV1", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "locked_address", + "type": "publicKey" + }, + { + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" + } + } + } + ] + }, + { + "name": "ProgrammableConfigV1", "fields": [ - { - "name": "amount", - "type": "u64" - }, { "name": "authorization_data", "type": { @@ -4592,7 +4779,7 @@ val tokenMetadataJson = """ ] }, { - "name": "UpdateV1", + "name": "AuthorityItemV1", "fields": [ { "name": "authorization_data", @@ -4605,12 +4792,8 @@ val tokenMetadataJson = """ ] }, { - "name": "UtilityV1", + "name": "DataItemV1", "fields": [ - { - "name": "amount", - "type": "u64" - }, { "name": "authorization_data", "type": { @@ -4622,12 +4805,8 @@ val tokenMetadataJson = """ ] }, { - "name": "StakingV1", + "name": "CollectionItemV1", "fields": [ - { - "name": "amount", - "type": "u64" - }, { "name": "authorization_data", "type": { @@ -4639,11 +4818,15 @@ val tokenMetadataJson = """ ] }, { - "name": "StandardV1", + "name": "ProgrammableConfigItemV1", "fields": [ { - "name": "amount", - "type": "u64" + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" + } + } } ] } @@ -4665,7 +4848,7 @@ val tokenMetadataJson = """ "name": "TransferV1" }, { - "name": "UpdateV1" + "name": "DataV1" }, { "name": "UtilityV1" @@ -4675,6 +4858,27 @@ val tokenMetadataJson = """ }, { "name": "StandardV1" + }, + { + "name": "LockedTransferV1" + }, + { + "name": "ProgrammableConfigV1" + }, + { + "name": "MigrationV1" + }, + { + "name": "AuthorityItemV1" + }, + { + "name": "DataItemV1" + }, + { + "name": "CollectionItemV1" + }, + { + "name": "ProgrammableConfigItemV1" } ] } @@ -4685,7 +4889,7 @@ val tokenMetadataJson = """ "kind": "enum", "variants": [ { - "name": "Authority" + "name": "AuthorityItem" }, { "name": "Collection" @@ -4694,7 +4898,19 @@ val tokenMetadataJson = """ "name": "Use" }, { - "name": "Update" + "name": "Data" + }, + { + "name": "ProgrammableConfig" + }, + { + "name": "DataItem" + }, + { + "name": "CollectionItem" + }, + { + "name": "ProgrammableConfigItem" } ] } @@ -4705,44 +4921,269 @@ val tokenMetadataJson = """ "kind": "enum", "variants": [ { - "name": "V1", + "name": "V1", + "fields": [ + { + "name": "asset_data", + "type": { + "defined": "AssetData" + } + }, + { + "name": "decimals", + "type": { + "option": "u8" + } + }, + { + "name": "print_supply", + "type": { + "option": { + "defined": "PrintSupply" + } + } + } + ] + } + ] + } + }, + { + "name": "MintArgs", + "type": { + "kind": "enum", + "variants": [ + { + "name": "V1", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" + } + } + } + ] + } + ] + } + }, + { + "name": "TransferArgs", + "type": { + "kind": "enum", + "variants": [ + { + "name": "V1", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" + } + } + } + ] + } + ] + } + }, + { + "name": "UpdateArgs", + "type": { + "kind": "enum", + "variants": [ + { + "name": "V1", + "fields": [ + { + "name": "new_update_authority", + "type": { + "option": "publicKey" + } + }, + { + "name": "data", + "type": { + "option": { + "defined": "Data" + } + } + }, + { + "name": "primary_sale_happened", + "type": { + "option": "bool" + } + }, + { + "name": "is_mutable", + "type": { + "option": "bool" + } + }, + { + "name": "collection", + "type": { + "defined": "CollectionToggle" + } + }, + { + "name": "collection_details", + "type": { + "defined": "CollectionDetailsToggle" + } + }, + { + "name": "uses", + "type": { + "defined": "UsesToggle" + } + }, + { + "name": "rule_set", + "type": { + "defined": "RuleSetToggle" + } + }, + { + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" + } + } + } + ] + }, + { + "name": "AsUpdateAuthorityV2", + "fields": [ + { + "name": "new_update_authority", + "type": { + "option": "publicKey" + } + }, + { + "name": "data", + "type": { + "option": { + "defined": "Data" + } + } + }, + { + "name": "primary_sale_happened", + "type": { + "option": "bool" + } + }, + { + "name": "is_mutable", + "type": { + "option": "bool" + } + }, + { + "name": "collection", + "type": { + "defined": "CollectionToggle" + } + }, + { + "name": "collection_details", + "type": { + "defined": "CollectionDetailsToggle" + } + }, + { + "name": "uses", + "type": { + "defined": "UsesToggle" + } + }, + { + "name": "rule_set", + "type": { + "defined": "RuleSetToggle" + } + }, + { + "name": "token_standard", + "type": { + "option": { + "defined": "TokenStandard" + } + } + }, + { + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" + } + } + } + ] + }, + { + "name": "AsAuthorityItemDelegateV2", "fields": [ { - "name": "asset_data", + "name": "new_update_authority", "type": { - "defined": "AssetData" + "option": "publicKey" } }, { - "name": "decimals", + "name": "primary_sale_happened", "type": { - "option": "u8" + "option": "bool" } }, { - "name": "print_supply", + "name": "is_mutable", + "type": { + "option": "bool" + } + }, + { + "name": "token_standard", "type": { "option": { - "defined": "PrintSupply" + "defined": "TokenStandard" + } + } + }, + { + "name": "authorization_data", + "type": { + "option": { + "defined": "AuthorizationData" } } } ] - } - ] - } - }, - { - "name": "MintArgs", - "type": { - "kind": "enum", - "variants": [ + }, { - "name": "V1", + "name": "AsCollectionDelegateV2", "fields": [ { - "name": "amount", - "type": "u64" + "name": "collection", + "type": { + "defined": "CollectionToggle" + } }, { "name": "authorization_data", @@ -4753,21 +5194,17 @@ val tokenMetadataJson = """ } } ] - } - ] - } - }, - { - "name": "TransferArgs", - "type": { - "kind": "enum", - "variants": [ + }, { - "name": "V1", + "name": "AsDataDelegateV2", "fields": [ { - "name": "amount", - "type": "u64" + "name": "data", + "type": { + "option": { + "defined": "Data" + } + } }, { "name": "authorization_data", @@ -4778,44 +5215,50 @@ val tokenMetadataJson = """ } } ] - } - ] - } - }, - { - "name": "UpdateArgs", - "type": { - "kind": "enum", - "variants": [ + }, { - "name": "V1", + "name": "AsProgrammableConfigDelegateV2", "fields": [ { - "name": "new_update_authority", + "name": "rule_set", "type": { - "option": "publicKey" + "defined": "RuleSetToggle" } }, { - "name": "data", + "name": "authorization_data", "type": { "option": { - "defined": "Data" + "defined": "AuthorizationData" } } - }, + } + ] + }, + { + "name": "AsDataItemDelegateV2", + "fields": [ { - "name": "primary_sale_happened", + "name": "data", "type": { - "option": "bool" + "option": { + "defined": "Data" + } } }, { - "name": "is_mutable", + "name": "authorization_data", "type": { - "option": "bool" + "option": { + "defined": "AuthorizationData" + } } - }, + } + ] + }, + { + "name": "AsCollectionItemDelegateV2", + "fields": [ { "name": "collection", "type": { @@ -4823,17 +5266,18 @@ val tokenMetadataJson = """ } }, { - "name": "collection_details", - "type": { - "defined": "CollectionDetailsToggle" - } - }, - { - "name": "uses", + "name": "authorization_data", "type": { - "defined": "UsesToggle" + "option": { + "defined": "AuthorizationData" + } } - }, + } + ] + }, + { + "name": "AsProgrammableConfigItemDelegateV2", + "fields": [ { "name": "rule_set", "type": { @@ -4940,7 +5384,7 @@ val tokenMetadataJson = """ } }, { - "name": "MigrateArgs", + "name": "PrintArgs", "type": { "kind": "enum", "variants": [ @@ -4948,16 +5392,8 @@ val tokenMetadataJson = """ "name": "V1", "fields": [ { - "name": "migration_type", - "type": { - "defined": "MigrationType" - } - }, - { - "name": "rule_set", - "type": { - "option": "publicKey" - } + "name": "edition", + "type": "u64" } ] } @@ -5027,6 +5463,20 @@ val tokenMetadataJson = """ ] } }, + { + "name": "VerificationArgs", + "type": { + "kind": "enum", + "variants": [ + { + "name": "CreatorV1" + }, + { + "name": "CollectionV1" + } + ] + } + }, { "name": "TokenStandard", "type": { @@ -5046,6 +5496,9 @@ val tokenMetadataJson = """ }, { "name": "ProgrammableNonFungible" + }, + { + "name": "ProgrammableNonFungibleEdition" } ] } @@ -5093,6 +5546,9 @@ val tokenMetadataJson = """ }, { "name": "MetadataDelegate" + }, + { + "name": "EditionMarkerV2" } ] } @@ -5221,6 +5677,9 @@ val tokenMetadataJson = """ { "name": "Standard" }, + { + "name": "LockedTransfer" + }, { "name": "Migration" } @@ -5238,11 +5697,52 @@ val tokenMetadataJson = """ { "name": "Metadata" }, + { + "name": "Holder" + }, + { + "name": "MetadataDelegate" + }, + { + "name": "TokenDelegate" + } + ] + } + }, + { + "name": "PayloadKey", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Amount" + }, + { + "name": "Authority" + }, + { + "name": "AuthoritySeeds" + }, { "name": "Delegate" }, + { + "name": "DelegateSeeds" + }, + { + "name": "Destination" + }, + { + "name": "DestinationSeeds" + }, { "name": "Holder" + }, + { + "name": "Source" + }, + { + "name": "SourceSeeds" } ] } @@ -5283,26 +5783,6 @@ val tokenMetadataJson = """ ] } }, - { - "name": "PayloadKey", - "type": { - "kind": "enum", - "variants": [ - { - "name": "Target" - }, - { - "name": "Holder" - }, - { - "name": "Authority" - }, - { - "name": "Amount" - } - ] - } - }, { "name": "UseMethod", "type": { @@ -5325,12 +5805,12 @@ val tokenMetadataJson = """ { "code": 0, "name": "InstructionUnpackError", - "msg": "Failed to unpack instruction data" + "msg": "" }, { "code": 1, "name": "InstructionPackError", - "msg": "Failed to pack instruction data" + "msg": "" }, { "code": 2, @@ -5395,7 +5875,7 @@ val tokenMetadataJson = """ { "code": 14, "name": "UpdateAuthorityMustBeEqualToMetadataAuthorityAndSigner", - "msg": "Update authority must be equivalent to the metadata's authority and also signer of this transaction" + "msg": "" }, { "code": 15, @@ -5410,37 +5890,37 @@ val tokenMetadataJson = """ { "code": 17, "name": "MaxEditionsMintedAlready", - "msg": "Maximum editions printed already" + "msg": "" }, { "code": 18, "name": "TokenMintToFailed", - "msg": "Token mint to failed" + "msg": "" }, { "code": 19, "name": "MasterRecordMismatch", - "msg": "The master edition record passed must match the master record on the edition given" + "msg": "" }, { "code": 20, "name": "DestinationMintMismatch", - "msg": "The destination account does not have the right mint" + "msg": "" }, { "code": 21, "name": "EditionAlreadyMinted", - "msg": "An edition can only mint one of its kind!" + "msg": "" }, { "code": 22, "name": "PrintingMintDecimalsShouldBeZero", - "msg": "Printing mint decimals should be zero" + "msg": "" }, { "code": 23, "name": "OneTimePrintingAuthorizationMintDecimalsShouldBeZero", - "msg": "OneTimePrintingAuthorization mint decimals should be zero" + "msg": "" }, { "code": 24, @@ -5450,12 +5930,12 @@ val tokenMetadataJson = """ { "code": 25, "name": "TokenBurnFailed", - "msg": "Token burn failed" + "msg": "" }, { "code": 26, "name": "TokenAccountOneTimeAuthMintMismatch", - "msg": "The One Time authorization mint does not match that on the token account!" + "msg": "" }, { "code": 27, @@ -5490,17 +5970,17 @@ val tokenMetadataJson = """ { "code": 33, "name": "PrintingMintAuthorizationAccountMismatch", - "msg": "The mint on your authorization token holding account does not match your Printing mint!" + "msg": "" }, { "code": 34, "name": "AuthorizationTokenAccountOwnerMismatch", - "msg": "The authorization token account has a different owner than the update authority for the master edition!" + "msg": "" }, { "code": 35, "name": "Disabled", - "msg": "This feature is currently disabled." + "msg": "" }, { "code": 36, @@ -5515,7 +5995,7 @@ val tokenMetadataJson = """ { "code": 38, "name": "MustBeOneOfCreators", - "msg": "If using a creators array, you must be one of the creators listed" + "msg": "" }, { "code": 39, @@ -5555,27 +6035,27 @@ val tokenMetadataJson = """ { "code": 46, "name": "ReservationExists", - "msg": "This reservation list already exists!" + "msg": "" }, { "code": 47, "name": "ReservationDoesNotExist", - "msg": "This reservation list does not exist!" + "msg": "" }, { "code": 48, "name": "ReservationNotSet", - "msg": "This reservation list exists but was never set with reservations" + "msg": "" }, { "code": 49, "name": "ReservationAlreadyMade", - "msg": "This reservation list has already been set!" + "msg": "" }, { "code": 50, "name": "BeyondMaxAddressSize", - "msg": "Provided more addresses than max allowed in single reservation" + "msg": "" }, { "code": 51, @@ -5585,12 +6065,12 @@ val tokenMetadataJson = """ { "code": 52, "name": "ReservationBreachesMaximumSupply", - "msg": "This reservation would go beyond the maximum supply of the master edition!" + "msg": "" }, { "code": 53, "name": "AddressNotInReservation", - "msg": "Address not in reservation!" + "msg": "" }, { "code": 54, @@ -5605,7 +6085,7 @@ val tokenMetadataJson = """ { "code": 56, "name": "SpotMismatch", - "msg": "In initial reservation setting, spots remaining should equal total spots" + "msg": "" }, { "code": 57, @@ -5615,7 +6095,7 @@ val tokenMetadataJson = """ { "code": 58, "name": "PrintingWouldBreachMaximumSupply", - "msg": "printing these tokens would breach the maximum supply limit of the master edition" + "msg": "" }, { "code": 59, @@ -5630,7 +6110,7 @@ val tokenMetadataJson = """ { "code": 61, "name": "ReservationSpotsRemainingShouldMatchTotalSpotsAtStart", - "msg": "Reservation spots remaining should match total spots when first being created" + "msg": "" }, { "code": 62, @@ -5645,17 +6125,17 @@ val tokenMetadataJson = """ { "code": 64, "name": "BeyondAlottedAddressSize", - "msg": "Beyond alotted address size in reservation!" + "msg": "" }, { "code": 65, "name": "ReservationNotComplete", - "msg": "The reservation has only been partially alotted" + "msg": "" }, { "code": 66, "name": "TriedToReplaceAnExistingReservation", - "msg": "You cannot splice over an existing reservation!" + "msg": "" }, { "code": 67, @@ -5685,7 +6165,7 @@ val tokenMetadataJson = """ { "code": 72, "name": "ReservationArrayShouldBeSizeOne", - "msg": "In the legacy system the reservation needs to be of size one for cpu limit reasons" + "msg": "" }, { "code": 73, @@ -5705,7 +6185,7 @@ val tokenMetadataJson = """ { "code": 76, "name": "MustBeBurned", - "msg": "This token use method is burn and there are no remaining uses, it must be burned" + "msg": "" }, { "code": 77, @@ -5775,7 +6255,7 @@ val tokenMetadataJson = """ { "code": 90, "name": "InvalidCollectionAuthorityRecord", - "msg": "This Collection Authority Record is invalid." + "msg": "" }, { "code": 91, @@ -5790,7 +6270,7 @@ val tokenMetadataJson = """ { "code": 93, "name": "CannotAdjustVerifiedCreator", - "msg": "Creator can not be adjusted once they are verified." + "msg": "" }, { "code": 94, @@ -5800,12 +6280,12 @@ val tokenMetadataJson = """ { "code": 95, "name": "CannotWipeVerifiedCreators", - "msg": "Can not wipe verified creators." + "msg": "" }, { "code": 96, "name": "NotAllowedToChangeSellerFeeBasisPoints", - "msg": "Not allowed to change seller fee basis points." + "msg": "" }, { "code": 97, @@ -5825,7 +6305,7 @@ val tokenMetadataJson = """ { "code": 100, "name": "TokenCloseFailed", - "msg": "Token close failed" + "msg": "" }, { "code": 101, @@ -5840,7 +6320,7 @@ val tokenMetadataJson = """ { "code": 103, "name": "MissingCollectionMetadata", - "msg": "Can't burn a verified member of a collection w/o providing collection metadata account" + "msg": "Missing collection metadata account" }, { "code": 104, @@ -5880,7 +6360,7 @@ val tokenMetadataJson = """ { "code": 111, "name": "BorshDeserializationError", - "msg": "Borsh Deserialization Error" + "msg": "" }, { "code": 112, @@ -5900,7 +6380,7 @@ val tokenMetadataJson = """ { "code": 115, "name": "AlreadyUnverified", - "msg": "Item is already unverified." + "msg": "" }, { "code": 116, @@ -6166,6 +6646,126 @@ val tokenMetadataJson = """ "code": 168, "name": "AmountMustBeGreaterThanZero", "msg": "Amount must be greater than zero" + }, + { + "code": 169, + "name": "InvalidDelegateArgs", + "msg": "Invalid delegate args" + }, + { + "code": 170, + "name": "MissingLockedTransferAddress", + "msg": "Missing address for locked transfer" + }, + { + "code": 171, + "name": "InvalidLockedTransferAddress", + "msg": "Invalid destination address for locked transfer" + }, + { + "code": 172, + "name": "DataIncrementLimitExceeded", + "msg": "Exceeded account realloc increase limit" + }, + { + "code": 173, + "name": "CannotUpdateAssetWithDelegate", + "msg": "Cannot update the rule set of a programmable asset that has a delegate" + }, + { + "code": 174, + "name": "InvalidAmount", + "msg": "Invalid token amount for this operation or token standard" + }, + { + "code": 175, + "name": "MissingMasterEditionMintAccount", + "msg": "Missing master edition mint account" + }, + { + "code": 176, + "name": "MissingMasterEditionTokenAccount", + "msg": "Missing master edition token account" + }, + { + "code": 177, + "name": "MissingEditionMarkerAccount", + "msg": "Missing edition marker account" + }, + { + "code": 178, + "name": "CannotBurnWithDelegate", + "msg": "Cannot burn while persistent delegate is set" + }, + { + "code": 179, + "name": "MissingEdition", + "msg": "Missing edition account" + }, + { + "code": 180, + "name": "InvalidAssociatedTokenAccountProgram", + "msg": "Invalid Associated Token Account Program" + }, + { + "code": 181, + "name": "InvalidInstructionsSysvar", + "msg": "Invalid InstructionsSysvar" + }, + { + "code": 182, + "name": "InvalidParentAccounts", + "msg": "Invalid or Unneeded parent accounts" + }, + { + "code": 183, + "name": "InvalidUpdateArgs", + "msg": "Authority cannot apply all update args" + }, + { + "code": 184, + "name": "InsufficientTokenBalance", + "msg": "Token account does not have enough tokens" + }, + { + "code": 185, + "name": "MissingCollectionMint", + "msg": "Missing collection account" + }, + { + "code": 186, + "name": "MissingCollectionMasterEdition", + "msg": "Missing collection master edition account" + }, + { + "code": 187, + "name": "InvalidTokenRecord", + "msg": "Invalid token record account" + }, + { + "code": 188, + "name": "InvalidCloseAuthority", + "msg": "The close authority needs to be revoked by the Utility Delegate" + }, + { + "code": 189, + "name": "InvalidInstruction", + "msg": "Invalid or removed instruction" + }, + { + "code": 190, + "name": "MissingDelegateRecord", + "msg": "Missing delegate record" + }, + { + "code": 191, + "name": "InvalidFeeAccount", + "msg": "" + }, + { + "code": 192, + "name": "InvalidMetadataFlags", + "msg": "" } ], "metadata": { diff --git a/lib/src/main/java/com/metaplex/lib/modules/nfts/Authorization.kt b/lib/src/main/java/com/metaplex/lib/modules/nfts/Authorization.kt index c766ede..9d06b32 100644 --- a/lib/src/main/java/com/metaplex/lib/modules/nfts/Authorization.kt +++ b/lib/src/main/java/com/metaplex/lib/modules/nfts/Authorization.kt @@ -138,7 +138,7 @@ fun parseTokenMetadataAuthorization( signers = listOf(authority.delegate), data = ParsedTokenMetadataAuthorizationData( authorizationData = authorizationDetails?.data, - authorityType = AuthorityType.Delegate + authorityType = AuthorityType.MetadataDelegate ) ) } @@ -170,7 +170,7 @@ fun parseTokenMetadataAuthorization( signers = listOf(authority.delegate), data = ParsedTokenMetadataAuthorizationData( authorizationData = authorizationDetails?.data, - authorityType = AuthorityType.Delegate + authorityType = AuthorityType.TokenDelegate ) ) } diff --git a/lib/src/main/java/com/metaplex/lib/modules/nfts/DelegateType.kt b/lib/src/main/java/com/metaplex/lib/modules/nfts/DelegateType.kt index 7ec55fe..28ae7d2 100644 --- a/lib/src/main/java/com/metaplex/lib/modules/nfts/DelegateType.kt +++ b/lib/src/main/java/com/metaplex/lib/modules/nfts/DelegateType.kt @@ -3,10 +3,12 @@ package com.metaplex.lib.modules.nfts import com.metaplex.lib.experimental.jen.tokenmetadata.DelegateArgs import com.metaplex.lib.experimental.jen.tokenmetadata.MetadataDelegateRole import com.metaplex.lib.experimental.jen.tokenmetadata.TokenDelegateRole +import com.solana.core.PublicKey enum class TokenDelegateType{ StandardV1, TransferV1, + LockedTransferV1, SaleV1, UtilityV1, StakingV1 @@ -14,12 +16,14 @@ enum class TokenDelegateType{ enum class MetadataDelegateType { CollectionV1, - UpdateV1 + DataV1, + ProgrammableConfigV1 } val tokenDelegateRoleMap = mapOf( TokenDelegateType.StandardV1 to TokenDelegateRole.Standard, TokenDelegateType.TransferV1 to TokenDelegateRole.Transfer, + TokenDelegateType.LockedTransferV1 to TokenDelegateRole.LockedTransfer, TokenDelegateType.SaleV1 to TokenDelegateRole.Sale, TokenDelegateType.UtilityV1 to TokenDelegateRole.Utility, TokenDelegateType.StakingV1 to TokenDelegateRole.Staking, @@ -27,20 +31,26 @@ val tokenDelegateRoleMap = mapOf( val metadataDelegateRoleMap = mapOf( MetadataDelegateType.CollectionV1 to MetadataDelegateRole.Collection, - MetadataDelegateType.UpdateV1 to MetadataDelegateRole.Update, -) + MetadataDelegateType.DataV1 to MetadataDelegateRole.Data, + MetadataDelegateType.ProgrammableConfigV1 to MetadataDelegateRole.ProgrammableConfig, + ) val metadataDelegateSeedMap = mapOf( - MetadataDelegateRole.Authority to "authority_delegate", + MetadataDelegateRole.AuthorityItem to "authority_item_delegate", MetadataDelegateRole.Collection to "collection_delegate", MetadataDelegateRole.Use to "use_delegate", - MetadataDelegateRole.Update to "update_delegate", -) + MetadataDelegateRole.Data to "data_delegate", + MetadataDelegateRole.ProgrammableConfig to "programmable_config_delegate", + MetadataDelegateRole.DataItem to "data_item_delegate", + MetadataDelegateRole.CollectionItem to "collection_item_delegate", + MetadataDelegateRole.ProgrammableConfigItem to "prog_config_item_delegate", + ) val metadataDelegateTypeCustomDataMap = mapOf( MetadataDelegateType.CollectionV1 to false, - MetadataDelegateType.UpdateV1 to false, -) + MetadataDelegateType.DataV1 to false, + MetadataDelegateType.ProgrammableConfigV1 to false, + ) val tokenDelegateTypeCustomDataMap = mapOf( TokenDelegateType.StandardV1 to true, @@ -48,7 +58,9 @@ val tokenDelegateTypeCustomDataMap = mapOf( TokenDelegateType.SaleV1 to true, TokenDelegateType.UtilityV1 to true, TokenDelegateType.StakingV1 to true, -) + TokenDelegateType.LockedTransferV1 to true, + + ) fun getTokenDelegateRole(type: TokenDelegateType): TokenDelegateRole = tokenDelegateRoleMap[type] ?: throw Exception("UnreachableCaseError") @@ -68,6 +80,7 @@ fun getDefaultDelegateArgs(type: TokenDelegateType): DelegateArgs { TokenDelegateType.SaleV1 -> DelegateArgs.SaleV1(1u, null) TokenDelegateType.UtilityV1 -> DelegateArgs.UtilityV1(1u, null) TokenDelegateType.StakingV1 -> DelegateArgs.StakingV1(1u, null) + TokenDelegateType.LockedTransferV1 -> throw Exception("Not implemented") } } diff --git a/lib/src/test/java/com/metaplex/lib/MetaplexTests.kt b/lib/src/test/java/com/metaplex/lib/MetaplexTests.kt index 45a90d5..c5a5c4d 100644 --- a/lib/src/test/java/com/metaplex/lib/MetaplexTests.kt +++ b/lib/src/test/java/com/metaplex/lib/MetaplexTests.kt @@ -2,6 +2,7 @@ package com.metaplex.lib import com.metaplex.lib.drivers.indenty.ReadOnlyIdentityDriver import com.metaplex.lib.drivers.storage.MemoryStorageDriver +import com.metaplex.lib.experimental.jen.jenerateTokenMetadata import com.solana.core.HotAccount import org.junit.Assert import org.junit.Test