@metaplex-foundation/mpl-candy-machine
Advanced tools
Comparing version 6.0.0-alpha.6 to 6.0.0-alpha.7
@@ -0,1 +1,2 @@ | ||
import { TokenStandard } from '@metaplex-foundation/mpl-token-metadata'; | ||
import { PublicKey } from '@metaplex-foundation/umi'; | ||
@@ -7,3 +8,4 @@ import { NftBurn, NftBurnArgs } from '../generated'; | ||
mint: PublicKey; | ||
tokenStandard: TokenStandard; | ||
tokenAccount?: PublicKey; | ||
}; |
@@ -22,12 +22,17 @@ "use strict"; | ||
}); | ||
return { | ||
data: new Uint8Array(), | ||
remainingAccounts: [ | ||
{ publicKey: nftTokenAccount, isWritable: true }, | ||
{ publicKey: nftMetadata, isWritable: true }, | ||
{ publicKey: nftMasterEdition, isWritable: true }, | ||
{ publicKey: args.mint, isWritable: true }, | ||
{ publicKey: collectionMetadata, isWritable: true }, | ||
], | ||
}; | ||
const remainingAccounts = [ | ||
{ publicKey: nftTokenAccount, isWritable: true }, | ||
{ publicKey: nftMetadata, isWritable: true }, | ||
{ publicKey: nftMasterEdition, isWritable: true }, | ||
{ publicKey: args.mint, isWritable: true }, | ||
{ publicKey: collectionMetadata, isWritable: true }, | ||
]; | ||
if ((0, mpl_token_metadata_1.isProgrammable)(args.tokenStandard)) { | ||
const nftTokenRecord = (0, mpl_token_metadata_1.findTokenRecordPda)(context, { | ||
mint: args.mint, | ||
token: nftTokenAccount, | ||
}); | ||
remainingAccounts.push({ publicKey: nftTokenRecord, isWritable: true }); | ||
} | ||
return { data: new Uint8Array(), remainingAccounts }; | ||
}, | ||
@@ -34,0 +39,0 @@ routeParser: guards_1.noopParser, |
@@ -0,1 +1,2 @@ | ||
import { TokenStandard } from '@metaplex-foundation/mpl-token-metadata'; | ||
import { PublicKey } from '@metaplex-foundation/umi'; | ||
@@ -7,3 +8,5 @@ import { NftPayment, NftPaymentArgs } from '../generated'; | ||
mint: PublicKey; | ||
tokenStandard: TokenStandard; | ||
ruleSet?: PublicKey; | ||
tokenAccount?: PublicKey; | ||
}; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const mpl_token_metadata_1 = require("@metaplex-foundation/mpl-token-metadata"); | ||
const programs_1 = require("../programs"); | ||
const generated_1 = require("../generated"); | ||
@@ -23,16 +24,39 @@ const guards_1 = require("../guards"); | ||
}); | ||
return { | ||
data: new Uint8Array(), | ||
remainingAccounts: [ | ||
{ publicKey: nftTokenAccount, isWritable: true }, | ||
{ publicKey: nftMetadata, isWritable: true }, | ||
{ publicKey: args.mint, isWritable: false }, | ||
{ publicKey: args.destination, isWritable: false }, | ||
{ publicKey: destinationAta, isWritable: true }, | ||
{ | ||
publicKey: (0, mpl_essentials_1.getSplAssociatedTokenProgramId)(context), | ||
isWritable: false, | ||
}, | ||
], | ||
}; | ||
const remainingAccounts = [ | ||
{ publicKey: nftTokenAccount, isWritable: true }, | ||
{ publicKey: nftMetadata, isWritable: true }, | ||
{ publicKey: args.mint, isWritable: false }, | ||
{ publicKey: args.destination, isWritable: false }, | ||
{ publicKey: destinationAta, isWritable: true }, | ||
{ | ||
publicKey: (0, mpl_essentials_1.getSplAssociatedTokenProgramId)(context), | ||
isWritable: false, | ||
}, | ||
]; | ||
if ((0, mpl_token_metadata_1.isProgrammable)(args.tokenStandard)) { | ||
const nftMasterEdition = (0, mpl_token_metadata_1.findMasterEditionPda)(context, { | ||
mint: args.mint, | ||
}); | ||
const ownerTokenRecord = (0, mpl_token_metadata_1.findTokenRecordPda)(context, { | ||
mint: args.mint, | ||
token: nftTokenAccount, | ||
}); | ||
const destinationTokenRecord = (0, mpl_token_metadata_1.findTokenRecordPda)(context, { | ||
mint: args.mint, | ||
token: destinationAta, | ||
}); | ||
const tokenAuthRules = (0, programs_1.getMplTokenAuthRulesProgramId)(context); | ||
remainingAccounts.push(...[ | ||
{ publicKey: nftMasterEdition, isWritable: false }, | ||
{ publicKey: ownerTokenRecord, isWritable: true }, | ||
{ publicKey: destinationTokenRecord, isWritable: true }, | ||
]); | ||
if (args.ruleSet) { | ||
remainingAccounts.push(...[ | ||
{ publicKey: tokenAuthRules, isWritable: false }, | ||
{ publicKey: args.ruleSet, isWritable: false }, | ||
]); | ||
} | ||
} | ||
return { data: new Uint8Array(), remainingAccounts }; | ||
}, | ||
@@ -39,0 +63,0 @@ routeParser: guards_1.noopParser, |
@@ -257,3 +257,8 @@ import { Program, ProgramError } from '@metaplex-foundation/umi'; | ||
} | ||
export declare class CgInvalidAccountVersionError extends ProgramError { | ||
readonly name: string; | ||
readonly code: number; | ||
constructor(program: Program, cause?: Error); | ||
} | ||
export declare function getMplCandyGuardErrorFromCode(code: number, program: Program, cause?: Error): ProgramError | null; | ||
export declare function getMplCandyGuardErrorFromName(name: string, program: Program, cause?: Error): ProgramError | null; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CgInvalidMintAuthorityError = exports.CgAllocationGuardNotEnabledError = exports.CgAllocationLimitReachedError = exports.CgAllocationNotInitializedError = exports.CgExceededProgramListSizeError = exports.CgUnauthorizedProgramFoundError = exports.CgDuplicatedMintLimitIdError = exports.CgDuplicatedGroupLabelError = exports.CgUnlockNotEnabledError = exports.CgThawNotEnabledError = exports.CgExceededMaximumFreezePeriodError = exports.CgFreezeEscrowAlreadyExistsError = exports.CgMissingFreezePeriodError = exports.CgFreezeNotInitializedError = exports.CgFreezeGuardNotEnabledError = exports.CgMissingFreezeInstructionError = exports.CgAddressNotAuthorizedError = exports.CgMaximumRedeemedAmountError = exports.CgMissingNftError = exports.CgInvalidNftCollectionError = exports.CgAllowedMintLimitReachedError = exports.CgAllowedListNotEnabledError = exports.CgMissingAllowedListProofError = exports.CgAddressNotFoundInAllowedListError = exports.CgInvalidMintTimeError = exports.CgAfterEndDateError = exports.CgGatewayTokenInvalidError = exports.CgMissingRequiredSignatureError = exports.CgTokenTransferFailedError = exports.CgNotEnoughTokensError = exports.CgTokenBurnFailedError = exports.CgNotEnoughSOLError = exports.CgMintNotLiveError = exports.CgMintNotLastTransactionError = exports.CgCollectionUpdateAuthorityKeyMismatchError = exports.CgMissingCollectionAccountsError = exports.CgCollectionKeyMismatchError = exports.CgInstructionNotFoundError = exports.CgCandyMachineEmptyError = exports.CgExceededLengthError = exports.CgGroupNotFoundError = exports.CgRequiredGroupLabelNotFoundError = exports.CgNumericalOverflowErrorError = exports.CgMissingRemainingAccountError = exports.CgUninitializedError = exports.CgIncorrectOwnerError = exports.CgDataIncrementLimitExceededError = exports.CgPublicKeyMismatchError = exports.CgDeserializationErrorError = exports.CgInvalidAccountSizeError = void 0; | ||
exports.getMplCandyGuardErrorFromName = exports.getMplCandyGuardErrorFromCode = exports.CgInstructionBuilderFailedError = void 0; | ||
exports.getMplCandyGuardErrorFromName = exports.getMplCandyGuardErrorFromCode = exports.CgInvalidAccountVersionError = exports.CgInstructionBuilderFailedError = void 0; | ||
const umi_1 = require("@metaplex-foundation/umi"); | ||
@@ -518,2 +518,12 @@ const codeToErrorMap = new Map(); | ||
nameToErrorMap.set('InstructionBuilderFailed', CgInstructionBuilderFailedError); | ||
class CgInvalidAccountVersionError extends umi_1.ProgramError { | ||
constructor(program, cause) { | ||
super('Invalid account version', program, cause); | ||
this.name = 'InvalidAccountVersion'; | ||
this.code = 0x17a3; | ||
} | ||
} | ||
exports.CgInvalidAccountVersionError = CgInvalidAccountVersionError; | ||
codeToErrorMap.set(0x17a3, CgInvalidAccountVersionError); | ||
nameToErrorMap.set('InvalidAccountVersion', CgInvalidAccountVersionError); | ||
function getMplCandyGuardErrorFromCode(code, program, cause) { | ||
@@ -520,0 +530,0 @@ const constructor = codeToErrorMap.get(code); |
@@ -15,3 +15,3 @@ import { Context, PublicKey, Serializer, Signer, TransactionBuilder } from '@metaplex-foundation/umi'; | ||
newCollectionMasterEdition?: PublicKey; | ||
newCollectionDelegateRecord: PublicKey; | ||
newCollectionDelegateRecord?: PublicKey; | ||
tokenMetadataProgram?: PublicKey; | ||
@@ -18,0 +18,0 @@ systemProgram?: PublicKey; |
@@ -45,3 +45,9 @@ "use strict"; | ||
}); | ||
const newCollectionDelegateRecordAccount = input.newCollectionDelegateRecord; | ||
const newCollectionDelegateRecordAccount = input.newCollectionDelegateRecord ?? | ||
(0, mpl_token_metadata_1.findMetadataDelegateRecordPda)(context, { | ||
mint: (0, umi_1.publicKey)(newCollectionMintAccount), | ||
delegateRole: mpl_token_metadata_1.MetadataDelegateRole.Collection, | ||
updateAuthority: (0, umi_1.publicKey)(newCollectionUpdateAuthorityAccount), | ||
delegate: (0, umi_1.publicKey)(authorityPdaAccount), | ||
}); | ||
const tokenMetadataProgramAccount = input.tokenMetadataProgram ?? { | ||
@@ -79,3 +85,3 @@ ...context.programs.getPublicKey('mplTokenMetadata', 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'), | ||
isSigner: false, | ||
isWritable: (0, umi_1.checkForIsWritableOverride)(authorityPdaAccount, false), | ||
isWritable: (0, umi_1.checkForIsWritableOverride)(authorityPdaAccount, true), | ||
}); | ||
@@ -101,3 +107,3 @@ signers.push(payerAccount); | ||
isSigner: false, | ||
isWritable: (0, umi_1.checkForIsWritableOverride)(collectionMetadataAccount, false), | ||
isWritable: (0, umi_1.checkForIsWritableOverride)(collectionMetadataAccount, true), | ||
}); | ||
@@ -123,3 +129,3 @@ keys.push({ | ||
isSigner: false, | ||
isWritable: (0, umi_1.checkForIsWritableOverride)(newCollectionMetadataAccount, false), | ||
isWritable: (0, umi_1.checkForIsWritableOverride)(newCollectionMetadataAccount, true), | ||
}); | ||
@@ -126,0 +132,0 @@ keys.push({ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mint = void 0; | ||
const mpl_token_metadata_1 = require("@metaplex-foundation/mpl-token-metadata"); | ||
const umi_1 = require("@metaplex-foundation/umi"); | ||
@@ -29,2 +30,4 @@ const mint_1 = require("./generated/instructions/mint"); | ||
ix.signers.push(...signers); | ||
ix.bytesCreatedOnChain = | ||
(0, mpl_token_metadata_1.getMetadataSize)() + (0, mpl_token_metadata_1.getMasterEditionSize)() + 2 * umi_1.ACCOUNT_HEADER_SIZE; | ||
return (0, umi_1.transactionBuilder)([ix]); | ||
@@ -31,0 +34,0 @@ } |
@@ -23,3 +23,4 @@ "use strict"; | ||
const prefix = context.serializer.u32().serialize(data.length); | ||
const defaultTokenRecord = (0, mpl_token_metadata_1.isProgrammable)(input.tokenStandard ?? mpl_token_metadata_1.TokenStandard.NonFungible) | ||
const tokenStandard = input.tokenStandard ?? mpl_token_metadata_1.TokenStandard.NonFungible; | ||
const defaultTokenRecord = (0, mpl_token_metadata_1.isProgrammable)(tokenStandard) | ||
? (0, mpl_token_metadata_1.findTokenRecordPda)(context, { | ||
@@ -42,2 +43,11 @@ mint: (0, umi_1.publicKey)(input.nftMint), | ||
ix.signers.push(...signers); | ||
ix.bytesCreatedOnChain = | ||
(0, mpl_token_metadata_1.getMetadataSize)() + (0, mpl_token_metadata_1.getMasterEditionSize)() + 2 * umi_1.ACCOUNT_HEADER_SIZE; | ||
if ((0, umi_1.isSigner)(input.nftMint)) { | ||
ix.bytesCreatedOnChain += | ||
(0, mpl_essentials_1.getMintSize)() + (0, mpl_essentials_1.getTokenSize)() + 2 * umi_1.ACCOUNT_HEADER_SIZE; | ||
} | ||
if ((0, mpl_token_metadata_1.isProgrammable)(tokenStandard)) { | ||
ix.bytesCreatedOnChain += (0, mpl_token_metadata_1.getTokenRecordSize)() + umi_1.ACCOUNT_HEADER_SIZE; | ||
} | ||
return (0, umi_1.transactionBuilder)([ix]); | ||
@@ -44,0 +54,0 @@ } |
{ | ||
"name": "@metaplex-foundation/mpl-candy-machine", | ||
"version": "6.0.0-alpha.6", | ||
"version": "6.0.0-alpha.7", | ||
"description": "Client library for Candy Machine related programs", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
550471
7665