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 verify_collection, unverify_collection, and set_and_verify_collection to Bubblegum #687

Merged
merged 12 commits into from
Aug 30, 2022
Merged
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
420 changes: 420 additions & 0 deletions bubblegum/js/idl/bubblegum.json

Large diffs are not rendered by default.

164 changes: 164 additions & 0 deletions bubblegum/js/src/generated/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,170 @@ createErrorFromNameLookup.set(
() => new CloseMintRequestErrorError()
)

/**
* NumericalOverflowError: 'NumericalOverflowError'
*
* @category Errors
* @category generated
*/
export class NumericalOverflowErrorError extends Error {
readonly code: number = 0x1783
readonly name: string = 'NumericalOverflowError'
constructor() {
super('NumericalOverflowError')
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, NumericalOverflowErrorError)
}
}
}

createErrorFromCodeLookup.set(0x1783, () => new NumericalOverflowErrorError())
createErrorFromNameLookup.set(
'NumericalOverflowError',
() => new NumericalOverflowErrorError()
)

/**
* IncorrectOwner: 'Incorrect account owner'
*
* @category Errors
* @category generated
*/
export class IncorrectOwnerError extends Error {
readonly code: number = 0x1784
readonly name: string = 'IncorrectOwner'
constructor() {
super('Incorrect account owner')
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, IncorrectOwnerError)
}
}
}

createErrorFromCodeLookup.set(0x1784, () => new IncorrectOwnerError())
createErrorFromNameLookup.set('IncorrectOwner', () => new IncorrectOwnerError())

/**
* CollectionCannotBeVerifiedInThisInstruction: 'Cannot Verify Collection in this Instruction'
*
* @category Errors
* @category generated
*/
export class CollectionCannotBeVerifiedInThisInstructionError extends Error {
readonly code: number = 0x1785
readonly name: string = 'CollectionCannotBeVerifiedInThisInstruction'
constructor() {
super('Cannot Verify Collection in this Instruction')
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(
this,
CollectionCannotBeVerifiedInThisInstructionError
)
}
}
}

createErrorFromCodeLookup.set(
0x1785,
() => new CollectionCannotBeVerifiedInThisInstructionError()
)
createErrorFromNameLookup.set(
'CollectionCannotBeVerifiedInThisInstruction',
() => new CollectionCannotBeVerifiedInThisInstructionError()
)

/**
* CollectionNotFound: 'Collection Not Found on Metadata'
*
* @category Errors
* @category generated
*/
export class CollectionNotFoundError extends Error {
readonly code: number = 0x1786
readonly name: string = 'CollectionNotFound'
constructor() {
super('Collection Not Found on Metadata')
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, CollectionNotFoundError)
}
}
}

createErrorFromCodeLookup.set(0x1786, () => new CollectionNotFoundError())
createErrorFromNameLookup.set(
'CollectionNotFound',
() => new CollectionNotFoundError()
)

/**
* AlreadyVerified: 'Collection item is already verified.'
*
* @category Errors
* @category generated
*/
export class AlreadyVerifiedError extends Error {
readonly code: number = 0x1787
readonly name: string = 'AlreadyVerified'
constructor() {
super('Collection item is already verified.')
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, AlreadyVerifiedError)
}
}
}

createErrorFromCodeLookup.set(0x1787, () => new AlreadyVerifiedError())
createErrorFromNameLookup.set(
'AlreadyVerified',
() => new AlreadyVerifiedError()
)

/**
* AlreadyUnverified: 'Collection item is already unverified.'
*
* @category Errors
* @category generated
*/
export class AlreadyUnverifiedError extends Error {
readonly code: number = 0x1788
readonly name: string = 'AlreadyUnverified'
constructor() {
super('Collection item is already unverified.')
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, AlreadyUnverifiedError)
}
}
}

createErrorFromCodeLookup.set(0x1788, () => new AlreadyUnverifiedError())
createErrorFromNameLookup.set(
'AlreadyUnverified',
() => new AlreadyUnverifiedError()
)

/**
* UpdateAuthorityIncorrect: 'Incorrect leaf metadata update authority.'
*
* @category Errors
* @category generated
*/
export class UpdateAuthorityIncorrectError extends Error {
readonly code: number = 0x1789
readonly name: string = 'UpdateAuthorityIncorrect'
constructor() {
super('Incorrect leaf metadata update authority.')
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, UpdateAuthorityIncorrectError)
}
}
}

