Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Cargo.lock

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/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@
}
}
},
"packageManager": "pnpm@8.2.0"
"packageManager": "pnpm@8.9.0"
}
160 changes: 160 additions & 0 deletions clients/js/src/generated/accounts/groupV1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/**
* 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 {
Account,
Context,
Pda,
PublicKey,
RpcAccount,
RpcGetAccountOptions,
RpcGetAccountsOptions,
assertAccountExists,
deserializeAccount,
gpaBuilder,
publicKey as toPublicKey,
} from '@metaplex-foundation/umi';
import {
Serializer,
array,
publicKey as publicKeySerializer,
string,
struct,
} from '@metaplex-foundation/umi/serializers';
import { Key, KeyArgs, getKeySerializer } from '../types';

export type GroupV1 = Account<GroupV1AccountData>;

export type GroupV1AccountData = {
key: Key;
updateAuthority: PublicKey;
name: string;
uri: string;
collections: Array<PublicKey>;
groups: Array<PublicKey>;
parentGroups: Array<PublicKey>;
assets: Array<PublicKey>;
};

export type GroupV1AccountDataArgs = {
key: KeyArgs;
updateAuthority: PublicKey;
name: string;
uri: string;
collections: Array<PublicKey>;
groups: Array<PublicKey>;
parentGroups: Array<PublicKey>;
assets: Array<PublicKey>;
};

export function getGroupV1AccountDataSerializer(): Serializer<
GroupV1AccountDataArgs,
GroupV1AccountData
> {
return struct<GroupV1AccountData>(
[
['key', getKeySerializer()],
['updateAuthority', publicKeySerializer()],
['name', string()],
['uri', string()],
['collections', array(publicKeySerializer())],
['groups', array(publicKeySerializer())],
['parentGroups', array(publicKeySerializer())],
['assets', array(publicKeySerializer())],
],
{ description: 'GroupV1AccountData' }
) as Serializer<GroupV1AccountDataArgs, GroupV1AccountData>;
}

export function deserializeGroupV1(rawAccount: RpcAccount): GroupV1 {
return deserializeAccount(rawAccount, getGroupV1AccountDataSerializer());
}

export async function fetchGroupV1(
context: Pick<Context, 'rpc'>,
publicKey: PublicKey | Pda,
options?: RpcGetAccountOptions
): Promise<GroupV1> {
const maybeAccount = await context.rpc.getAccount(
toPublicKey(publicKey, false),
options
);
assertAccountExists(maybeAccount, 'GroupV1');
return deserializeGroupV1(maybeAccount);
}

export async function safeFetchGroupV1(
context: Pick<Context, 'rpc'>,
publicKey: PublicKey | Pda,
options?: RpcGetAccountOptions
): Promise<GroupV1 | null> {
const maybeAccount = await context.rpc.getAccount(
toPublicKey(publicKey, false),
options
);
return maybeAccount.exists ? deserializeGroupV1(maybeAccount) : null;
}

export async function fetchAllGroupV1(
context: Pick<Context, 'rpc'>,
publicKeys: Array<PublicKey | Pda>,
options?: RpcGetAccountsOptions
): Promise<GroupV1[]> {
const maybeAccounts = await context.rpc.getAccounts(
publicKeys.map((key) => toPublicKey(key, false)),
options
);
return maybeAccounts.map((maybeAccount) => {
assertAccountExists(maybeAccount, 'GroupV1');
return deserializeGroupV1(maybeAccount);
});
}

export async function safeFetchAllGroupV1(
context: Pick<Context, 'rpc'>,
publicKeys: Array<PublicKey | Pda>,
options?: RpcGetAccountsOptions
): Promise<GroupV1[]> {
const maybeAccounts = await context.rpc.getAccounts(
publicKeys.map((key) => toPublicKey(key, false)),
options
);
return maybeAccounts
.filter((maybeAccount) => maybeAccount.exists)
.map((maybeAccount) => deserializeGroupV1(maybeAccount as RpcAccount));
}

export function getGroupV1GpaBuilder(
context: Pick<Context, 'rpc' | 'programs'>
) {
const programId = context.programs.getPublicKey(
'mplCore',
'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d'
);
return gpaBuilder(context, programId)
.registerFields<{
key: KeyArgs;
updateAuthority: PublicKey;
name: string;
uri: string;
collections: Array<PublicKey>;
groups: Array<PublicKey>;
parentGroups: Array<PublicKey>;
assets: Array<PublicKey>;
}>({
key: [0, getKeySerializer()],
updateAuthority: [1, publicKeySerializer()],
name: [33, string()],
uri: [null, string()],
collections: [null, array(publicKeySerializer())],
groups: [null, array(publicKeySerializer())],
parentGroups: [null, array(publicKeySerializer())],
assets: [null, array(publicKeySerializer())],
})
.deserializeUsing<GroupV1>((account) => deserializeGroupV1(account));
}
1 change: 1 addition & 0 deletions clients/js/src/generated/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
export * from './assetSigner';
export * from './assetV1';
export * from './collectionV1';
export * from './groupV1';
export * from './hashedAssetV1';
export * from './pluginHeaderV1';
export * from './pluginRegistryV1';
30 changes: 30 additions & 0 deletions clients/js/src/generated/errors/mplCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,36 @@ export class BlockedByBubblegumV2Error extends ProgramError {
codeToErrorMap.set(0x32, BlockedByBubblegumV2Error);
nameToErrorMap.set('BlockedByBubblegumV2', BlockedByBubblegumV2Error);

/** GroupMustBeEmpty: Group must be empty to be closed */
export class GroupMustBeEmptyError extends ProgramError {
override readonly name: string = 'GroupMustBeEmpty';

readonly code: number = 0x33; // 51

constructor(program: Program, cause?: Error) {
super('Group must be empty to be closed', program, cause);
}
}
codeToErrorMap.set(0x33, GroupMustBeEmptyError);
nameToErrorMap.set('GroupMustBeEmpty', GroupMustBeEmptyError);

/** DuplicateEntry: Duplicate entry provided when adding relationships to a group */
export class DuplicateEntryError extends ProgramError {
override readonly name: string = 'DuplicateEntry';

readonly code: number = 0x34; // 52

constructor(program: Program, cause?: Error) {
super(
'Duplicate entry provided when adding relationships to a group',
program,
cause
);
}
}
codeToErrorMap.set(0x34, DuplicateEntryError);
nameToErrorMap.set('DuplicateEntry', DuplicateEntryError);

/**
* Attempts to resolve a custom program error from the provided error code.
* @category Errors
Expand Down
Loading