generated from metaplex-foundation/solana-project-template
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,812 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
clients/js/src/generated/instructions/appendCanopyNodes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }, | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
clients/js/src/generated/instructions/initPreparedTreeWithRoot.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }, | ||
]); | ||
} |
Oops, something went wrong.