createErrorFromCodeLookup.set(0x1789, () => new UpdateAuthorityIncorrectError())
createErrorFromNameLookup.set(
'UpdateAuthorityIncorrect',
() => new UpdateAuthorityIncorrectError()
)

/**
* Attempts to resolve a custom program error from the provided error code.
* @category Errors
Expand Down
3 changes: 3 additions & 0 deletions bubblegum/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export * from './delegate'
export * from './mintV1'
export * from './redeem'
export * from './requestMintAuthority'
export * from './setAndVerifyCollection'
export * from './setTreeDelegate'
export * from './transfer'
export * from './unverifyCollection'
export * from './unverifyCreator'
export * from './verifyCollection'
export * from './verifyCreator'
188 changes: 188 additions & 0 deletions bubblegum/js/src/generated/instructions/setAndVerifyCollection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
/**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'

/**
* @category Instructions
* @category SetAndVerifyCollection
* @category generated
*/
export type SetAndVerifyCollectionInstructionArgs = {
root: number[] /* size: 32 */
dataHash: number[] /* size: 32 */
creatorHash: number[] /* size: 32 */
nonce: beet.bignum
index: number
message: MetadataArgs
collection: number[] /* size: 32 */
}
/**
* @category Instructions
* @category SetAndVerifyCollection
* @category generated
*/
export const setAndVerifyCollectionStruct = new beet.FixableBeetArgsStruct<
SetAndVerifyCollectionInstructionArgs & {
instructionDiscriminator: number[] /* size: 8 */
}
>(
[
['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
['root', beet.uniformFixedSizeArray(beet.u8, 32)],
['dataHash', beet.uniformFixedSizeArray(beet.u8, 32)],
['creatorHash', beet.uniformFixedSizeArray(beet.u8, 32)],
['nonce', beet.u64],
['index', beet.u32],
['message', metadataArgsBeet],
['collection', beet.uniformFixedSizeArray(beet.u8, 32)],
],
'SetAndVerifyCollectionInstructionArgs'
)
/**
* Accounts required by the _setAndVerifyCollection_ instruction
*
* @property [] authority
* @property [] owner
* @property [] delegate
* @property [**signer**] payer
* @property [] treeDelegate
* @property [**signer**] collectionAuthority
* @property [] collectionMint
* @property [] collectionMetadata
* @property [] editionAccount
* @property [] bubblegumSigner
* @property [] candyWrapper
* @property [] gummyrollProgram
* @property [_writable_] merkleSlab
* @property [] tokenMetadataProgram
* @category Instructions
* @category SetAndVerifyCollection
* @category generated
*/
export type SetAndVerifyCollectionInstructionAccounts = {
authority: web3.PublicKey
owner: web3.PublicKey
delegate: web3.PublicKey
payer: web3.PublicKey
treeDelegate: web3.PublicKey
collectionAuthority: web3.PublicKey
collectionMint: web3.PublicKey
collectionMetadata: web3.PublicKey
editionAccount: web3.PublicKey
bubblegumSigner: web3.PublicKey
candyWrapper: web3.PublicKey
gummyrollProgram: web3.PublicKey
merkleSlab: web3.PublicKey
tokenMetadataProgram: web3.PublicKey
}

export const setAndVerifyCollectionInstructionDiscriminator = [
235, 242, 121, 216, 158, 234, 180, 234,
]

/**
* Creates a _SetAndVerifyCollection_ instruction.
*
* @param accounts that will be accessed while the instruction is processed
* @param args to provide as instruction data to the program
*
* @category Instructions
* @category SetAndVerifyCollection
* @category generated
*/
export function createSetAndVerifyCollectionInstruction(
accounts: SetAndVerifyCollectionInstructionAccounts,
args: SetAndVerifyCollectionInstructionArgs,
programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY')
) {
const [data] = setAndVerifyCollectionStruct.serialize({
instructionDiscriminator: setAndVerifyCollectionInstructionDiscriminator,
...args,
})
const keys: web3.AccountMeta[] = [
{
pubkey: accounts.authority,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.owner,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.delegate,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.payer,
isWritable: false,
isSigner: true,
},
{
pubkey: accounts.treeDelegate,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionAuthority,
isWritable: false,
isSigner: true,
},
{
pubkey: accounts.collectionMint,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionMetadata,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.editionAccount,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.bubblegumSigner,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.candyWrapper,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.gummyrollProgram,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.merkleSlab,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.tokenMetadataProgram,
isWritable: false,
isSigner: false,
},
]

const ix = new web3.TransactionInstruction({
programId,
keys,
data,
})
return ix
}
Loading