Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding block and burn features #12

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
26 changes: 26 additions & 0 deletions clients/js/src/generated/errors/mplHybrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,32 @@ export class InvalidAuthorityError extends ProgramError {
codeToErrorMap.set(0x1780, InvalidAuthorityError);
nameToErrorMap.set('InvalidAuthority', InvalidAuthorityError);

/** CaptureBlocked: Capture is blocked for this recipe */
export class CaptureBlockedError extends ProgramError {
override readonly name: string = 'CaptureBlocked';

readonly code: number = 0x1781; // 6017

constructor(program: Program, cause?: Error) {
super('Capture is blocked for this recipe', program, cause);
}
}
codeToErrorMap.set(0x1781, CaptureBlockedError);
nameToErrorMap.set('CaptureBlocked', CaptureBlockedError);

/** ReleaseBlocked: Release is blocked for this recipe */
export class ReleaseBlockedError extends ProgramError {
override readonly name: string = 'ReleaseBlocked';

readonly code: number = 0x1782; // 6018

constructor(program: Program, cause?: Error) {
super('Release is blocked for this recipe', program, cause);
}
}
codeToErrorMap.set(0x1782, ReleaseBlockedError);
nameToErrorMap.set('ReleaseBlocked', ReleaseBlockedError);

/**
* 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/captureV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function captureV2(
},
token: {
index: 8,
isWritable: false as boolean,
isWritable: true as boolean,
value: input.token ?? null,
},
feeTokenAccount: {
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
* @see https://github.com/metaplex-foundation/kinobi
*/

export * from './path';
export * from './internalPath';
28 changes: 28 additions & 0 deletions clients/js/src/generated/types/internalPath.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* 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, scalarEnum } from '@metaplex-foundation/umi/serializers';

export enum InternalPath {
NoRerollMetadata,
BlockCapture,
BlockRelease,
BurnOnCapture,
BurnOnRelease,
}

export type InternalPathArgs = InternalPath;

export function getInternalPathSerializer(): Serializer<
InternalPathArgs,
InternalPath
> {
return scalarEnum<InternalPath>(InternalPath, {
description: 'InternalPath',
}) as Serializer<InternalPathArgs, InternalPath>;
}
22 changes: 0 additions & 22 deletions clients/js/src/generated/types/path.ts

This file was deleted.

1 change: 1 addition & 0 deletions clients/js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './generated';
export * from './plugin';
export * from './path';
27 changes: 27 additions & 0 deletions clients/js/src/path.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { InternalPath } from './generated';

enum CustomPath {
RerollMetadata = 16,
}

export const Path = {
...InternalPath,
...CustomPath,
} as const;

// eslint-disable-next-line @typescript-eslint/no-redeclare
export type Path = InternalPath | CustomPath;

export function buildPath(features: Path[]) {
let path = 0;

// eslint-disable-next-line no-restricted-syntax
for (const feature of features) {
if (feature !== Path.RerollMetadata) {
// eslint-disable-next-line no-bitwise
path |= 1 << feature;
}
}

return path;
}
Loading
Loading