Skip to content

Commit

Permalink
regenerated clients
Browse files Browse the repository at this point in the history
  • Loading branch information
StanChe committed Sep 24, 2024
1 parent 1906a77 commit d352e05
Show file tree
Hide file tree
Showing 12 changed files with 1,812 additions and 2 deletions.
80 changes: 80 additions & 0 deletions clients/js/src/generated/errors/splAccountCompression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,86 @@ export class LeafIndexOutOfBoundsError extends ProgramError {
codeToErrorMap.set(0x1778, LeafIndexOutOfBoundsError);
nameToErrorMap.set('LeafIndexOutOfBounds', LeafIndexOutOfBoundsError);

/** CanopyNotAllocated: Tree was initialized without allocating space for the canopy */
export class CanopyNotAllocatedError extends ProgramError {
readonly name: string = 'CanopyNotAllocated';

readonly code: number = 0x1779; // 6009

constructor(program: Program, cause?: Error) {
super(
'Tree was initialized without allocating space for the canopy',
program,
cause
);
}
}
codeToErrorMap.set(0x1779, CanopyNotAllocatedError);
nameToErrorMap.set('CanopyNotAllocated', CanopyNotAllocatedError);

/** TreeAlreadyInitialized: Tree was already initialized */
export class TreeAlreadyInitializedError extends ProgramError {
readonly name: string = 'TreeAlreadyInitialized';

readonly code: number = 0x177a; // 6010

constructor(program: Program, cause?: Error) {
super('Tree was already initialized', program, cause);
}
}
codeToErrorMap.set(0x177a, TreeAlreadyInitializedError);
nameToErrorMap.set('TreeAlreadyInitialized', TreeAlreadyInitializedError);

/** BatchNotInitialized: Tree header was not initialized for batch processing */
export class BatchNotInitializedError extends ProgramError {
readonly name: string = 'BatchNotInitialized';

readonly code: number = 0x177b; // 6011

constructor(program: Program, cause?: Error) {
super(
'Tree header was not initialized for batch processing',
program,
cause
);
}
}
codeToErrorMap.set(0x177b, BatchNotInitializedError);
nameToErrorMap.set('BatchNotInitialized', BatchNotInitializedError);

/** CanopyRootMismatch: Canopy root does not match the root of the tree */
export class CanopyRootMismatchError extends ProgramError {
readonly name: string = 'CanopyRootMismatch';

readonly code: number = 0x177c; // 6012

constructor(program: Program, cause?: Error) {
super('Canopy root does not match the root of the tree', program, cause);
}
}
codeToErrorMap.set(0x177c, CanopyRootMismatchError);
nameToErrorMap.set('CanopyRootMismatch', CanopyRootMismatchError);

/** CanopyRightmostLeafMismatch: Canopy contains nodes to the right of the rightmost leaf of the tree */
export class CanopyRightmostLeafMismatchError extends ProgramError {
readonly name: string = 'CanopyRightmostLeafMismatch';

readonly code: number = 0x177d; // 6013

constructor(program: Program, cause?: Error) {
super(
'Canopy contains nodes to the right of the rightmost leaf of the tree',
program,
cause
);
}
}
codeToErrorMap.set(0x177d, CanopyRightmostLeafMismatchError);
nameToErrorMap.set(
'CanopyRightmostLeafMismatch',
CanopyRightmostLeafMismatchError
);

/**
* Attempts to resolve a custom program error from the provided error code.
* @category Errors
Expand Down
137 changes: 137 additions & 0 deletions clients/js/src/generated/instructions/appendCanopyNodes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/**
* 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 {
Context,
Pda,
PublicKey,
Signer,
TransactionBuilder,
transactionBuilder,
} from '@metaplex-foundation/umi';
import {
Serializer,
array,
bytes,
mapSerializer,
struct,
u32,
u8,
} from '@metaplex-foundation/umi/serializers';
import {
ResolvedAccount,
ResolvedAccountsWithIndices,
getAccountMetasAndSigners,
} from '../shared';

// Accounts.
export type AppendCanopyNodesInstructionAccounts = {
merkleTree: PublicKey | Pda;
/**
* Authority that controls write-access to the tree
* Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs.
*/

authority?: Signer;
/** Program used to emit changelogs as cpi instruction data. */
noop: PublicKey | Pda;
};

// Data.
export type AppendCanopyNodesInstructionData = {
discriminator: Array<number>;
startIndex: number;
canopyNodes: Array<Uint8Array>;
};

export type AppendCanopyNodesInstructionDataArgs = {
startIndex: number;
canopyNodes: Array<Uint8Array>;
};

export function getAppendCanopyNodesInstructionDataSerializer(): Serializer<
AppendCanopyNodesInstructionDataArgs,
AppendCanopyNodesInstructionData
> {
return mapSerializer<
AppendCanopyNodesInstructionDataArgs,
any,
AppendCanopyNodesInstructionData
>(
struct<AppendCanopyNodesInstructionData>(
[
['discriminator', array(u8(), { size: 8 })],
['startIndex', u32()],
['canopyNodes', array(bytes({ size: 32 }))],
],
{ description: 'AppendCanopyNodesInstructionData' }
),
(value) => ({
...value,
discriminator: [139, 155, 238, 167, 11, 243, 132, 205],
})
) as Serializer<
AppendCanopyNodesInstructionDataArgs,
AppendCanopyNodesInstructionData
>;
}

// Args.
export type AppendCanopyNodesInstructionArgs =
AppendCanopyNodesInstructionDataArgs;

