Skip to content

Commit

Permalink
Update token metadata and rename mpl-essentials to mpl-toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva committed Jun 6, 2023
1 parent 50efd76 commit 5c8900c
Show file tree
Hide file tree
Showing 45 changed files with 239 additions and 48 deletions.
2 changes: 1 addition & 1 deletion clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@metaplex-foundation/umi": "0.6 - 0.7"
},
"dependencies": {
"@metaplex-foundation/mpl-essentials": "^0.5.8"
"@metaplex-foundation/mpl-toolbox": "^0.6.1"
},
"devDependencies": {
"@ava/typescript": "^3.0.1",
Expand Down
10 changes: 5 additions & 5 deletions clients/js/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clients/js/src/digitalAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
FetchTokenAmountFilter,
FetchTokenStrategy,
Mint,
} from '@metaplex-foundation/mpl-essentials';
} from '@metaplex-foundation/mpl-toolbox';
import {
assertAccountExists,
chunk,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/digitalAssetWithToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
findAssociatedTokenPda,
findLargestTokensByMint,
Token,
} from '@metaplex-foundation/mpl-essentials';
} from '@metaplex-foundation/mpl-toolbox';
import { deserializeDigitalAsset, DigitalAsset } from './digitalAsset';
import {
deserializeTokenRecord,
Expand Down
39 changes: 39 additions & 0 deletions clients/js/src/generated/errors/mplTokenMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2866,6 +2866,45 @@ export class InvalidInstructionError extends ProgramError {
codeToErrorMap.set(0xbd, InvalidInstructionError);
nameToErrorMap.set('InvalidInstruction', InvalidInstructionError);

/** MissingDelegateRecord: Missing delegate record */
export class MissingDelegateRecordError extends ProgramError {
readonly name: string = 'MissingDelegateRecord';

readonly code: number = 0xbe; // 190

constructor(program: Program, cause?: Error) {
super('Missing delegate record', program, cause);
}
}
codeToErrorMap.set(0xbe, MissingDelegateRecordError);
nameToErrorMap.set('MissingDelegateRecord', MissingDelegateRecordError);

/** InvalidFeeAccount */
export class InvalidFeeAccountError extends ProgramError {
readonly name: string = 'InvalidFeeAccount';

readonly code: number = 0xbf; // 191

constructor(program: Program, cause?: Error) {
super('', program, cause);
}
}
codeToErrorMap.set(0xbf, InvalidFeeAccountError);
nameToErrorMap.set('InvalidFeeAccount', InvalidFeeAccountError);

/** InvalidMetadataFlags */
export class InvalidMetadataFlagsError extends ProgramError {
readonly name: string = 'InvalidMetadataFlags';

readonly code: number = 0xc0; // 192

constructor(program: Program, cause?: Error) {
super('', program, cause);
}
}
codeToErrorMap.set(0xc0, InvalidMetadataFlagsError);
nameToErrorMap.set('InvalidMetadataFlags', InvalidMetadataFlagsError);

/**
* Attempts to resolve a custom program error from the provided error code.
* @category Errors
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/burnV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
96 changes: 96 additions & 0 deletions clients/js/src/generated/instructions/collect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
*
* @see https://github.com/metaplex-foundation/kinobi
*/

import {
AccountMeta,
Context,
PublicKey,
Serializer,
Signer,
TransactionBuilder,
mapSerializer,
transactionBuilder,
} from '@metaplex-foundation/umi';
import { addObjectProperty, isWritable } from '../shared';

// Accounts.
export type CollectInstructionAccounts = {
/** Authority to collect fees */
authority?: Signer;
/** PDA to retrieve fees from */
pdaAccount: PublicKey;
};

// Data.
export type CollectInstructionData = { discriminator: number };

export type CollectInstructionDataArgs = {};

export function getCollectInstructionDataSerializer(
context: Pick<Context, 'serializer'>
): Serializer<CollectInstructionDataArgs, CollectInstructionData> {
const s = context.serializer;
return mapSerializer<CollectInstructionDataArgs, any, CollectInstructionData>(
s.struct<CollectInstructionData>([['discriminator', s.u8()]], {
description: 'CollectInstructionData',
}),
(value) => ({ ...value, discriminator: 54 })
) as Serializer<CollectInstructionDataArgs, CollectInstructionData>;
}

// Instruction.
export function collect(
context: Pick<Context, 'serializer' | 'programs' | 'identity'>,
input: CollectInstructionAccounts
): TransactionBuilder {
const signers: Signer[] = [];
const keys: AccountMeta[] = [];

// Program ID.
const programId = {
...context.programs.getPublicKey(
'mplTokenMetadata',
'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'
),
isWritable: false,
};

// Resolved inputs.
const resolvingAccounts = {};
addObjectProperty(
resolvingAccounts,
'authority',
input.authority ?? context.identity
);
const resolvedAccounts = { ...input, ...resolvingAccounts };

// Authority.
signers.push(resolvedAccounts.authority);
keys.push({
pubkey: resolvedAccounts.authority.publicKey,
isSigner: true,
isWritable: isWritable(resolvedAccounts.authority, false),
});

// Pda Account.
keys.push({
pubkey: resolvedAccounts.pdaAccount,
isSigner: false,
isWritable: isWritable(resolvedAccounts.pdaAccount, false),
});

// Data.
const data = getCollectInstructionDataSerializer(context).serialize({});

// Bytes Created On Chain.
const bytesCreatedOnChain = 0;

return transactionBuilder([
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/delegateSaleV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/delegateStakingV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/delegateUtilityV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
1 change: 1 addition & 0 deletions clients/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from './burnEditionNft';
export * from './burnNft';
export * from './burnV1';
export * from './closeEscrowAccount';
export * from './collect';
export * from './convertMasterEditionV1ToV2';
export * from './createEscrowAccount';
export * from './createMasterEditionV3';
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/lockV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/mintV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/revokeMigrationV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/revokeSaleV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/revokeStakingV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/revokeStandardV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/revokeTransferV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/revokeUtilityV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/transferV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/unlockV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-essentials';
import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
import {
AccountMeta,
Context,
Expand Down
11 changes: 11 additions & 0 deletions clients/js/src/generated/instructions/verifyCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export type VerifyCollectionInstructionAccounts = {
collection: PublicKey;
/** MasterEdition2 Account of the Collection Token */
collectionMasterEditionAccount: PublicKey;
/** Collection Authority Record PDA */
collectionAuthorityRecord?: PublicKey;
};

// Data.
Expand Down Expand Up @@ -130,6 +132,15 @@ export function verifyCollection(
),
});

// Collection Authority Record (optional).
if (resolvedAccounts.collectionAuthorityRecord) {
keys.push({
pubkey: resolvedAccounts.collectionAuthorityRecord,
isSigner: false,
isWritable: isWritable(resolvedAccounts.collectionAuthorityRecord, false),
});
}

// Data.
const data = getVerifyCollectionInstructionDataSerializer(context).serialize(
{}
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/hooked/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
samePublicKey,
some,
} from '@metaplex-foundation/umi';
import { getMintSize } from '@metaplex-foundation/mpl-essentials';
import { getMintSize } from '@metaplex-foundation/mpl-toolbox';
import { isNonFungible, isProgrammable } from '../digitalAsset';
import {
CollectionDetailsArgs,
Expand Down
Loading

0 comments on commit 5c8900c

Please sign in to comment.