Skip to content

Commit

Permalink
Minor tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus authored and danenbm committed Feb 19, 2024
1 parent 9d2bc5e commit 36a8b8e
Show file tree
Hide file tree
Showing 30 changed files with 513 additions and 83 deletions.
23 changes: 23 additions & 0 deletions Cargo.lock

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

5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[workspace]
resolver = "2"
members = [
"clients/rust",
"programs/mpl-asset"
]
members = ["clients/rust", "programs/mpl-asset"]
29 changes: 29 additions & 0 deletions clients/js/src/generated/errors/mplAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,35 @@ export class MissingCompressionProofError extends ProgramError {
codeToErrorMap.set(0xb, MissingCompressionProofError);
nameToErrorMap.set('MissingCompressionProof', MissingCompressionProofError);

/** CannotMigrateMasterWithSupply: Cannot migrate a master edition used for prints */
export class CannotMigrateMasterWithSupplyError extends ProgramError {
readonly name: string = 'CannotMigrateMasterWithSupply';

readonly code: number = 0xc; // 12

constructor(program: Program, cause?: Error) {
super('Cannot migrate a master edition used for prints', program, cause);
}
}
codeToErrorMap.set(0xc, CannotMigrateMasterWithSupplyError);
nameToErrorMap.set(
'CannotMigrateMasterWithSupply',
CannotMigrateMasterWithSupplyError
);

/** CannotMigratePrints: Cannot migrate a print edition */
export class CannotMigratePrintsError extends ProgramError {
readonly name: string = 'CannotMigratePrints';

readonly code: number = 0xd; // 13

constructor(program: Program, cause?: Error) {
super('Cannot migrate a print edition', program, cause);
}
}
codeToErrorMap.set(0xd, CannotMigratePrintsError);
nameToErrorMap.set('CannotMigratePrints', CannotMigratePrintsError);

/**
* 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/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export type MigrateInstructionAccounts = {
/** Metadata (pda of ['metadata', program id, mint id]) */
metadata: PublicKey | Pda;
/** Edition of token asset */
edition?: PublicKey | Pda;
edition: PublicKey | Pda;
/** Owner token record account */
ownerTokenRecord?: PublicKey | Pda;
/** SPL Token Program */
Expand Down
23 changes: 23 additions & 0 deletions clients/js/src/generated/types/assetSigner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* 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 { Serializer, struct } from '@metaplex-foundation/umi/serializers';

export type AssetSigner = {};

export type AssetSignerArgs = AssetSigner;

export function getAssetSignerSerializer(): Serializer<
AssetSignerArgs,
AssetSigner
> {
return struct<AssetSigner>([], { description: 'AssetSigner' }) as Serializer<
AssetSignerArgs,
AssetSigner
>;
}
3 changes: 3 additions & 0 deletions clients/js/src/generated/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

export * from './assetSigner';
export * from './authority';
export * from './collection';
export * from './compressionProof';
Expand All @@ -15,9 +16,11 @@ export * from './delegate';
export * from './externalPluginRecord';
export * from './extraAccounts';
export * from './key';
export * from './legacyMetadata';
export * from './migrationLevel';
export * from './plugin';
export * from './pluginType';
export * from './registryData';
export * from './registryRecord';
export * from './royalties';
export * from './ruleSet';
27 changes: 27 additions & 0 deletions clients/js/src/generated/types/legacyMetadata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* 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 { PublicKey } from '@metaplex-foundation/umi';
import {
Serializer,
publicKey as publicKeySerializer,
struct,
} from '@metaplex-foundation/umi/serializers';

export type LegacyMetadata = { mint: PublicKey };

export type LegacyMetadataArgs = LegacyMetadata;

export function getLegacyMetadataSerializer(): Serializer<
LegacyMetadataArgs,
LegacyMetadata
> {
return struct<LegacyMetadata>([['mint', publicKeySerializer()]], {
description: 'LegacyMetadata',
}) as Serializer<LegacyMetadataArgs, LegacyMetadata>;
}
34 changes: 32 additions & 2 deletions clients/js/src/generated/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,33 @@ import {
unit,
} from '@metaplex-foundation/umi/serializers';
import {
AssetSigner,
AssetSignerArgs,
Delegate,
DelegateArgs,
LegacyMetadata,
LegacyMetadataArgs,
Royalties,
RoyaltiesArgs,
getAssetSignerSerializer,
getDelegateSerializer,
getLegacyMetadataSerializer,
getRoyaltiesSerializer,
} from '.';

export type Plugin =
| { __kind: 'Reserved' }
| { __kind: 'Royalties'; fields: [Royalties] }
| { __kind: 'Delegate'; fields: [Delegate] };
| { __kind: 'Delegate'; fields: [Delegate] }
| { __kind: 'LegacyMetadata'; fields: [LegacyMetadata] }
| { __kind: 'AssetSigner'; fields: [AssetSigner] };

export type PluginArgs =
| { __kind: 'Reserved' }
| { __kind: 'Royalties'; fields: [RoyaltiesArgs] }
| { __kind: 'Delegate'; fields: [DelegateArgs] };
| { __kind: 'Delegate'; fields: [DelegateArgs] }
| { __kind: 'LegacyMetadata'; fields: [LegacyMetadataArgs] }
| { __kind: 'AssetSigner'; fields: [AssetSignerArgs] };

export function getPluginSerializer(): Serializer<PluginArgs, Plugin> {
return dataEnum<Plugin>(
Expand All @@ -50,6 +60,18 @@ export function getPluginSerializer(): Serializer<PluginArgs, Plugin> {
['fields', tuple([getDelegateSerializer()])],
]),
],
[
'LegacyMetadata',
struct<GetDataEnumKindContent<Plugin, 'LegacyMetadata'>>([
['fields', tuple([getLegacyMetadataSerializer()])],
]),
],
[
'AssetSigner',
struct<GetDataEnumKindContent<Plugin, 'AssetSigner'>>([
['fields', tuple([getAssetSignerSerializer()])],
]),
],
],
{ description: 'Plugin' }
) as Serializer<PluginArgs, Plugin>;
Expand All @@ -67,6 +89,14 @@ export function plugin(
kind: 'Delegate',
data: GetDataEnumKindContent<PluginArgs, 'Delegate'>['fields']
): GetDataEnumKind<PluginArgs, 'Delegate'>;
export function plugin(
kind: 'LegacyMetadata',
data: GetDataEnumKindContent<PluginArgs, 'LegacyMetadata'>['fields']
): GetDataEnumKind<PluginArgs, 'LegacyMetadata'>;
export function plugin(
kind: 'AssetSigner',
data: GetDataEnumKindContent<PluginArgs, 'AssetSigner'>['fields']
): GetDataEnumKind<PluginArgs, 'AssetSigner'>;
export function plugin<K extends PluginArgs['__kind']>(
kind: K,
data?: any
Expand Down
2 changes: 2 additions & 0 deletions clients/js/src/generated/types/pluginType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export enum PluginType {
Reserved,
Royalties,
Delegate,
LegacyMetadata,
AssetSigner,
}

export type PluginTypeArgs = PluginType;
Expand Down
23 changes: 14 additions & 9 deletions clients/js/src/generated/types/royalties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,39 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

import { PublicKey } from '@metaplex-foundation/umi';
import {
Serializer,
array,
publicKey as publicKeySerializer,
struct,
u16,
} from '@metaplex-foundation/umi/serializers';
import { Creator, CreatorArgs, getCreatorSerializer } from '.';
import {
Creator,
CreatorArgs,
RuleSet,
RuleSetArgs,
getCreatorSerializer,
getRuleSetSerializer,
} from '.';

export type Royalties = {
creators: Array<Creator>;
authRules: PublicKey;
sellerFeeBasisPoints: number;
creators: Array<Creator>;
ruleSet: RuleSet;
};

export type RoyaltiesArgs = {
creators: Array<CreatorArgs>;
authRules: PublicKey;
sellerFeeBasisPoints: number;
creators: Array<CreatorArgs>;
ruleSet: RuleSetArgs;
};

export function getRoyaltiesSerializer(): Serializer<RoyaltiesArgs, Royalties> {
return struct<Royalties>(
[
['creators', array(getCreatorSerializer())],
['authRules', publicKeySerializer()],
['sellerFeeBasisPoints', u16()],
['creators', array(getCreatorSerializer())],
['ruleSet', getRuleSetSerializer()],
],
{ description: 'Royalties' }
) as Serializer<RoyaltiesArgs, Royalties>;
Expand Down
69 changes: 69 additions & 0 deletions clients/js/src/generated/types/ruleSet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* 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 { PublicKey } from '@metaplex-foundation/umi';
import {
GetDataEnumKind,
GetDataEnumKindContent,
Serializer,
array,
dataEnum,
publicKey as publicKeySerializer,
struct,
tuple,
} from '@metaplex-foundation/umi/serializers';

export type RuleSet =
| { __kind: 'ProgramAllowList'; fields: [Array<PublicKey>] }
| { __kind: 'ProgramDenyList'; fields: [Array<PublicKey>] };

export type RuleSetArgs = RuleSet;

export function getRuleSetSerializer(): Serializer<RuleSetArgs, RuleSet> {
return dataEnum<RuleSet>(
[
[
'ProgramAllowList',
struct<GetDataEnumKindContent<RuleSet, 'ProgramAllowList'>>([
['fields', tuple([array(publicKeySerializer())])],
]),
],
[
'ProgramDenyList',
struct<GetDataEnumKindContent<RuleSet, 'ProgramDenyList'>>([
['fields', tuple([array(publicKeySerializer())])],
]),
],
],
{ description: 'RuleSet' }
) as Serializer<RuleSetArgs, RuleSet>;
}

// Data Enum Helpers.
export function ruleSet(
kind: 'ProgramAllowList',
data: GetDataEnumKindContent<RuleSetArgs, 'ProgramAllowList'>['fields']
): GetDataEnumKind<RuleSetArgs, 'ProgramAllowList'>;
export function ruleSet(
kind: 'ProgramDenyList',
data: GetDataEnumKindContent<RuleSetArgs, 'ProgramDenyList'>['fields']
): GetDataEnumKind<RuleSetArgs, 'ProgramDenyList'>;
export function ruleSet<K extends RuleSetArgs['__kind']>(
kind: K,
data?: any
): Extract<RuleSetArgs, { __kind: K }> {
return Array.isArray(data)
? { __kind: kind, fields: data }
: { __kind: kind, ...(data ?? {}) };
}
export function isRuleSet<K extends RuleSet['__kind']>(
kind: K,
value: RuleSet
): value is RuleSet & { __kind: K } {
return value.__kind === kind;
}
6 changes: 6 additions & 0 deletions clients/rust/src/generated/errors/mpl_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ pub enum MplAssetError {
/// 11 (0xB) - Missing compression proof
#[error("Missing compression proof")]
MissingCompressionProof,
/// 12 (0xC) - Cannot migrate a master edition used for prints
#[error("Cannot migrate a master edition used for prints")]
CannotMigrateMasterWithSupply,
/// 13 (0xD) - Cannot migrate a print edition
#[error("Cannot migrate a print edition")]
CannotMigratePrints,
}

impl solana_program::program_error::PrintProgramError for MplAssetError {
Expand Down
Loading

0 comments on commit 36a8b8e

Please sign in to comment.