// Instruction.
export function appendCanopyNodes(
context: Pick<Context, 'identity' | 'programs'>,
input: AppendCanopyNodesInstructionAccounts & AppendCanopyNodesInstructionArgs
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'splAccountCompression',
'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK'
);

// Accounts.
const resolvedAccounts: ResolvedAccountsWithIndices = {
merkleTree: { index: 0, isWritable: true, value: input.merkleTree ?? null },
authority: { index: 1, isWritable: false, value: input.authority ?? null },
noop: { index: 2, isWritable: false, value: input.noop ?? null },
};

// Arguments.
const resolvedArgs: AppendCanopyNodesInstructionArgs = { ...input };

// Default values.
if (!resolvedAccounts.authority.value) {
resolvedAccounts.authority.value = context.identity;
}

// Accounts in order.
const orderedAccounts: ResolvedAccount[] = Object.values(
resolvedAccounts
).sort((a, b) => a.index - b.index);

// Keys and Signers.
const [keys, signers] = getAccountMetasAndSigners(
orderedAccounts,
'programId',
programId
);

// Data.
const data = getAppendCanopyNodesInstructionDataSerializer().serialize(
resolvedArgs as AppendCanopyNodesInstructionDataArgs
);

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

return transactionBuilder([
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
]);
}
3 changes: 3 additions & 0 deletions clients/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
*/

export * from './addCanopy';
export * from './appendCanopyNodes';
export * from './burn';
export * from './cancelRedeem';
export * from './createTreeConfig';
export * from './decompressV1';
export * from './delegate';
export * from './finalizeTreeWithRoot';
export * from './finalizeTreeWithRootAndCollection';
export * from './initPreparedTreeWithRoot';
export * from './mintToCollectionV1';
export * from './mintV1';
export * from './prepareBatchMerkleTree';
export * from './prepareTree';
export * from './redeem';
export * from './setAndVerifyCollection';
Expand Down
141 changes: 141 additions & 0 deletions clients/js/src/generated/instructions/initPreparedTreeWithRoot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/**
* 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 {
Context,
Pda,
PublicKey,
Signer,
TransactionBuilder,
transactionBuilder,
} from '@metaplex-foundation/umi';
import {
Serializer,
array,
bytes,
mapSerializer,
struct,
u32,
u8,
} from '@metaplex-foundation/umi/serializers';
import {
ResolvedAccount,
ResolvedAccountsWithIndices,
getAccountMetasAndSigners,
} from '../shared';

// Accounts.
export type InitPreparedTreeWithRootInstructionAccounts = {
merkleTree: PublicKey | Pda;
/**
* Authority that controls write-access to the tree
* Typically a program, e.g., the Bubblegum contract validates that leaves are valid NFTs.
*/

authority?: Signer;
/** Program used to emit changelogs as cpi instruction data. */
noop: PublicKey | Pda;
};

// Data.
export type InitPreparedTreeWithRootInstructionData = {
discriminator: Array<number>;
root: Uint8Array;
rightmostLeaf: Uint8Array;
rightmostIndex: number;
};

export type InitPreparedTreeWithRootInstructionDataArgs = {
root: Uint8Array;
rightmostLeaf: Uint8Array;
rightmostIndex: number;
};

export function getInitPreparedTreeWithRootInstructionDataSerializer(): Serializer<
InitPreparedTreeWithRootInstructionDataArgs,
InitPreparedTreeWithRootInstructionData
> {
return mapSerializer<
InitPreparedTreeWithRootInstructionDataArgs,
any,
InitPreparedTreeWithRootInstructionData
>(
struct<InitPreparedTreeWithRootInstructionData>(
[
['discriminator', array(u8(), { size: 8 })],
['root', bytes({ size: 32 })],
['rightmostLeaf', bytes({ size: 32 })],
['rightmostIndex', u32()],
],
{ description: 'InitPreparedTreeWithRootInstructionData' }
),
(value) => ({
...value,
discriminator: [218, 248, 192, 55, 91, 205, 122, 10],
})
) as Serializer<
InitPreparedTreeWithRootInstructionDataArgs,
InitPreparedTreeWithRootInstructionData
>;
}

// Args.
export type InitPreparedTreeWithRootInstructionArgs =
InitPreparedTreeWithRootInstructionDataArgs;

// Instruction.
export function initPreparedTreeWithRoot(
context: Pick<Context, 'identity' | 'programs'>,
input: InitPreparedTreeWithRootInstructionAccounts &
InitPreparedTreeWithRootInstructionArgs
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'splAccountCompression',
'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK'
);

// Accounts.
const resolvedAccounts: ResolvedAccountsWithIndices = {
merkleTree: { index: 0, isWritable: true, value: input.merkleTree ?? null },
authority: { index: 1, isWritable: false, value: input.authority ?? null },
noop: { index: 2, isWritable: false, value: input.noop ?? null },
};

// Arguments.
const resolvedArgs: InitPreparedTreeWithRootInstructionArgs = { ...input };

// Default values.
if (!resolvedAccounts.authority.value) {
resolvedAccounts.authority.value = context.identity;
}

// Accounts in order.
const orderedAccounts: ResolvedAccount[] = Object.values(
resolvedAccounts
).sort((a, b) => a.index - b.index);

// Keys and Signers.
const [keys, signers] = getAccountMetasAndSigners(
orderedAccounts,
'programId',
programId
);

// Data.
const data = getInitPreparedTreeWithRootInstructionDataSerializer().serialize(
resolvedArgs as InitPreparedTreeWithRootInstructionDataArgs
);

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

return transactionBuilder([
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
]);
}
Loading

0 comments on commit d352e05

Please sign in to comment.